No description
| .forgejo/workflows | ||
| docs | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| .importlinter | ||
| .pre-commit-config.yaml | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| LICENSE | ||
| logging-granian.json | ||
| mypy.ini | ||
| prometheus.yml | ||
| pyproject.toml | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| uv.lock | ||
Service Template
A design template for services with emphasis on asynchronous operations and database integration.
Features
- Asynchronous handling of HTTP requests (FastAPI).
- PostgreSQL database support (asyncpg, SQLModel)
- Job queues (Celery, RabbitMQ)
- Caching and rate limiting (Redis, slowapi)
- Configurable settings via
.envfile - Ready integration with database migration tools (Alembic)
- Extensive logging system (Rich, Granian)
- Application healthiness (healthchecks)
- Support for CORS, GZIP, HTTPS redirect, Trusted Hosts
Requirements
- Python 3.12+
- Docker (optional, to run in a container)
Installation
- Clone the repository:
sh git clone <address_repository> cd service-template - Install dependencies:
uv sync
3. Configure the `.env` file according to your needs.
## Run the application
Locally:
```sh
uv run manage-cli api serve
In Docker: ``sh docker build -t service-template . docker run -p 8000:8000 service-template
## Project structure
- `src/service_template/` - main application code
- `src/alembic/` - database migrations
- `tests/` - unit and integration tests
## management commands
All commands are available via CLI:
``sh
uv run manage-cli --help
```.
## Endpoints
- OpenAPI documentation: `/docs`.
- Redoc: `/redoc`
- Healthcheck: `/api/v1/health`.
## Author
Illia Bahlai - i.bahlai@3dcra.eu