- FastAPI app with OAuth2 authentication
- MySQL database via SQLAlchemy
- Alembic for migrations
- Environment variables managed by python-dotenv
- Local development with Docker Compose and hot reloading
- Unit, integration, and end-to-end tests
- Tasks management using MongoDB
- User profile image using AWS S3
- Caching
- ELK application log
- CI/CD
- User password reset
- Tasks search using elastic search
- Kibana dashboard
- Queue/celery for elastic indexing for tasks
- Deployment
- Kubernetes deployment to GCP
- Monitoring using Prometheus and Grafana
- Stress testing using k6
- Benchmarking
- Python 3.11+
- Create a virtual environment:
python3 -m venv .venv - Activate it:
source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Copy
.env.exampleto.envand update values as needed. - Start services:
docker-compose up --build - App runs at http://localhost:8000
- MySQL runs at localhost:3306
- Ensure your MySQL server is running and matches the credentials in your
.envfile. - Activate your virtual environment:
source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt - Run the app with hot reload:
uvicorn app.main:app --reload
- The app will be available at http://localhost:8000
- Run migrations:
PYTHONPATH=. alembic upgrade head - Create migrations:
PYTHONPATH=. alembic revision --autogenerate -m 'MESSAGE'
AddingPYTHONPATH=.ensures theappmodule is found
- Run all tests:
pytest - Or use the Makefile for full test automation (including MySQL in Docker):
make test
The Makefile provides convenient commands for development and testing:
make venv— Create and install dependencies in a virtual environmentmake run— Run the FastAPI app locally with hot reloadmake up— Start the app and MySQL using Docker Composemake down— Stop and remove Docker Compose containersmake migrate— Run Alembic migrationsmake test— Spin up a MySQL Docker container, run tests, and clean upmake coverage— Run tests with coverage and generate an HTML report inhtmlcov/make docker-clean— Remove all Docker containers and volumes
- Make (install via
brew install makeon macOS or your package manager) - Docker and Docker Compose (for Docker-based commands)
To run tests with MySQL in Docker:
make testTo run the app locally (without Docker):
make venv
make runapp/- FastAPI application codetests/- All test codealembic/- Alembic migrations
docker-compose up --build- Start app and DBalembic revision --autogenerate -m "message"- Create migrationalembic upgrade head- Apply migrationspytest- Run tests
- MongoDB is used for all task management features (create, edit, delete, list, complete/uncomplete).
- MongoDB runs as a service in Docker Compose (see
docker-compose.yml). - The default database is
fastapi_taskson port 27017. - Make sure MongoDB is running (via Docker or your own instance) before using task endpoints.
- Endpoints for creating, editing, deleting, listing (with pagination), and marking tasks as completed/uncompleted are available under
/tasks. - Task fields: id, user_id, created_at, updated_at, deleted_at, title, description, completed_at.
- Indexes: user_id, created_at, updated_at, deleted_at, completed_at.
For more details, see each folder's README or docstrings.