Fastapi

A shop ledger page, 1899. Every line adds up.
How to Integrate OpenAI into a Django or FastAPI Backend
Integrate a model API through a server-side service layer with timeouts, input limits, structured outputs, and cost monitoring.
2 min read
A Practical Observability Checklist for Python APIs in Production
Instrument a Python API with structured logs, metrics, traces, request correlation, and actionable alerts to diagnose production problems without logging sensitive data.
4 min read
How to Deploy a FastAPI Application with Docker
Package a FastAPI service in Docker and prepare it for deployment with configuration, health checks, non-root execution, and production server settings.
4 min read
How to Implement API Rate Limiting for a SaaS Application
Choose rate-limit identities, algorithms, response headers, and distributed storage for APIs while avoiding limits that can be bypassed or unfairly shared.
4 min read
How to Debug Intermittent API Failures in Production
Investigate APIs that fail intermittently by measuring latency, tracing dependencies, setting timeouts, and designing safe retries.
5 min read
SQLAlchemy Many-to-Many Relationships in a FastAPI POST Endpoint
Create a post with tags in FastAPI and SQLAlchemy: an association table, loading existing tags, avoiding duplicates, and separate Pydantic input and output schemas.
4 min read
Django to FastAPI: Moving a Team Without Chaos
A pragmatic plan for moving a Django team to FastAPI: when not to migrate, project structure, ORM and Alembic choices, background jobs, and incremental rollout.
4 min read
Fixing Slow Serialization of Large Nested Pydantic Responses in FastAPI
An endpoint returns quickly in the database but slowly over HTTP. Profile first, then reduce response_model overhead, validate once, trim payloads, and paginate.
5 min read
Testing Async FastAPI With SQLAlchemy and pytest
Set up pytest-asyncio, dependency overrides and per-test transaction rollback so async FastAPI and SQLAlchemy tests stay isolated and avoid event loop errors.
4 min read
When Async Is Worth It in FastAPI and When Plain def Is Fine
Choose async def or def per endpoint. Learn how FastAPI threadpools sync routes, how blocking calls freeze the event loop, and when async pays off.
5 min read
Fix Async SQLAlchemy MissingGreenlet and Lazy-Loading Errors in FastAPI
MissingGreenlet means a lazy load fired outside the async context. Fix it with eager loading, expire_on_commit=False and explicit Pydantic response models.
5 min read