A fully structured FastAPI project with PostgreSQL, JWT authentication, and Docker for containerized deployment. Includes Nginx as a reverse proxy for production.
✅ FastAPI with modular architecture
✅ PostgreSQL database integration
✅ Secure JWT authentication
✅ Run with batch files (.bat)
✅ Dockerized setup with docker-compose
✅ Nginx as a reverse proxy
✅ Environment-based configuration (.env)
✅ Auto-generated Swagger & Redoc API docs
- FastAPI – High-performance web framework
- PostgreSQL – Relational database
- SQLAlchemy – ORM for database interactions
- Pydantic – Data validation and serialization
- JWT – Secure authentication
- Docker & Docker Compose – Containerized deployment
- Nginx – Reverse proxy for production
- Clone the repository:
git clone <repository-url> cd fastapi-app
- Create a
.envfile (see.env.example) - Create and Activate Virtual Environment:
- Linux/macOS:
python -m venv .venv source .venv/bin/activate - Windows:
python -m venv .venv .venv\Scripts\activate
- Linux/macOS:
- Run the project locally without Docker:
- Development mode:
./run_dev.bat
- Production mode:
./run_prod.bat
- Development mode:
- Build and run with Docker Compose:
docker-compose up --build
- Access the API at:
http://localhost:8000(when running locally)http://localhost(when using Docker with Nginx on port 80)
- API docs available at:
- Swagger UI:
/docs - ReDoc:
/redoc
- Swagger UI:
- Add Redis for caching
- Implement role-based access control (RBAC)
- Improve test coverage
📜 License: MIT License
🔥 Fork & customize for your projects! 🚀