r/FastAPI Sep 13 '23

/r/FastAPI is back open

66 Upvotes

After a solid 3 months of being closed, we talked it over and decided that continuing the protest when virtually no other subreddits are is probably on the more silly side of things, especially given that /r/FastAPI is a very small niche subreddit for mainly knowledge sharing.

At the end of the day, while Reddit's changes hurt the site, keeping the subreddit locked and dead hurts the FastAPI ecosystem more so reopening it makes sense to us.

We're open to hear (and would super appreciate) constructive thoughts about how to continue to move forward without forgetting the negative changes Reddit made, whether thats a "this was the right move", "it was silly to ever close", etc. Also expecting some flame so feel free to do that too if you want lol


As always, don't forget /u/tiangolo operates an official-ish discord server @ here so feel free to join it up for much faster help that Reddit can offer!


r/FastAPI 12h ago

Question Where to learn FastAPI?

7 Upvotes

I have a good Python experience. I did basic backend dev with PHP and Flask before, so the beginner concepts won't be that much challenging. What I'm looking for is a single well-organized course to learn FastAPI deeply. I've checked out the official documentation, which is absolutely great and lovely, and I will use that as a reference.

It doesn't matter if the course is certified or not. I focus on the skills I'll gain. It's more preferred to be a free course though (but don't hesitate to share paid courses too if they are really worth paying for).


r/FastAPI 2d ago

Tutorial Finished my first FastAPI project. Where do I go from here?

14 Upvotes

Hey everyone,

I recently finished my first FastAPI project and wanted to get some feedback from people with more experience.

It's just a simple Movie Watchlist API that I built to learn FastAPI and backend fundamentals, so I'm not really looking for feedback on the idea itself. I'm more interested in hearing what you think about the code, the structure, and the way I approached building it.

Repo: https://github.com/BensefiaAbdessamed/MoviesWatchlist

My goal is to become a backend engineer who can build production-ready applications, so I'd really appreciate an honest review. If you were reviewing this as a junior's project, what would you point out? What beginner mistakes do you notice? What would you refactor or do differently? Are there any bad practices that I should stop early?

I'm also a bit unsure about what to learn next. Should I keep improving this project by adding more concepts, or is it better to start a new one? What backend topics do you think are important after getting comfortable with FastAPI? Things like testing, caching, message queues, Docker, CI/CD, design patterns, system design, or anything else?

A couple of friends also suggested that I should learn Django next. Do you think it's worth learning at this stage, or should I keep going deeper with FastAPI and backend fundamentals before jumping to another framework?

Lately I've also been getting interested in RAG systems and MCP integration because AI applications seem to be everywhere now. Do you think it's a good idea to start learning those, or would that just distract me from building a strong backend foundation first?

Feel free to be as critical as you want. I'm posting this because I genuinely want to improve and avoid building bad habits early on.

Thanks to anyone who takes the time to review it or share their advice. I really appreciate it.


r/FastAPI 2d ago

pip package Metered: An open-source rate limiting library with Redis support and FastAPI/Flask integration

6 Upvotes

Hey everyone,

I've been working on APIs and microservices for a while, and one thing that kept frustrating me was how most rate limiting libraries out there only handle basic request throttling. When I needed persistent quota management, dynamic request costs (think LLM token billing), and distributed Redis-backed operations, I kept having to build glue code on top of existing solutions.

So I built Metered — an open-source Python library that tries to cover all of these in one place.

What it does:

  • Multiple algorithms: Token Bucket, Sliding Window, Fixed Window, Leaky Bucket
  • Redis-backed persistent quotas (survives restarts, works across multiple instances)
  • Dynamic request costs — useful for stuff like LLM API billing where each request can cost differently
  • Native integrations for FastAPI and Flask (decorators, middleware)
  • Distributed-safe via Redis atomic operations

Quick example:

from metered import RateLimiter

limiter = RateLimiter(
    algorithm="token_bucket",
    redis_url="redis://localhost:6379",
    capacity=100,
    refill_rate=10,
)

u/limiter.limit(key="user_id")
async def my_endpoint(user_id: str):
    ...

I've been using it in production for a bit now and figured it might be useful to others dealing with similar challenges.

Would love to hear feedback — especially around:

  • Are there algorithms or features you'd want added?
  • Anyone dealing with LLM quota management specifically? Curious how you're approaching it.
  • Any edge cases I might be missing?

Repo and docs are linked in the comments.

Thanks!


r/FastAPI 5d ago

Question Backend architecture for FastAPI + Neo4j — does this structure make sense?

11 Upvotes

Hello there! 😄

I'm currently building a backend for a Neo4j graph database and was wondering if some of the more experienced people here have any advice or best practices to share.

I only have basic experience with Python (although I'm comfortable with programming in general). Most of my backend experience comes from working with NestJS and Prisma ORM, so I'm trying to translate some of the concepts and patterns I'm familiar with into the Python ecosystem.

For the database access layer, I decided to use the official Neo4j Python driver rather than an ORM or ODM.

My current plan is to structure the backend like this:

text backend/ │ ├── main.py │ ├── api/ │ ├── routes/ │ │ ├── users.py │ │ ├── graph.py │ │ └── projects.py │ ├── services/ │ ├── user_service.py │ └── graph_service.py │ ├── repositories/ │ │── neo4j_repository.py │ ├── database/ │ └── neo4j.py │ ├── dto/ │ ├── user.py │ └── graph_models.py │ └── security/ └── auth.py

Coming from NestJS, my current thinking is roughly:

  • routes → similar to NestJS controllers
  • services → business logic
  • repositories → database access layer (somewhat comparable to what Prisma handled for me)
  • database → Neo4j driver initialization and connection management

Does this architecture make sense for a FastAPI + Neo4j project, or are there more idiomatic approaches in the Python ecosystem that I should consider?

Also, if you've built production applications with Neo4j and the Python driver, I'd appreciate hearing about common pitfalls, lessons learned, or things you wish you had known when starting out.

Thanks!


r/FastAPI 6d ago

Hosting and deployment I made an App for developers, and i'll let the community name it.

Thumbnail
0 Upvotes

r/FastAPI 7d ago

feedback request Built a FastAPI + Next.js SaaS starter because I was tired of rewriting the same auth/billing scaffolding every time

18 Upvotes

Every time I started a new SaaS idea I'd burn a weekend rebuilding the same things — Firebase auth wired through protected routes, Stripe webhook handling, typed Pydantic schemas, Docker for two services, a throwaway admin panel. So I started building FastForge to just... not do that again.

Stack: FastAPI backend, Next.js (App Router) frontend, SQLAlchemy + Alembic + Postgres, Firebase Auth, Stripe, Redis for cache/jobs, Docker for one-command spin-up.

Current state, being fully transparent since I know this sub will ask: auth and the DB layer are done, Stripe billing / Redis / transactional email / admin dashboard are still in progress. It's not a "clone and ship today" thing yet — it's early, and I'm building it in the open on GitHub.

Mainly posting here because you're the exact audience — if you build SaaS on FastAPI, what's the first thing you'd want a starter like this to get right? Landing page + waitlist link in a comment if anyone wants to follow along (trying to keep this post about the tech, not the pitch).


r/FastAPI 7d ago

pip package fastapi-dynamic-filter library

3 Upvotes

Hi all, i've created a python library above fastapi-filters that automatically generates filter, search, and sorting fields for any SQLAlchemy model in FastAPI, with native support for JSONB containment (contains), key presence (has_key), and case‑insensitive text search inside JSON values.

Example of usage (create your own custom filter for your orm model):

class UserFilter(DynamicFilter):
    db_model = User # your model
    exact_fields = ["id", "email"]
    search_fields = ["name", "bio"] # generates name__ilike, bio__ilike
    range_fields = ["created_at"] # generates created_at__gte, __lte
    contains_fields = ["tags", "metadata"] # tags__contains (list), metadata__contains (dict) + metadata__has_key
    json_search_fields = ["metadata"] # generates metadata__value_ilike
    default_order_by = ["-created_at"]

And then use it in your endpoint as a dependency:

app.get("/users")
def get_users(
  filter: UserFilter = Depends(UserFilter), # your filter here
):
    query = filter.filter(session.query(User))
    return query.all()

GitHub: https://github.com/matfatcat/fastapi-dynamic-filter/
PyPI: https://pypi.org/project/fastapi-dynamic-filter/


r/FastAPI 7d ago

Hosting and deployment LexiNova – AI Vocabulary Trainer

Post image
0 Upvotes

r/FastAPI 9d ago

Other My new App in FastApi

Thumbnail
lexinova.fun
0 Upvotes

My attempt to build an entire application.

LexiNova 🙂


r/FastAPI 10d ago

feedback request Building a "batteries-included" FastAPI starter (auth, billing, admin, email) — what would you want in it?

19 Upvotes

Working on a FastAPI + Next.js SaaS boilerplate (Python equivalent of the JS "ship fast" starters). Backend is FastAPI + Pydantic v2, Firestore for storage so far.

Before I finalize the feature list, curious what this community actually wants baked in:

  • Auth: what's your default — Supabase, Clerk, roll-your-own JWT?
  • Billing: Stripe is obvious, but subscriptions vs. usage-based matters a lot for setup
  • Background jobs: Celery, arq, or just Cloud Tasks/Cloud Run?

Landing page + waitlist if you want to follow progress: https://fastforge.pionetix.com — but honestly more interested in the discussion here than the sign-ups.


r/FastAPI 11d ago

Question Where to start?

4 Upvotes

Hi there! I'm an incoming 2nd year computer engineering student who wants to learn web development for microcontroller UI. However, I don't know where to start. I already know how to program in Python and some basic web requirements like HTML and CSS, but I am stuck whether I should learn JavaScript next or go straight to FastAPI. Thank you for reading this post. Any input would be appreciated.


r/FastAPI 12d ago

feedback request PEP 835: A native shorthand for Annotated

30 Upvotes

Ivan Levkivskyi and I are proposing a native shorthand for Annotated (PEP 835) to clean up heavy type-hinting patterns. We have confirmed this syntax is fully compatible with FastAPI and works out of the box with zero changes required.

Before:

python def create_user( id: Annotated[int, Path(gt=0)], name: Annotated[str, Query(min_length=3)], role: Annotated[str, Query(min_length=2)] = "user" ) -> User: ...

After:

python def create_user( id: int @Path(gt=0), name: str @Query(min_length=3), role: str @Query(min_length=2) = "user" ) -> User: ...

The Spec: PEP 835 Full Draft

We are gathering community sentiment before moving forward. If you are a heavy user of Annotated in FastAPI, your feedback is valuable. You can register your stance in the official Discourse poll before it closes on July 15.


r/FastAPI 12d ago

Hosting and deployment Best place to host fast api applications

13 Upvotes

I have simple fast api app it recieves requests and either writes data to the sqlite dB or fetches data from it what would be the best place to host it preferably for free since its a small hobby project but would scale up successful


r/FastAPI 14d ago

Hosting and deployment Latency when testing with k3s

Thumbnail
1 Upvotes

r/FastAPI 17d ago

pip package Built a small package for translatable SQLAlchemy/SQLModel fields — fastkit-i18n (feedback + help wanted)

11 Upvotes

I built this, so take the "cool project" framing with a grain of salt — genuinely looking for people to poke holes in it.

The problem: if you've ever needed a model field in more than one language (blog post titles, product names, category labels), you've probably hit the same two bad options — a separate translations table with joins on every query, or a JSON column you hand-roll get/set logic for yourself, differently, in every project.

fastkit-i18n is a small weekend project that tries to make the second option not suck:

from sqlalchemy import JSON
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
from fastkit_i18n import TranslatableMixin

class Base(DeclarativeBase):
    pass

class Article(TranslatableMixin, Base):
    __tablename__ = "articles"
    __translatable__ = ["title", "content"]

    id: Mapped[int] = mapped_column(primary_key=True)
    title: Mapped[dict] = mapped_column(JSON)
    content: Mapped[dict] = mapped_column(JSON)

article = Article()
article.set_locale("en")
article.title = "Hello World"

article.set_locale("es")
article.title = "Hola Mundo"

article.set_locale("en")
article.title   # "Hello World" — reads/writes like a plain string field

One row, one JSON column per translatable field, no joins. It also works with SQLModel table models (since under the hood a SQLModel table class is a real SQLAlchemy mapped class), and there's a LocaleMiddleware (pure ASGI, works with FastAPI/Starlette/Litestar) plus a Laravel-style _() for JSON translation files if you want the whole package instead of just the mixin. All three share the same locale context, but each works standalone if that's all you need.

What's genuinely missing right now (not hiding this — would rather you hear it from me than discover it):

  • No pluralization. If you need ngettext-style "1 item / 5 items" logic, gettext/Babel handles that natively, and this doesn't yet.
  • Accept-Language Parsing in the middleware is simplified — it takes the first listed language, not full RFC quality-value negotiation (fr;q=0.5, en;q=0.9 resolves to fr, not the higher-weighted en). Fine for most apps, not a drop-in replacement if you need strict negotiation.
  • It's genuinely new — published today, zero production mileage beyond our own testing. Wouldn't put it on a critical path yet.

Where I could actually use help:

  1. RFC-compliant Accept-Language parsing as an opt-in alternative to the simple version
  2. Pluralization support — open to suggestions on whether that belongs in this package or stays out of scope
  3. Just... using it and telling me where it breaks. It's MIT licensed, no dependencies beyond an optional SQLAlchemy extra (pip install fastkit-i18n[sqlalchemy]), so the bar to try it is low.

Repo: https://github.com/fastkit-org/fastkit-i18n
Docs: https://fastkit.org/docs/fastkit-i18n
PyPI: https://pypi.org/project/fastkit-i18n

It's the standalone extraction of the i18n piece from a larger toolkit I work on (fastkit-core) — if you're already using that, you already have this, no separate install needed. This is for anyone who wants just the translation piece without the rest.

Happy to answer questions in the comments, and if anyone wants to contribute on either of the two gaps above, PRs and issues both welcome.


r/FastAPI 20d ago

feedback request [FOR HIRE] Senior Backend / Data Engineer – FastAPI, Python, Spark, AWS | API Development & Data Pipelines | Bangalore & Remote

2 Upvotes

About Me

Senior Engineer with 5+ years of experience in FastAPI backend development, Data Engineering, and Applied AI. Based in Bangalore, India. Available for remote work globally.

Rate: $25 - $50/hr depending on project scope and complexity.

Tech Stack & Expertise

FastAPI, Python, REST APIs

Python, SQL, Spark, Databricks, Airflow

AWS & Cloud Data Platforms

ETL/ELT Design & Orchestration

LLMs, RAG, AI Agents

Snowflake, Redshift, BigQuery

Data Quality & Testing Frameworks

What I Can Help With

Develop and deploy FastAPI applications

Build and optimize data pipelines (batch & streaming)

Design scalable ETL/ELT architectures

Build AI applications using LLMs, RAG, and agent-based workflows

API integration and backend automation solutions

Training & Mentorship

FastAPI & Python Backend Development

Data Engineering (foundations to advanced)

AI & LLM Fundamentals (including RAG patterns)

In-person weekend sessions available in Bangalore. Remote sessions available globally.

Availability

Freelance projects & consulting

Part-time remote roles

Weekend training & mentorship

DM me with a brief description of your requirements and I will get back to you promptly!


r/FastAPI 21d ago

pip package I built a Laravel-inspired application framework for FastAPI — looking for feedback

6 Upvotes

FastAPI is excellent for quickly building APIs, but it intentionally leaves many application-level concerns to the developer. Things like environment management (including multiple environments), logging, database setup, configuration, CLI commands, plugins, storage, and other infrastructure are things you typically need to design and wire together yourself.

In our case, we are building multiple microservices, and we found ourselves repeatedly copying the same bootstrap code between projects. Over time, that became repetitive and harder to maintain consistently.

Over the past several months, We've been working on FastAPI Startkit, an open-source application framework that brings some of the development patterns I enjoyed from Laravel into Python and FastAPI.

The goal is not to replace FastAPI. Instead, it provides a structured foundation for building larger applications while staying modular. You can use only the components you need.

Some features include:

🏗️ Service container & dependency injection
⚡ CLI inspired by Laravel's Artisan
🗄️ Async database layer, ORM patterns, migrations, and seeders
🧪 Built-in testing utilities
🤖 AI agent support with multiple LLM providers
🎨 Optional Vite integration for monolithic full-stack applications
📦 Works for FastAPI apps, background workers, and even CLI-only applications

One of the main design goals was avoiding a single opinionated stack. Most components are optional, so you can start small and introduce more structure as your project grows.

The documentation includes both a minimal setup and a more structured application layout.

Documentation:
https://fastapi-startkit.github.io/

I'd really appreciate feedback on:

  • Is the architecture intuitive?
  • Which parts feel over-engineered?
  • What features would you expect from a production-ready FastAPI framework?
  • Are there areas where the developer experience could be improved?

Constructive criticism is very welcome. Thanks!


r/FastAPI 21d ago

Tutorial Handling Stripe webhooks in FastAPI

Thumbnail
highlit.co
5 Upvotes

A FastAPI endpoint that verifies Stripe's signature, then routes each event type to the right billing action.

Three takeaways

  1. Always verify a webhook's signature against a shared secret before trusting its contents.
  2. Read the raw request body for signature checks — parsed JSON won't match the signed bytes.
  3. Return 200 quickly and delegate the actual work so the provider considers the event delivered.

r/FastAPI 22d ago

feedback request Store multilingual content in JSON columns, resolve by locale automatically

2 Upvotes

Hey, I've been working on a multilingual content system for a project and kept wishing Python had something like spatie/laravel-translatable from the PHP world. Couldn't find it, so I built it. It's early (0.1.0) but it works and tests are at 100% coverage.

The idea: store translations as {"en": "Hello", "fr": "Bonjour"} directly in the column, resolve by the active locale automatically — no extra tables, no .po files.

configure(default_locale="en", available_locales=["en", "fr", "ar"])
title = Translations({"en": "Hello", "fr": "Bonjour"})
set_locale("fr")
print(title)  
# Bonjour

GitHub: https://github.com/onlykh/translatable

Main features:

  • Translations is a dict subclass — str(title) resolves to the active locale, works in f-strings, string concatenation, everywhere
  • Locale lives in a ContextVar — safe for async FastAPI and threaded Flask
  • SQLAlchemy 2.0 type: JSONB on PostgreSQL, JSON elsewhere. String assignment merges into the current locale without wiping other languages
  • by_locale(Article.title, "fr") generates dialect-correct SQL for filtering
  • Atomic per-key updates on PostgreSQL via JSONB ||
  • Starlette/FastAPI middleware and Flask extension that read Accept-Language automatically
  • Zero dependencies in core — SQLAlchemy, Starlette, Flask are opt-in

Not on PyPI yet, install from GitHub:

pip install "translatable[sqlalchemy] @ git+https://github.com/onlykh/translatable.git"

A few things I'm genuinely unsure about and would love opinions on:

  • String assignment merging by default (article.title = "Hello" adds to the current locale rather than replacing the column) — right default or surprising?
  • No Django ORM support yet — is that a blocker for anyone?
  • atomic_set_locale is PostgreSQL-only — the SQLite fallback is a read-modify-write with a warning. Good enough or should that raise instead?

Would love issues, feedback, or just knowing if this solves something you've hit before.


r/FastAPI 24d ago

pip package ArchUnit but for Python: enforce your architecture via unit tests

24 Upvotes

I just shipped ArchUnitPython, a library that lets you enforce architectural rules in Python projects through automated tests.

The problem it solves: as codebases grow, architecture erodes. Someone imports the database layer from the presentation layer, circular dependencies creep in, naming conventions drift. Code review catches some of it, but not all, and definitely not consistently.

This problem has always existed but is more important than ever in Claude Code, Codex times. LLMs break architectural rules all the time.

So I built a library where you define your architecture rules as tests. Two quick examples:

```python

No circular dependencies in services

rule = project_files("src/").in_folder("/services/").should().have_no_cycles() assert_passes(rule) ```

```python

Presentation layer must not depend on database layer

rule = project_files("src/") .in_folder("/presentation/") .should_not() .depend_on_files() .in_folder("/database/") assert_passes(rule) ```

This will run in pytest, unittest, or whatever you use, and therefore be automatically in your CI/CD. If a commit violates the architecture rules your team has decided, the CI will fail.

Hint: this is exactly what the famous ArchUnit Java library does, just for Python - I took inspiration for the name is of course.

Let me quickly address why this over linters or generic code analysis?

Linters catch style issues. This catches structural violations — wrong dependency directions, layering breaches, naming convention drift. It's the difference between "this line looks wrong" and "this module shouldn't talk to that module."

Some key features:

  • Dependency direction enforcement & circular dependency detection
  • Naming convention checks (glob + regex)
  • Code metrics: LCOM cohesion, abstractness, instability, distance from main sequence
  • PlantUML diagram validation — ensure code matches your architecture diagrams
  • Custom rules & metrics
  • Zero runtime dependencies, uses only Python's ast module
  • Python 3.10+

Very curious what you think! https://github.com/LukasNiessen/ArchUnitPython


r/FastAPI 26d ago

feedback request Backend project (FastAPI + PostgreSQL) — feedback appreciated

15 Upvotes

Hi everyone,

I’m currently building my backend portfolio using FastAPI and would really appreciate some honest feedback on my project.

Project: Notes API

GitHub: https://github.com/tamerlan-islamzade/Note-API

It’s a RESTful API where users can register, authenticate, and manage their personal notes with full CRUD operations.

Tech stack:

FastAPI, PostgreSQL, SQLAlchemy, Pydantic, JWT, bcrypt, pytest

I’d really appreciate feedback on:

- Project structure / architecture

- Code quality and organization

- FastAPI best practices

- Anything I should improve to make it more production-ready

I’m still learning, so any constructive criticism is welcome. Thanks in advance for your time!


r/FastAPI 26d ago

feedback request Note-APİ

4 Upvotes

Hey,

I’ve been learning backend development with FastAPI and built a small Notes API as practice.

Users can register, login, and manage their own notes (CRUD).

I’d really appreciate some feedback from more experienced developers:

- project structure

- API design

- anything I could improve

I’m still learning, so all constructive criticism is welcome. Thanks!


r/FastAPI Jun 22 '26

Hosting and deployment FastAPI Cloud in Public Beta ⚡️

101 Upvotes

Hey folks! FastAPI Cloud is now in public beta. 🚀

This is made by the same team building FastAPI (I created FastAPI, we now have an amazing team building all this).

Here's the announcement post: https://fastapicloud.com/blog/fastapi-cloud-public-beta/


r/FastAPI 29d ago

Hosting and deployment FastAPI Cloud can deploy marimo notebooks too!

Thumbnail
youtu.be
7 Upvotes

When I saw the beta announcement, I couldn't help myself.