A clean, modular and scalable backend project implementing modern backend engineering practices including authentication, middleware, logging, testing and Dockerized deployment.
This project was built to practice production-style backend development rather than creating a simple CRUD application.
It follows a clean modular architecture and includes many features commonly found in real-world backend systems, including secure authentication, centralized logging, middleware, exception handling, automated testing and Docker support.
- π JWT Authentication
- π Secure Password Hashing
- π€ User Registration & Login
- π‘ Protected Endpoints
- π¦ SQLAlchemy ORM
- π SQLite Database
- β Environment Variables
- π Centralized Logging
- π¦ Custom Request Middleware
- β Global Exception Handling
- β€οΈ Health Check Endpoint
- π§ͺ Automated API Testing
- π³ Dockerized Deployment
- π Clean Project Architecture
Client
β
βΌ
Middleware
β
βΌ
Router
β
βΌ
Controller
β
βΌ
Authentication
β
βΌ
Database
β
βΌ
Response
Production-Ready-API
β
βββ src
β βββ auth
β βββ users
β βββ middleware
β βββ exceptions
β βββ database
β βββ core
β βββ services
β βββ utils
β
βββ tests
βββ logs
βββ Dockerfile
βββ requirements.txt
βββ pytest.ini
βββ main.py
βββ README.md
| Folder | Responsibility |
|---|---|
| auth | Authentication, JWT, Security |
| users | User CRUD Operations |
| middleware | Request Logging |
| exceptions | Custom Exceptions & Global Handlers |
| database | SQLAlchemy Engine & Sessions |
| core | Logging & Application Lifespan |
| utils | Application Settings |
| services | Reserved for Future Business Logic |
| tests | API Testing |
| Category | Technology |
|---|---|
| Language | Python 3.14 |
| Framework | FastAPI |
| ORM | SQLAlchemy |
| Database | SQLite |
| Authentication | JWT |
| Validation | Pydantic v2 |
| Password Hashing | pwdlib |
| Logging | Loguru |
| Testing | Pytest |
| Containerization | Docker |
Register
β
βΌ
Hash Password
β
βΌ
Store User
β
βΌ
Login
β
βΌ
Verify Password
β
βΌ
Generate JWT
β
βΌ
Authorization Header
β
βΌ
Protected Route
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login |
Login & Generate JWT |
| GET | /auth/me |
Get Current User |
| Method | Endpoint |
|---|---|
| POST | /users |
| GET | /users |
| GET | /users/{username} |
| PUT | /users/{username} |
| DELETE | /users/{username} |
| Method | Endpoint |
|---|---|
| GET | /health |
docker build -t production-ready-api .docker run -d \
--name production-api \
--env-file .env \
-v "$(pwd)/production.db:/app/production.db" \
-p 8000:8000 \
production-ready-apiClone repository
git clone https://github.com/whoismehfooz/Production-Ready-API.gitMove into project
cd Production-Ready-APICreate Virtual Environment
python -m venv venvLinux
source venv/bin/activateWindows
venv\Scripts\activateInstall Dependencies
pip install -r requirements.txtCreate .env
DB_CONNECTION=sqlite:///./production.db
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30Run
uvicorn main:app --reloadpytest -vβ Clean Modular Architecture
β JWT Authentication
β Dependency Injection
β SQLAlchemy ORM
β Middleware
β Centralized Logging
β Exception Handling
β Docker Support
β Automated Testing
β Environment-based Configuration
This project provided hands-on experience with:
- FastAPI
- SQLAlchemy ORM
- JWT Authentication
- Password Hashing
- Docker
- Pytest
- Logging
- Middleware
- Dependency Injection
- Clean Architecture
- Linux
- Backend Debugging
- PostgreSQL
- Alembic Migrations
- Docker Compose
- Redis Integration
- Background Tasks
- Refresh Tokens
- Role-Based Access Control (RBAC)
- CI/CD using GitHub Actions
- API Versioning
Python Backend Developer
GitHub
https://github.com/whoismehfooz