Production guidelines for FastAPI, Pydantic v2 validation, Async SQLAlchemy 2.0 (asyncpg), Alembic migrations, and PostgreSQL/Redis.
Production conventions for high-throughput, async-first Python microservices and AI agent backends using FastAPI, SQLAlchemy 2.0, and PostgreSQL.
This architecture is deployed in production by AI and data platforms including Mem0, OpenBB, Baserow, and Open WebUI.
asyncpg with pool_pre_ping=True for resilient connection lifecycle management.Yes — AGENTS.md is the open, cross-tool standard read by Cursor, Claude Code, Windsurf, and 30+ other agents. A dedicated .mdc file is also included for Cursor's native .cursor/rules format.
Lazy-loaded relationships trigger a synchronous database call under the hood, which async SQLAlchemy can't execute outside the greenlet context it uses to bridge sync and async code. Eager-loading the relation up front with selectinload() or joinedload() avoids the lazy trigger entirely, so there's no synchronous call left to fail.
psycopg2 is a synchronous driver — using it inside an async def route would block the entire event loop on every query, defeating the purpose of async FastAPI. asyncpg is built for asyncio from the ground up and is also one of the fastest Postgres drivers available in Python.
Architecture rules for Astro server-side rendering, React client islands, Tailwind CSS, and Cloudflare Pages/Workers edge deployment.
Ultra-fast edge API architecture using Bun.serve(), Hono v4, Drizzle ORM with embedded SQLite / Turso libSQL, and Zod OpenAPI validation.
Production guidelines for Django 5 enterprise applications, PostgreSQL connection pooling, Redis caching, and Celery async workers.
Architecture guidelines for single-binary Go services using the Echo framework, embedded SQLite, and minimal-JS server-rendered UI.