This is a FastAPI project archetype for production-ready applications. It provides a structure for building scalable and maintainable applications with FastAPI following Domain Driven Design (DDD) principles, best Docker practices, and a set of tools for development, testing, and deployment with the best code quality tools available.
Check the contributing documentation for more information.
Development:
- Python 3: The programming language used.
- Poetry: A tool for dependency management and packaging in Python.
- FastAPI: A modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
- Pydantic: Data validation and settings management using Python type annotations.
- HTTPX: A fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
Development Tools:
- Pre-Commit: A framework for managing and maintaining multi-language pre-commit hooks.
- Ruff: A tool for managing Python environments.
- Flake8: A tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some Python code.
- Pylint: A tool that checks for errors in Python code, tries to enforce a coding standard, looks for code smells, and can offer simple refactoring suggestions.
- Bandit: A tool designed to find common security issues in Python code.
Databases:
- SQLAlchemy: The Python SQL Toolkit and Object-Relational Mapping (ORM) library.
- PostgreSQL: A powerful, open-source object-relational database system.
Deployment:
- Uvicorn: A lightning-fast ASGI server implementation, using uvloop and httptools.
- Docker: A set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.
- Docker-Compose: A tool for defining and running multi-container Docker applications.
Testing:
- Pytest: A framework that makes it easy to write simple and scalable tests.
- Pytest-Mock: A thin-wrapper around the mock package for easier use with py.test.
- Python 3.10 or higher
- Poetry: Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. For documentation refer to Poetry or to a little guide we made here.
- Docker: Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. For documentation refer to Docker.
You need to have the environment set up with Poetry by using poetry install
and the dependencies will be installed. After that, you can start the application.
To start the application, run the following command:
uvicorn src.app:app --reload --port 8000
This will start the application on port 8000. You can change the port by changing the --port
argument.
In VSCode you can use the Run
button on the top right corner of the editor to start the application as the launch.json
file is already set up.
Also, you can use the docker-compose
to start the application with the following command:
cd docker
docker-compose up
If you don't know how to use Docker, you can check the Docker documentation and our deployment documentation.
Important
Be sure to:
- Run
pre-commit install
to install the pre-commit hooks. This will run the linters and formatters before you commit your code. If you don't have pre-commit installed in your system, you can install it withpip install pre-commit
. - Check the project structure documentation for more information.
- Check the recommended extensions documentation for more information.
- Check the contributing documentation for more information.
- Check the deployment documentation for more information.
See the open issues for a full list of proposed features (and known issues).