Infrastructure for building and deploying prod-ready services
svc-infra is a comprehensive Python package that provides all the backend primitives you need to build production-ready services. It's designed to be reusable across many applications and teams.
Features
-
:material-api:{ .lg .middle } API Framework
FastAPI-based scaffolding with dual routers, automatic OpenAPI generation, and middleware stack.
-
:material-lock:{ .lg .middle } Authentication
OAuth2, sessions, MFA, password policies, JWT tokens, and user management.
-
:material-database:{ .lg .middle } Database
SQLAlchemy ORM, Alembic migrations, connection pooling, and multi-database support.
-
:material-cached:{ .lg .middle } Caching
Redis caching, cache decorators, TTL management, and invalidation strategies.
-
:material-timer-sand:{ .lg .middle } Background Jobs
Job queues, workers, schedulers, and retry logic for async processing.
-
:material-webhook:{ .lg .middle } Webhooks
Webhook signing, delivery, retry, and subscription management.
Quick Start
from svc_infra import easy_service_app
from svc_infra.logging import setup_logging
from svc_infra.cache import init_cache
# Setup logging
setup_logging()
# Create FastAPI app with all infra configured
app = easy_service_app(name="MyService")
# Initialize cache
await init_cache(url="redis://localhost")
@app.get("/health")
async def health():
return {"status": "healthy"}Installation
pip install svc-infraWith extras:
pip install svc-infra[pg,redis,payments]Architecture
graph TB
subgraph "svc-infra"
API[API Framework]
Auth[Authentication]
DB[Database]
Cache[Caching]
Jobs[Background Jobs]
Webhooks[Webhooks]
Obs[Observability]
end
App[Your Application] --> API
API --> Auth
API --> DB
API --> Cache
API --> Jobs
API --> Webhooks
API --> ObsLicense
MIT License - see LICENSE for details.