Initial commit: Complete project-bootstrap tool
- 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
This commit is contained in:
35
templates/docs/api/CHANGELOG.md
Normal file
35
templates/docs/api/CHANGELOG.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# API Changelog
|
||||
|
||||
All notable changes to the API will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Initial API setup with FastAPI
|
||||
- Health check endpoint
|
||||
- Root endpoint
|
||||
|
||||
### Changed
|
||||
- N/A
|
||||
|
||||
### Deprecated
|
||||
- N/A
|
||||
|
||||
### Removed
|
||||
- N/A
|
||||
|
||||
### Fixed
|
||||
- N/A
|
||||
|
||||
### Security
|
||||
- N/A
|
||||
|
||||
## [0.1.0] - YYYY-MM-DD
|
||||
|
||||
### Added
|
||||
- Initial release
|
||||
- Basic project structure
|
||||
- FastAPI application setup
|
||||
79
templates/docs/api/README.md
Normal file
79
templates/docs/api/README.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# API Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
The API is built with FastAPI and follows REST principles.
|
||||
|
||||
## Base URL
|
||||
|
||||
- **Development**: `http://localhost:8000`
|
||||
- **API Prefix**: `/api/v1`
|
||||
|
||||
## Interactive Documentation
|
||||
|
||||
FastAPI provides automatic interactive API documentation:
|
||||
|
||||
- **Swagger UI**: http://localhost:8000/docs
|
||||
- **ReDoc**: http://localhost:8000/redoc
|
||||
|
||||
## Authentication
|
||||
|
||||
(Add authentication details here when implemented)
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Health Check
|
||||
|
||||
```
|
||||
GET /health
|
||||
```
|
||||
|
||||
Returns the health status of the API.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "healthy"
|
||||
}
|
||||
```
|
||||
|
||||
### Root
|
||||
|
||||
```
|
||||
GET /
|
||||
```
|
||||
|
||||
Returns basic API information.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"message": "Welcome to the API",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
## Error Responses
|
||||
|
||||
All error responses follow this format:
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": "Error message here"
|
||||
}
|
||||
```
|
||||
|
||||
### Common Status Codes
|
||||
|
||||
- **200 OK** - Request succeeded
|
||||
- **201 Created** - Resource created successfully
|
||||
- **400 Bad Request** - Invalid request data
|
||||
- **401 Unauthorized** - Authentication required
|
||||
- **403 Forbidden** - Insufficient permissions
|
||||
- **404 Not Found** - Resource not found
|
||||
- **422 Unprocessable Entity** - Validation error
|
||||
- **500 Internal Server Error** - Server error
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG.md](./CHANGELOG.md) for API changes and migration notes.
|
||||
131
templates/docs/architecture/README.md
Normal file
131
templates/docs/architecture/README.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# Architecture Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
This project follows a monorepo architecture with separate backend and frontend applications.
|
||||
|
||||
## System Architecture
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ Client │
|
||||
│ (Browser) │
|
||||
└──────┬──────┘
|
||||
│
|
||||
│ HTTP/HTTPS
|
||||
│
|
||||
┌──────▼──────┐
|
||||
│ Frontend │
|
||||
│ (React) │
|
||||
└──────┬──────┘
|
||||
│
|
||||
│ REST API
|
||||
│
|
||||
┌──────▼──────┐
|
||||
│ Backend │
|
||||
│ (FastAPI) │
|
||||
└──────┬──────┘
|
||||
│
|
||||
│ SQL
|
||||
│
|
||||
┌──────▼──────┐
|
||||
│ Database │
|
||||
│ (PostgreSQL)│
|
||||
└─────────────┘
|
||||
```
|
||||
|
||||
## Backend Architecture
|
||||
|
||||
### Layers
|
||||
|
||||
1. **API Layer** (`app/api/`)
|
||||
- HTTP endpoints
|
||||
- Request/response handling
|
||||
- Route definitions
|
||||
|
||||
2. **Service Layer** (`app/services/`)
|
||||
- Business logic
|
||||
- Data processing
|
||||
- External integrations
|
||||
|
||||
3. **Data Layer** (`app/db/`)
|
||||
- Database models
|
||||
- Database connections
|
||||
- Query operations
|
||||
|
||||
4. **Core Layer** (`app/core/`)
|
||||
- Configuration
|
||||
- Security
|
||||
- Error handling
|
||||
|
||||
### Request Flow
|
||||
|
||||
```
|
||||
Request → API Endpoint → Service → Database → Service → API Response
|
||||
```
|
||||
|
||||
## Frontend Architecture
|
||||
|
||||
### Structure
|
||||
|
||||
- **Components** - Reusable UI components
|
||||
- **Pages** - Route-level components
|
||||
- **Services** - API communication
|
||||
- **Store** - State management
|
||||
- **Utils** - Helper functions
|
||||
|
||||
### Data Flow
|
||||
|
||||
```
|
||||
User Action → Component → Service → API → Backend
|
||||
↓
|
||||
State Update
|
||||
↓
|
||||
UI Re-render
|
||||
```
|
||||
|
||||
## Deployment Architecture
|
||||
|
||||
### Development
|
||||
|
||||
All services run in Docker containers orchestrated by Docker Compose:
|
||||
|
||||
- Backend container (FastAPI)
|
||||
- Frontend container (React dev server)
|
||||
- Database container (PostgreSQL)
|
||||
|
||||
### Production
|
||||
|
||||
(Add production deployment architecture here)
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- CORS configuration
|
||||
- Environment variable management
|
||||
- API authentication/authorization
|
||||
- Input validation
|
||||
- SQL injection prevention
|
||||
|
||||
## Scalability
|
||||
|
||||
- Horizontal scaling via container orchestration
|
||||
- Database connection pooling
|
||||
- Caching strategies
|
||||
- Load balancing
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Backend
|
||||
- Python 3.11+
|
||||
- FastAPI
|
||||
- Pydantic v2
|
||||
- PostgreSQL
|
||||
|
||||
### Frontend
|
||||
- React 18
|
||||
- TypeScript
|
||||
- Axios
|
||||
|
||||
### DevOps
|
||||
- Docker & Docker Compose
|
||||
- Gitea Actions (CI/CD)
|
||||
186
templates/docs/user-guide/README.md
Normal file
186
templates/docs/user-guide/README.md
Normal file
@@ -0,0 +1,186 @@
|
||||
# User Guide
|
||||
|
||||
## Getting Started
|
||||
|
||||
This guide will help you get started with the application.
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before you begin, ensure you have the following installed:
|
||||
|
||||
- Docker and Docker Compose
|
||||
- Python 3.11+ (for local backend development)
|
||||
- Node.js 20 LTS (for local frontend development)
|
||||
- uv (Python package manager)
|
||||
|
||||
### Quick Start with Docker
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd <project-name>
|
||||
```
|
||||
|
||||
2. Start all services:
|
||||
```bash
|
||||
docker compose -f deploy/compose.yml up
|
||||
```
|
||||
|
||||
3. Access the application:
|
||||
- Frontend: http://localhost:3000
|
||||
- Backend API: http://localhost:8000
|
||||
- API Documentation: http://localhost:8000/docs
|
||||
|
||||
## Local Development
|
||||
|
||||
### Backend Development
|
||||
|
||||
1. Navigate to backend directory:
|
||||
```bash
|
||||
cd backend
|
||||
```
|
||||
|
||||
2. Copy environment file:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
3. Install dependencies:
|
||||
```bash
|
||||
uv sync
|
||||
```
|
||||
|
||||
4. Start the development server:
|
||||
```bash
|
||||
uv run uvicorn app.main:app --reload
|
||||
```
|
||||
|
||||
Or use the convenience script:
|
||||
```bash
|
||||
bash scripts/dev/start-backend.sh
|
||||
```
|
||||
|
||||
### Frontend Development
|
||||
|
||||
1. Navigate to frontend directory:
|
||||
```bash
|
||||
cd frontend
|
||||
```
|
||||
|
||||
2. Copy environment file:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
3. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
4. Start the development server:
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Or use the convenience script:
|
||||
```bash
|
||||
bash scripts/dev/start-frontend.sh
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Backend Tests
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
uv run pytest --cov=app
|
||||
```
|
||||
|
||||
### Frontend Tests
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm test
|
||||
```
|
||||
|
||||
## Code Quality
|
||||
|
||||
### Linting
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
bash scripts/utils/lint-backend.sh
|
||||
|
||||
# Frontend
|
||||
bash scripts/utils/lint-frontend.sh
|
||||
```
|
||||
|
||||
### Formatting
|
||||
|
||||
```bash
|
||||
bash scripts/utils/format-all.sh
|
||||
```
|
||||
|
||||
## Common Tasks
|
||||
|
||||
### Adding a New API Endpoint
|
||||
|
||||
1. Create endpoint in `backend/app/api/`
|
||||
2. Add business logic in `backend/app/services/`
|
||||
3. Define schemas in `backend/app/schemas/`
|
||||
4. Write tests in `backend/tests/`
|
||||
|
||||
### Adding a New Frontend Component
|
||||
|
||||
1. Create component in `frontend/src/components/`
|
||||
2. Add styles in `frontend/src/styles/`
|
||||
3. Write tests in `frontend/tests/components/`
|
||||
|
||||
### Database Migrations
|
||||
|
||||
(Add database migration instructions when implemented)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port Already in Use
|
||||
|
||||
If you get a "port already in use" error:
|
||||
|
||||
```bash
|
||||
# Find process using the port
|
||||
lsof -i :8000 # or :3000 for frontend
|
||||
|
||||
# Kill the process
|
||||
kill -9 <PID>
|
||||
```
|
||||
|
||||
### Docker Issues
|
||||
|
||||
```bash
|
||||
# Clean up Docker resources
|
||||
docker compose -f deploy/compose.yml down
|
||||
docker system prune -a
|
||||
```
|
||||
|
||||
### Dependency Issues
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
cd backend
|
||||
rm -rf .venv
|
||||
uv sync
|
||||
|
||||
# Frontend
|
||||
cd frontend
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
For issues and questions:
|
||||
- Check the documentation in `/docs`
|
||||
- Review the API documentation at http://localhost:8000/docs
|
||||
- Open an issue in the repository
|
||||
Reference in New Issue
Block a user