r/FastAPI • • Feb 26 '22

Question Microservices architecture with FastAPI

Hi all,

I need some advice in regards to a microservices app design.

I have started to work on a new project to practice system design/architecture.
It's going to be a very simple payments API.

I want the app to have 2 main services:

  1. Users service

  2. Payment service

The user's service will be responsible for user login and registration, and the payment service will be responsible for sending payments to other people.

The stack I am going to use: Python, FastAPI, Docker, Nginx.

My questions are:

  1. What will be the best way to put the services together? Each service will be in a different Docker container?

  2. When it comes to networking between the containers, is there's anything I need to consider?

  3. In regards to the database, should have one database (say Postgres)?

  4. If I should have only one database, how both services will be able to access it?

Thanks!

18 Upvotes

12 comments sorted by

View all comments

3

u/sasmariozeld Mar 07 '22

if u are working alone 99.99% of the time what you want is a monolith

1

u/vietanh2000april Oct 01 '22

I was advised the same but considering that I want to create services that are reusable so that I can just copy and paste the service folders when I start working on a new project, wouldn't microservices be more suitable?