r/FastAPI • u/Puzzled-Mail-9092 • Aug 19 '25
Question FastAPI + Cloud Deployments: What if scaling was just a decorator?
I've been working with FastAPI for a while and love the developer experience, but I keep running into the same deployment challenges. I'm considering building a tool to solve this and wanted to get your thoughts.
The Problem I'm Trying to Solve:
Right now, when we deploy FastAPI apps, we typically deploy the entire application as one unit. But what if your /health-check endpoint gets 1000 requests/minute while your /heavy-ml-prediction endpoint gets 10 requests/hour? You end up over-provisioning resources or dealing with performance bottlenecks.
My Idea:
A tool that automatically deploys each FastAPI endpoint as its own scalable compute unit with:
- Per-endpoint scaling configs via decorators
- Automatic Infrastructure-as-Code generation (Terraform/CloudFormation)
- Built-in CI/CD pipelines for seamless deployment
- Shared dependency management with messaging for state sync
- Support for serverless AND containers (Lambda, Cloud Run, ECS, etc.)
@app.get("/light-endpoint") @scale_config(cpu="100m", memory="128Mi", max_replicas=5) async def quick_lookup(): pass
@app.post("/heavy-ml") @scale_config(cpu="2000m", memory="4Gi", gpu=True, max_replicas=2) async def ml_prediction(): pass
What I'm thinking:
- Keep FastAPI's amazing DX while getting enterprise-grade deployment
- Each endpoint gets optimal compute resources
- Automatic handling of shared dependencies (DB connections, caches, etc.)
- One command deployment to AWS/GCP/Azure
Questions for you:
- Does this solve a real pain point you've experienced?
- What deployment challenges do you face with FastAPI currently?
- Would you prefer this as a CLI tool, web platform, or IDE extension?
- Any concerns about splitting endpoints into separate deployments?
- What features would make this a must-have vs nice-to-have?
- I'm still in the early research phase, so honest feedback (even if it's "this is a terrible idea") would be super valuable!
View all comments
1
u/Fluffy-Forever-1406 Sep 17 '25
I also feel deploying any fast api app with proper configuration is the biggest challenge