This is a backend template application built with Litestar to get your next backend running quickly.
Its folder structure and some other Litestar related best practices are inspired from the litestar-fullstack repository.
It contains most of the boilerplate required for a production API like:
- Latest Litestar configured with best practices.
- Well-structured and scalable project layout for maintainability and growth.
- Docker support for containerized development:
- Multi-stage Docker build using a minimal Python 3.13 runtime image.
- Pure SQL integration with migration management.
- Rate limiting to protect against abuse and ensure fair usage.
- Authentication implemented with access tokens and refresh tokens.
- Authorization using Role-Based Access Control (RBAC).
...and much more
Take what you need and adapt it to your own projects.
Before starting, configure the application using the config/app.toml file.
To run the development environment locally do the following:
-
Make sure you have a running PostgreSQL and Redis instance.
-
Initialize the database and apply all migrations
uv run app database init- Create all the roles required by the application
uv run app role init- Start the application
uv run app runTo run the entire development environment containerized do the following:
- Initialize the database and apply all migrations.
Note: Migrations are automatically applied the first time the container is initialized. Usedocker compose run --rm app database initonly if you need to manually re-run migrations later.
docker compose run --rm app database init- Create all the roles required by the application
docker compose run --rm app role init- Start the application
docker compose up -d- Write documentation for the project.
- Write further and more complete doc strings.
- Write tests.