modern-python/fastapi-sqlalchemy-template
Tentang
Dockerized FastAPI + SQLAlchemy 2 + PostgreSQL app template with DI
Data dan analisisYang dapat Anda lakukan
- tests on pytest with automatic rollback after each test case
- IOC (Inversion of Control) container built on modern-di
- Observability tools integration built on lite-bootstrap
- Linting and formatting with ruff, type checking with ty
Pertumbuhan bintang terukur
- dalam 24 jam
- +1
- dalam 7 hari
- +1
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Asli
Description
Dockerized FastAPI, SQLAlchemy 2 and PostgreSQL app template with DI.
Key features
- tests on
pytestwith automatic rollback after each test case - IOC (Inversion of Control) container built on modern-di
- Observability tools integration built on lite-bootstrap
- Linting and formatting with
ruff, type checking withty Alembicfor DB migrations
Authentication is intentionally omitted: pick the scheme that fits your project and add it as a FastAPI dependency.
After git clone run
just --list
Tracing in production
Setting OPENTELEMETRY_ENDPOINT turns tracing on, and by default every request is traced. In a benchmark of GET /api/decks/{id}/, that cut throughput by about 40%. Sampling with the standard OpenTelemetry variables brings that down to about 20%:
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1
This keeps one trace in ten, and follows the caller's decision when a request arrives with a trace context. Errors still reach Sentry when SENTRY_DSN is set.
The template also turns off the ASGI send and receive spans (opentelemetry_exclude_spans in app/settings.py), so each request records its server span and database spans only. With every request traced, that raised throughput by 5 to 8% in the same benchmark. Remove the setting if you need those spans.
Links
If this project saves you time, consider giving it a star on GitHub.
Part of modern-python
Browse the full list of templates and libraries in
modern-python; the org profile has the categorized index.
Jelajahi proyek terkait
Memuat…