- Bootstrap script for creating monorepo projects - FastAPI backend templates with uv, ruff, mypy, pytest - React frontend templates with TypeScript, ESLint, Prettier - Docker Compose setup with backend, frontend, and database - 9 development and CI scripts - Gitea Actions CI/CD workflows - Comprehensive documentation (8 files) - 45 template files for complete project structure - Automated verification script (all tests pass) - Based on coding-agent-rules standards
287 lines
8.6 KiB
Markdown
287 lines
8.6 KiB
Markdown
# Features
|
|
|
|
## Overview
|
|
|
|
This bootstrap creates a production-ready monorepo with modern tooling and best practices based on the [coding-agent-rules](https://git.prettyhefty.com/Bill/coding-agent-rules).
|
|
|
|
## Core Features
|
|
|
|
### 🏗️ Project Structure
|
|
|
|
- **Monorepo Layout** - Clean separation of backend, frontend, deployment, and scripts
|
|
- **Modular Organization** - Clear directory structure following industry standards
|
|
- **Scalable Architecture** - Easy to extend and maintain
|
|
|
|
### 🐍 Backend (FastAPI)
|
|
|
|
- **Python 3.11+** - Modern Python with latest features
|
|
- **FastAPI Framework** - High-performance async web framework
|
|
- **Pydantic v2** - Data validation and settings management
|
|
- **uv Package Manager** - Fast, reliable dependency management
|
|
- **Type Safety** - Full mypy type checking with strict mode
|
|
- **Code Quality**
|
|
- ruff for linting and formatting
|
|
- 100% test coverage requirement
|
|
- pytest with async support
|
|
- **API Documentation** - Auto-generated OpenAPI/Swagger docs
|
|
- **Error Handling** - Centralized error handling utilities
|
|
- **Configuration Management** - Environment-based settings with Pydantic
|
|
|
|
### ⚛️ Frontend (React)
|
|
|
|
- **React 18** - Latest React with concurrent features
|
|
- **TypeScript** - Full type safety with strict mode
|
|
- **Modern Tooling**
|
|
- ESLint for linting
|
|
- Prettier for formatting
|
|
- Jest for testing
|
|
- React Testing Library
|
|
- **Code Quality** - 90%+ test coverage requirement
|
|
- **API Integration** - Axios with interceptors and centralized configuration
|
|
- **Component Structure** - Organized by feature and common components
|
|
- **State Management** - Ready for Redux/Context API
|
|
- **Responsive Design** - Mobile-first approach
|
|
|
|
### 🐳 Docker & Deployment
|
|
|
|
- **Docker Compose** - Complete local development environment
|
|
- **Multi-Service Setup**
|
|
- Backend container
|
|
- Frontend container
|
|
- PostgreSQL database
|
|
- **Hot Reload** - Automatic reload on code changes
|
|
- **Volume Mounting** - Live code updates without rebuilding
|
|
- **Environment Variables** - Proper configuration management
|
|
- **Production Ready** - Dockerfiles optimized for production builds
|
|
|
|
### 🔧 Development Scripts
|
|
|
|
#### Developer Scripts (`scripts/dev/`)
|
|
- **start-backend.sh** - Start FastAPI development server
|
|
- **start-frontend.sh** - Start React development server
|
|
- **start-database.sh** - Start PostgreSQL container
|
|
- **reset-database.sh** - Reset database (with confirmation)
|
|
|
|
#### Utility Scripts (`scripts/utils/`)
|
|
- **lint-backend.sh** - Run backend linting and type checking
|
|
- **lint-frontend.sh** - Run frontend linting
|
|
- **format-all.sh** - Format all code (backend + frontend)
|
|
|
|
#### CI Scripts (`scripts/ci/`)
|
|
- **backend-test.sh** - Complete backend CI pipeline
|
|
- **frontend-test.sh** - Complete frontend CI pipeline
|
|
|
|
### 🚀 CI/CD
|
|
|
|
- **Gitea Actions** - Ready-to-use CI workflows
|
|
- **Automated Testing** - Run tests on every push/PR
|
|
- **Code Quality Checks** - Linting and type checking in CI
|
|
- **Coverage Reports** - Track test coverage over time
|
|
- **Path-Based Triggers** - Only run relevant tests
|
|
|
|
### 📚 Documentation
|
|
|
|
#### API Documentation
|
|
- OpenAPI/Swagger auto-generated docs
|
|
- ReDoc alternative documentation
|
|
- API changelog for tracking changes
|
|
- Example requests and responses
|
|
|
|
#### Architecture Documentation
|
|
- System architecture diagrams
|
|
- Component interaction flows
|
|
- Database schema documentation
|
|
- Deployment architecture
|
|
|
|
#### User Guide
|
|
- Getting started guide
|
|
- Development workflow
|
|
- Testing guide
|
|
- Troubleshooting tips
|
|
|
|
### 🧪 Testing
|
|
|
|
#### Backend Testing
|
|
- **pytest** - Modern Python testing framework
|
|
- **pytest-asyncio** - Async test support
|
|
- **pytest-cov** - Coverage reporting
|
|
- **Unit Tests** - Test individual components
|
|
- **Integration Tests** - Test API endpoints
|
|
- **100% Coverage** - Required for all backend code
|
|
- **Test Fixtures** - Reusable test components
|
|
|
|
#### Frontend Testing
|
|
- **Jest** - JavaScript testing framework
|
|
- **React Testing Library** - Component testing
|
|
- **Coverage Thresholds** - 90%+ required
|
|
- **Component Tests** - Test UI components
|
|
- **Service Tests** - Test API services
|
|
- **Integration Tests** - Test user flows
|
|
|
|
### 🔒 Security
|
|
|
|
- **Environment Variables** - Secrets not in code
|
|
- **CORS Configuration** - Proper cross-origin setup
|
|
- **Input Validation** - Pydantic schemas for validation
|
|
- **Type Safety** - TypeScript and mypy prevent type errors
|
|
- **SQL Injection Prevention** - ORM-based queries
|
|
- **Authentication Ready** - Structure for auth implementation
|
|
|
|
### 📦 Package Management
|
|
|
|
#### Backend
|
|
- **uv** - Fast, modern Python package manager
|
|
- **pyproject.toml** - Standard Python project configuration
|
|
- **Lock File Support** - Reproducible builds
|
|
- **Dev Dependencies** - Separate dev and prod dependencies
|
|
|
|
#### Frontend
|
|
- **npm** - Standard Node.js package manager
|
|
- **package.json** - Project configuration
|
|
- **package-lock.json** - Dependency locking
|
|
- **Dev Dependencies** - Separate dev and prod dependencies
|
|
|
|
### 🎨 Code Quality
|
|
|
|
#### Backend
|
|
- **ruff** - Fast Python linter and formatter
|
|
- Replaces flake8, isort, black
|
|
- Extremely fast (10-100x faster)
|
|
- Auto-fix capabilities
|
|
- **mypy** - Static type checker
|
|
- Strict mode enabled
|
|
- Catches type errors before runtime
|
|
|
|
#### Frontend
|
|
- **ESLint** - JavaScript/TypeScript linter
|
|
- React-specific rules
|
|
- TypeScript support
|
|
- Auto-fix capabilities
|
|
- **Prettier** - Code formatter
|
|
- Consistent code style
|
|
- Integrates with ESLint
|
|
|
|
### 🔄 Development Workflow
|
|
|
|
- **Hot Reload** - Instant feedback on code changes
|
|
- **Fast Startup** - Quick development environment setup
|
|
- **Easy Testing** - Simple commands to run tests
|
|
- **Code Formatting** - One command to format everything
|
|
- **Git Integration** - Pre-configured .gitignore
|
|
- **Documentation** - Comprehensive guides and examples
|
|
|
|
### 📊 Monitoring & Logging
|
|
|
|
- **Structured Logging** - JSON logs in production
|
|
- **Correlation IDs** - Track requests across services
|
|
- **Health Checks** - Monitor service health
|
|
- **Error Tracking** - Centralized error handling
|
|
|
|
### 🎯 Best Practices
|
|
|
|
- **DRY Principle** - Don't Repeat Yourself
|
|
- **SOLID Principles** - Clean code architecture
|
|
- **Test-Driven Development** - Write tests first
|
|
- **Continuous Integration** - Automated testing
|
|
- **Code Reviews** - Pull request workflows
|
|
- **Documentation** - Keep docs up to date
|
|
|
|
## What's Included
|
|
|
|
### Configuration Files
|
|
|
|
- ✅ `pyproject.toml` - Python project configuration
|
|
- ✅ `package.json` - Node.js project configuration
|
|
- ✅ `tsconfig.json` - TypeScript configuration
|
|
- ✅ `.eslintrc.json` - ESLint configuration
|
|
- ✅ `.prettierrc.json` - Prettier configuration
|
|
- ✅ `compose.yml` - Docker Compose configuration
|
|
- ✅ `.gitignore` - Git ignore rules
|
|
- ✅ `.env.example` - Environment variable templates
|
|
|
|
### Source Files
|
|
|
|
- ✅ FastAPI application entry point
|
|
- ✅ Core configuration module
|
|
- ✅ Error handling utilities
|
|
- ✅ React application component
|
|
- ✅ API service client
|
|
- ✅ Example tests (backend and frontend)
|
|
- ✅ Test configuration
|
|
|
|
### Docker Files
|
|
|
|
- ✅ Backend Dockerfile
|
|
- ✅ Frontend Dockerfile
|
|
- ✅ Docker Compose with all services
|
|
- ✅ PostgreSQL database setup
|
|
|
|
### Scripts
|
|
|
|
- ✅ 9 development and CI scripts
|
|
- ✅ All scripts executable and tested
|
|
- ✅ Error handling and validation
|
|
|
|
### Documentation
|
|
|
|
- ✅ Main README
|
|
- ✅ Usage guide
|
|
- ✅ Quick start guide
|
|
- ✅ API documentation
|
|
- ✅ Architecture documentation
|
|
- ✅ User guide
|
|
- ✅ API changelog
|
|
|
|
### CI/CD
|
|
|
|
- ✅ Backend CI workflow
|
|
- ✅ Frontend CI workflow
|
|
- ✅ Automated testing
|
|
- ✅ Coverage reporting
|
|
|
|
## What's NOT Included (By Design)
|
|
|
|
These are intentionally left for you to implement based on your needs:
|
|
|
|
- ❌ Database migrations (Alembic)
|
|
- ❌ Authentication/Authorization
|
|
- ❌ Specific business logic
|
|
- ❌ Production deployment configs
|
|
- ❌ Monitoring/Observability tools
|
|
- ❌ Message queues
|
|
- ❌ Caching layer
|
|
- ❌ CDN configuration
|
|
|
|
## Extensibility
|
|
|
|
The bootstrap is designed to be extended with:
|
|
|
|
- **Database ORM** - Add SQLAlchemy or similar
|
|
- **Authentication** - Add JWT, OAuth, etc.
|
|
- **State Management** - Add Redux, Zustand, etc.
|
|
- **UI Framework** - Add Material-UI, Chakra, etc.
|
|
- **API Gateway** - Add Kong, Traefik, etc.
|
|
- **Message Queue** - Add RabbitMQ, Redis, etc.
|
|
- **Caching** - Add Redis, Memcached, etc.
|
|
- **Search** - Add Elasticsearch, etc.
|
|
|
|
## Technology Versions
|
|
|
|
- Python: 3.11+
|
|
- Node.js: 20 LTS
|
|
- React: 18.2+
|
|
- FastAPI: 0.104+
|
|
- TypeScript: 5.3+
|
|
- PostgreSQL: 16+
|
|
- Docker Compose: 3.8+
|
|
|
|
## Compliance
|
|
|
|
Follows standards from:
|
|
- [coding-agent-rules](https://git.prettyhefty.com/Bill/coding-agent-rules)
|
|
- PEP 8 (Python style guide)
|
|
- Airbnb JavaScript Style Guide
|
|
- React best practices
|
|
- Docker best practices
|
|
- 12-Factor App methodology
|