Skip to main content

Posts

Showing posts from August 9, 2024

How to Work More Than One Developer in Single FastAPI Application

One FastAPI application however multiple developers can work simultaneously on different services. This approach uses separate service classes, routers, and a main application file. Folder Structure fastapi_app/ ├── app/ │ ├── __init__.py │ ├── main.py │ ├── core/ │ │ ├── __init__.py │ │ └── config.py │ ├── services/ │ │ ├── __init__.py │ │ ├── service1.py │ │ ├── service2.py │ │ ├── service3.py │ │ └── service4.py │ ├── routers/ │ │ ├── __init__.py │ │ ├── router1.py │ │ ├── router2.py │ │ ├── router3.py │ │ └── router4.py │ └── models/ │ ├── __init__.py │ └── models.py └── requirements.txt Example Code app/main.py from fastapi import FastAPI from app.routers import router1, router2, router3, router4 app = FastAPI() app.include_router(router1.router) app.include_router(router2.router) app.include_router(router3.router) app.include_router(router4.router) if __name__ == "__main__": import uvicorn ...

Microservices Application with Flutter Flask MongoDB RabbitMQ

A complete microservice application setup with a Flutter app, MongoDB, and RabbitMQ, along with all the necessary files and folder structure. The setup uses Docker Compose to orchestrate the services. Folder Structure ``` microservice-app/ │ ├── backend/ │   ├── Dockerfile │   ├── requirements.txt │   ├── main.py │   └── config.py │ ├── frontend/ │   ├── Dockerfile │   ├── pubspec.yaml │   └── lib/ │       └── main.dart │ ├── docker-compose.yml └── README.md ``` 1. `docker-compose.yml` ```yaml version: '3.8' services:   backend:     build: ./backend     container_name: backend     ports:       - "8000:8000"     depends_on:       - mongodb       - rabbitmq     environment:       - MONGO_URI=mongodb://mongodb:27017/flutterdb       - RABBITMQ_URI=amqp://guest:guest@rabbitmq...