How mannam95/fastapi-poc works
Project type and purpose
• This is a backend API service built with FastAPI and async SQLAlchemy following Domain-Driven Design (DDD) principles.
• The primary purpose is to expose CRUD endpoints for domains like user, department, location, process, resource, and role, backed by a PostgreSQL database.
• It includes centralized logging (Loguru), exception handling, Docker-Compose orchestration, a test suite (pytest), and benchmarking (Locust).
File structure
• Top level:
• app/: the main Python package
• docker/: Dockerfiles and compose files for development/test/prod
• docs/: markdown docs on architecture, Docker, testing, etc.
• locust/: load-testing scripts
• prometheus/: monitoring configuration
• tests/: unit and integration tests
• app/ layers:
• app/api/router.py – the single FastAPI router mounting domain routers
• app/core/ – configuration and database session initialization
• app/domains/ – each subfolder is a DDD “module” with its own router, schemas, model, service, and dependency definitions
• app/utils/ – logging middleware/service, exception definitions, DB-init scripts, SQL scripts
• app/main.py – FastAPI app instantiation, middleware registration
• Config files: .env.example, pyproject.toml, requirements.txt, Makefile, docker-compose.yml
README for additional insights
• Confirms use of FastAPI + async SQLAlchemy, PostgreSQL via asyncpg, DDD, dependency injection, Loguru, centralized exception handling.
• Docker-Compose for orchestration, Locust for benchmarking, Flake8/Mypy/Black/isort for quality.
• Future integration: Prometheus/Grafana, Alembic, Redis, WebSockets.