# Enterprise FastAPI Starter
[](https://fastapi.tiangolo.com)
[](https://python.org)
[](https://postgresql.org)
[](https://docker.com)
[](LICENSE)
[](https://github.com/Raphasha27/enterprise-fastapi-starter/actions)
Production-ready FastAPI starter template with PostgreSQL, SQLAlchemy ORM, JWT authentication, user management, and Docker containerization.
## Features
- **User Management** — Create, read, update, delete users via REST API
- **JWT Authentication** — Login endpoint with token-based auth and password hashing (bcrypt)
- **SQLAlchemy ORM** — PostgreSQL database with auto-migration on startup
- **Pydantic v2** — Request/response validation with email and schema validation
- **Structured Logging** — Centralized logging configuration
- **Dockerized** — Multi-service setup with PostgreSQL via Docker Compose
- **CI/CD** — GitHub Actions pipeline with testing
## Quick Start
```bash
cp .env.example .env
docker compose up --build
```
API docs: [http://localhost:8000/docs](http://localhost:8000/docs)
## API Endpoints
### Health
| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Service status |
| GET | `/health/` | Health check |
### Auth
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| POST | `/auth/login` | No | Login (returns JWT) |
| GET | `/auth/me` | Bearer | Current user info |
### Users
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| GET | `/users/` | No | List users |
| POST | `/users/` | No | Create user |
| GET | `/users/{id}` | No | Get user by ID |
| PUT | `/users/{id}` | No | Update user |
| DELETE | `/users/{id}` | No | Delete user |
## Project Structure
```
enterprise-fastapi-starter/
├── app/
│ ├── api/
│ │ ├── routes/
│ │ │ ├── auth.py # Authentication endpoints
│ │ │ ├── health.py # Health check endpoint
│ │ │ └── users.py # User CRUD endpoints
│ │ └── router.py # API router aggregation
│ ├── core/
│ │ ├── config.py # App settings (pydantic-settings)
│ │ ├── database.py # SQLAlchemy engine & session
│ │ ├── logging.py # Logging configuration
│ │ └── security.py # JWT & password utilities
│ ├── models/
│ │ └── user.py # User SQLAlchemy model
│ ├── schemas/
│ │ └── user.py # User Pydantic schemas
│ ├── services/
│ │ └── user_service.py # User business logic
│ └── main.py # FastAPI application entry
├── tests/
│ ├── test_health.py # Health endpoint tests
│ ├── test_config.py # Config tests
│ └── test_security.py # Security utility tests
├── docker/
│ └── postgres-init.sql # DB init script (optional)
├── Dockerfile # Production container
├── docker-compose.yml # Multi-service orchestration
├── .pre-commit-config.yaml
├── pyproject.toml
└── requirements.txt
```
## Development
```bash
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
```
## Testing
```bash
pytest
```
## Pre-commit
```bash
pip install pre-commit
pre-commit install
```
## License
MIT License. See [LICENSE](LICENSE) for details.
---
© 2026 **Kirov Dynamics Technology** | Built by **Koketso Raphasha (Raphasha27)**