r/FastAPI • • 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:

  1. Per-endpoint scaling configs via decorators
  2. Automatic Infrastructure-as-Code generation (Terraform/CloudFormation)
  3. Built-in CI/CD pipelines for seamless deployment
  4. Shared dependency management with messaging for state sync
  5. 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:

  1. Keep FastAPI's amazing DX while getting enterprise-grade deployment
  2. Each endpoint gets optimal compute resources
  3. Automatic handling of shared dependencies (DB connections, caches, etc.)
  4. One command deployment to AWS/GCP/Azure

Questions for you:

  1. Does this solve a real pain point you've experienced?
  2. What deployment challenges do you face with FastAPI currently?
  3. Would you prefer this as a CLI tool, web platform, or IDE extension?
  4. Any concerns about splitting endpoints into separate deployments?
  5. What features would make this a must-have vs nice-to-have?
  6. I'm still in the early research phase, so honest feedback (even if it's "this is a terrible idea") would be super valuable!
20 Upvotes

16 comments sorted by

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