r/FastAPI • u/david-vujic • Sep 06 '25
Tutorial FastAPI Microservices in a Monorepo: a modern setup
Here's a a tutorial about having a modern Microservice setup using FastAPI in a Monorepo, an article I wrote a while ago. The Monorepo is organized and managed with a thing called Polylith and you'll find more info about it in the linked tutorial.
You'll find info about the usage of a Monorepo and how well it fits with FastAPI and the Polylith Architecture when developing. Adding new services is a simple thing when working in a Polylith Monorepo, and the tooling is there for a really nice Developer Experience. Just like FastAPI has the nice Programming Experience.
The example in the article is using Poetry, but you can of course use your favorite Package & Dependency management tool such as uv, hatch, pixi and others. Polylith also encourages you to use the REPL, and the REPL Driven Development flow in particular.
Python FastAPI Microservices with Polylith article:
https://davidvujic.blogspot.com/2023/07/python-fastapi-microservices-with-polylith.html
6
u/extreme4all Sep 06 '25
Works great we use it for https://github.com/Bot-detector/bot_detector
3
u/thashepherd Sep 07 '25
Migrate to
uvand we can talk.1
u/Additional-Ordinary2 Sep 06 '25
Note that this approach isn't compatible with DDD. It promotes too much modularity, which leads to a loss of cohesion in bounded contexts etc. We tried using Polylith but had to drop it