This document provides an overview of the structure of the FastAPI archetype, detailing the purpose of each folder and file.
The archetype consist of a FastAPI application with a modular structure, following Domain Driven Design (DDD) principles, and best practices for Docker, development, testing, and deployment.
Contains Docker-related configuration files.
Dockerfile
: Configures the Docker container for the FastAPI application. It uses a multi-stage build to optimize the image size.docker-compose.yml
: Defines services, networks, and volumes for Docker containers.logs
: Directory to store application logs.app.log
: Log file for the application.
Contains documentation files.
alembic.md
: Documentation related to Alembic, a database migration tool.poetry.md
: Documentation related to Poetry, a dependency management tool.project-structure.md
: Documentation related to the project structure.deployment.md
: Documentation related to deployment.
Directory to store application logs.
app.log
: Log file for the application.
Contains the source code of the FastAPI application.
Contains controllers for handling HTTP requests.
api
: Module for API-related functionality.endpoints
: Endpoints for different resources.base.py
: Base endpoint definitions and common utilities.customer.py
: Endpoint definitions related to customers (example).
schemas
: Pydantic schemas for request/response validation.customer.py
: Customer-related schemas (example).error_message.py
: Error message schemas.
errors
: Error handling utilities.error_responses.py
: Definitions for error responses.exception_manager.py
: Exception handling utilities.exception_mapper.py
: Mapping of exceptions to HTTP responses.exceptions.py
: Custom exception definitions.
utils
: Utility functions.pagination.py
: Pagination utilities.
Contains core components of the application.
config.py
: Configuration settings.logger.py
: Logging configuration.
Contains domain-specific logic.
Handles database operations.
create_db.py
: Script to create the database.crud
: CRUD operations.address.py
: CRUD operations related to addresses (example).base.py
: Base CRUD operations.customer.py
: CRUD operations related to customers (example).
exceptions.py
: Custom repository exceptions.models
: Database models.base.py
: Base database model.customer.py
: Customer database model (example).
session.py
: Database session management.
Contains business logic.
customer
: Customer service module (example).mapper.py
: Mapping functions.service.py
: Customer service implementation.
exceptions.py
: Custom service exceptions.
Contains unit tests.
LICENSE
: License file for the project.README.md
: Project README file.poetry.lock
: Lock file generated by Poetry for dependency management.poetry.toml
: Poetry configuration file.pylintrc
: Configuration file for Pylint.pyproject.toml
: Project configuration file for tools like Poetry and Flake8.requirements-dev.txt
: Development dependencies.requirements.txt
: Main dependencies.