This repository is the example of the REST API implementation.
Main stack
- Python >= 3.12
- FastAPI framework [[https://fastapi.tiangolo.com/]]
- SQLAlchemy ORM [[https://www.sqlalchemy.org/]]
- Alembic database migration tool [[https://alembic.sqlalchemy.org/en/latest/]]
- dependency_injector [[https://python-dependency-injector.ets-labs.org/]]
Testing and QA
- pytest testing framework [[https://docs.pytest.org/]]
- ruff linter [[https://docs.astral.sh/ruff/]]
- mypy static type checker [[https://www.mypy-lang.org/]]
Project provides Makefile with all the basic operations. To build release version from scratch run
RDB_FULL_BUILD=yes make buildTo build development version
RDB_FULL_BUILD=yes RDB_ENVIRONMENT=dev make buildif virtual environment is already set just run
make buildFor development you can setup required services in the docker container, which will setup postgres database and SMTP mailcatcher
docker-compose up -dCopy config-dist.yml to config.yml and set the actual parameters
Run migration by running
make migrateRun the uvicorn server
make start_serverTo check code style and static types run
make lintersBefore making commit please run
make precommitYou can set this action as a precommit hook
To run all tests suits run
make testsTo run specific test suit you can run
# unit tests
make unit_test
# functional (acceptance) tests
make functional_test
# integrational tests
make integrational_test- Swagger Open API documentation.
Run the server
make start_serverAnd access [[http://localhost:8000/docs]]
- DB schemas
You can find DBML schemas in the dbdocs folder
Also you can check ORM table declarations in the src/mapping folder