FastAPI microservices
Split the service where it earns it, and nowhere else.
Acasa Labs builds FastAPI microservices when one part of a system needs its own process: an AI service that holds the model keys, a realtime gateway that must never slow the core, or inference that runs on its own hardware. On our trading platform, the FastAPI gateway is separate from the trading engine, so if the gateway dies, trading does not notice.
The problem
Most microservice projects are a monolith with network calls.
Teams split a backend into ten services because it sounds like scale, then spend the next year on distributed bugs, version drift between services, and a local setup nobody can run. The right number of services is usually small. A part of the system earns its own service when it has different failure rules, different hardware, different secrets, or a different load pattern from the rest. Then the boundary has to be strict: who calls whom, what happens when the other side is down, and what is never allowed to block.
What we build with FastAPI
- 01
AI services
One FastAPI service that owns model keys, prompts, and retrieval, called by every client and every other service that needs a model.
- 02
Gateways in front of a core
A FastAPI service that fans data out to dashboards or partners, with bounded buffers so it can fail without hurting the system behind it.
- 03
Inference and worker services
Model inference, OCR, or video processing in its own service, sized for its own hardware, behind a plain HTTP API.
- 04
Boundaries and contracts
Typed contracts between services, a timeout on every call, health checks, and a compose file that runs the whole system on one laptop.
From production
Where we split services, and why.
The gateway cannot block trading
Options trading platformOn the trading platform, market state goes from the engine to Redis to a FastAPI WebSocket gateway. The publisher is bounded and drops when full, so it never blocks the trading path.
Logic that can move
Options trading platformOrder logic is kept free of engine imports, so it can be ported to Rust on its own. Live orders sit behind several independent gates, each one its own check.
The AI is its own service
NoteTubeNoteTube's AI lives in a separate FastAPI service. The web app and the mobile app never see a model key, and streaming chat has inactivity timeouts so dead connections do not hold resources.
A worker per camera
Acasa SentinelAcasa Sentinel ingests RTSP and HLS behind one interface, with a worker per camera under a supervisor and bounded stream timeouts, so a stalled camera returns in seconds instead of wedging a thread.
Honest trade-offs
When to keep the monolith
If the team is small, the product is young, and every part of the backend shares the same database and load pattern, keep one service. A well-structured FastAPI or Django monolith with a job queue covers most products. SigmaCPM runs several products on one Django REST Framework backend with a Postgres job queue and no extra broker. Split later, when a part of the system gives you a reason.
What we reach for
- FastAPI
- Redis pub/sub and streams
- WebSockets, server-sent events
- Postgres
- Docker, Docker Compose
- Prometheus, Grafana
- Cloud Run, Railway
Proof
Shipped, not pitched.
01Client work
Options trading platform
Microsecond market-data handling for index options, with risk checks that never sleep.
A private trading platform for index options on an Indian exchange: tick capture, research and backtesting, paper and live execution, and a control dashboard. Built for a client's internal use; details are anonymized.
Trading engine · Realtime gateway · Web dashboard
02Our product
NoteTube
A lecture becomes a study system: chat, flashcards, quizzes, all grounded in the source.
An AI learning platform that turns PDFs, YouTube lectures, recordings, and notes into a structured notebook with grounded chat, spaced-repetition flashcards, and graded quizzes.
Web · iOS · Android · Chrome extension · MCP server
03Case study
Acasa Sentinel
Give it a number plate. It returns the vehicle's route across a CCTV network.
A vendor-neutral video analytics system built for the Gujarat Police Hackathon Innovation Challenge 2026. It reads number plates, re-identifies vehicles by appearance across cameras, reconstructs routes, and raises watchlist alerts for an operator to confirm.
Operator console (web) · API
Questions
FastAPI microservices questions we get asked.
When should we split a FastAPI app into microservices?
When a part has different failure rules, hardware, secrets, or load from the rest. An AI service with model keys, a realtime gateway, and GPU inference are common reasons. Team size alone rarely is.
How do FastAPI services talk to each other?
HTTP with typed contracts for requests that need an answer, and Redis or a queue for events and fan-out. Every call has a timeout and a plan for when the other side is down.
How do you monitor several services?
Metrics per service in Prometheus, Grafana dashboards with alert rules, health checks, and request IDs passed between services. The trading platform has latency instrumented across 12 stages.
Can you break up our monolith?
Yes, one piece at a time. We pull out the part with the clearest reason first, run it next to the monolith, and move traffic over once it holds.
Do microservices cost more to run?
Usually, in hosting and in engineering time. That is why we split only where the split pays for itself.
FastAPI microservices
Thinking of splitting the backend?
A free 30-minute architecture review. Bring the diagram or the repo, and we will tell you which parts should be their own service and which should not.

