Django monolith to FastAPI services
How would you extract high-traffic endpoints from a Django monolith into FastAPI microservices?
Answers use simple, clear English.
Audio N/AQuick interview answer
Identify bounded context with clear DB ownership. Strangler: route /api/v2/search to FastAPI behind API gateway. Shared DB initially with schema views; later split DB with outbox sync.
Detailed answer
Identify bounded context with clear DB ownership. Strangler: route /api/v2/search to FastAPI behind API gateway. Shared DB initially with schema views; later split DB with outbox sync. Async SQLAlchemy for I/O endpoints; keep Django admin on monolith until replaced. Contract tests between services.
Real example & use case
Search read path FastAPI + OpenSearch; writes still Django until inventory service split.
Pros & cons
Pros: perf on hot paths without full rewrite. Cons: distributed transactions avoided via sagas.