What components do you include in your default FastAPI setup?

0
6
Asked By TechScribe52 On

I've been building FastAPI services and found myself repeatedly implementing the same essential features like authentication routes, job scheduling, webhook validation, caching, rate limiting, and metrics collection. To streamline my work, I created a package called **svc-infra** that consolidates all this infrastructure into a single, opinionated tool. This allows me to focus on building actual endpoints instead of churn through boilerplate code. Here's a simplified example of how it's set up:

```python
from svc_infra.api.fastapi.ease import easy_service_app
from svc_infra.api.fastapi.auth import add_auth_users
from svc_infra.jobs.easy import easy_jobs

app = easy_service_app(name="MyAPI", release="1.0.0")
add_auth_users(app)
queue, scheduler = easy_jobs()
```

Additionally, I've developed two related packages depending on the projects I'm working on: **ai-infra**, which provides a unified SDK for various AI models and agents, and **fin-infra**, designed for fintech integrations including banking and investment services.

My target audience includes developers setting up FastAPI services who prefer a ready-made solution rather than managing a custom template. I'm curious to know from others: if you have your own default FastAPI stack, what features do you include besides authentication?

1 Answer

Answered By DevGuruX On

Have you considered using a container image instead of a package? It seems like a solid option.

TechScribe52 -

I chose a Python package approach so that people can adopt or upgrade it service-by-service without needing to mess with Dockerfiles or elaborate templates. It keeps everything flexible and encourages contributions.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.