r/FastAPI • u/cantdutchthis • Jun 23 '26
Hosting and deployment FastAPI Cloud can deploy marimo notebooks too!
When I saw the beta announcement, I couldn't help myself.
r/FastAPI • u/cantdutchthis • Jun 23 '26
When I saw the beta announcement, I couldn't help myself.
r/FastAPI • u/Impressive_Essay927 • Oct 27 '22
r/FastAPI • u/PercentagePleasant77 • Mar 22 '26
Hey 👋
I've been solo-building a family planning app for a few months and I think it's time to get some real eyes on it.
What it does:
Private & shared tasks with karma/XP, family calendar + RSVP, shared shopping lists, family challenges, push notifications, family notes, multi-family groups… basically a full “family hub”.
Stack:
Flutter (web / iOS / Android from one codebase), FastAPI + PostgreSQL, deployed on Railway + Vercel free tier (yeah… cold starts can be a bit slow 😅).
It's not on the App Store / Play Store (those fees add up), but you can install it as a PWA directly from your browser — works great on mobile 👍
👉 https://family-planner-sage.vercel.app
Current state:
Still a work in progress — I’m polishing a few things on the frontend (especially dark mode), and planning to add Google & Apple sign-in soon.
But hey… let’s be real, apps are never really “finished” — there’s always something to tweak, improve, or rebuild 😄 otherwise we’d all be out of a job.
Open to:
\- Feedback
\- Early users
\- Selling the project
\- Tweaking features before any deal
\- Full handoff (code + deployment)
Happy to answer anything about the code, the stack, or the product 🙌
r/FastAPI • u/Longjumping-Dirt-127 • May 17 '26
Want to learn fast api project wise visit the fast api offical site but what I want is how to structure fastapi app
api calls
database connection
models
authentication flow
third party interaction
needs appropriate resources
r/FastAPI • u/mobileAcademy • Oct 08 '25
🚀 Master FastAPI with Clean Architecture! In this introductory video, we'll kickstart your journey into building robust and scalable APIs using FastAPI and the principles of Clean Architecture. If you're looking to create maintainable, testable, and future-proof web services, this tutorial is for you!
#python #fastapi #cleanarchitecture #sqlalchemy
r/FastAPI • u/Ahmad_Azhar • Oct 17 '26
Hey everyone! It’s been great seeing FastAPI grow so much and mature over time. It’s now my default choice when building APIs in Python.
I love FastAPI, so I chose it again for this project and paired it with Flet (Cross-platform interfaces in Python). Probably shows how much I love Python too 🙂
RelayDeck, Independent companion for Herdr, which manages coding agents and shell sessions on your Mac. RelayDeck lets you access those sessions from a phone, iPad, or browser.
FastAPI powers the backend API and WebSocket connections, including device pairing and terminal access, while Flet handles the interface.
Here’s what’s available:
Usage and limits: token usage and estimated costs by tool and Herdr space, with usage history and charts. Where supported, it also shows plan limits and reset times.
Remote terminals: open an agent or shell, check its output, send a prompt, or answer a question directly.
Image attachments: attach screenshots and images to prompts, with support for PNG, JPEG, and WebP.
Different ways to type: a composer for longer prompts, direct terminal input, and ordinary shell access. Unsent drafts are kept when switching.
Web Push notifications: get notified when an agent is blocked or finished, with preferences for each device.
A companion runs on your Mac, and approved devices connect over your private Tailscale network. There’s no RelayDeck cloud service or separate account to create.

Web app and PWA are available now, installed from source. Native Android and iPhone builds are in progress, with branch visibility and code-change review planned.
Repo: https://github.com/Hybridhash/relaydeck
I’d love feedback from other FastAPI developers, Contributions are welcome too—code, docs, bug reports, or ideas.
If you like the project, I’d appreciate a star! ⭐
r/FastAPI • u/palpapeen • Feb 09 '24
Hello r/FastAPI!
A friend of mine and I, big time users of fastapi, were at a Generative UI hackathon a couple weeks ago. We don't like building frontend stuff when building backend is so easy, so we invented Natural Frontend (Github).
Just add this one line and an AI will read your code, add a /frontend endpoint to your api, and generate frontends for you there based on who it thinks would use your api.
It makes it very quick to prototype different types of frontends.
Please let us know what you think!

r/FastAPI • u/Prestigious-Bee2093 • Apr 20 '26
Hey veryone,
So a few days back, I shared UIGen here - a tool that generates a full React frontend from your FastAPI OpenAPI spec. The response was very encouraging.
So I iterated on it with a better usecase app.
I needed an internal tool for work. The requirements:
Upload Word templates with Jinja2 variables
Create meetings with audio recordings
Associate multiple templates with each meeting
Fill template data (either AI-generated or manual entry)
Generate Word docs, convert to PDF, merge them in order
Download the final merged PDF
Standard CRUD stuff, but with file uploads, many-to-many relationships, and some custom actions. Perfect test case.
Backend: FastAPI with async SQLAlchemy, PostgreSQL, Alembic migrations. About 2,000 lines of Python across models, services, repositories, and routers. Full OpenAPI spec auto-generated by FastAPI.
Frontend: Pointed UIGen at the generated yaml.
1. Too Much Noise in the UI
FastAPI generates comprehensive specs. That's great for documentation, but not every endpoint needs to be in the UI. I had internal metrics endpoints, health checks.
I didn't want to modify my FastAPI code or the generated spec just to hide these.
Fix: Built vendor extension support, starting with x-uigen-ignore. Now I can annotate my OpenAPI spec:
paths:
/internal/metrics:
x-uigen-ignore: true
/users:
get:
x-uigen-ignore: false # Explicitly include
post:
x-uigen-ignore: true # Hide this specific operationOr better yet, use the config system (using the cli) so the spec stays untouched:
# .uigen/config.yaml
annotations:
POST:/internal/metrics:
x-uigen-ignore: true
User.internal_id:
x-uigen-ignore: trueWorks on operations, paths, schema properties, and parameters. Operation-level annotations override path-level ones.
2. File Uploads
FastAPI makes file uploads trivial with UploadFile. But UIGen had no idea what to do with type: string, format: binary in the spec.
Fix: Added file upload detection across both OpenAPI 3.x and Swagger 2.0. UIGen now generates a drag-and-drop file upload component with:
Type validation (images, documents, videos)
Size limits from x-uigen-max-file-size
Preview thumbnails
Proper multipart/form-data handling
3. Ugly Field Labels
Pydantic field names like created_at, user_id, and is_active get auto-humanized to "Created At", "User Id", "Is Active". Close, but not always right. And I didn't want to change my Python code just for UI labels.
Fix: Added x-uigen-label vendor extension:
# In spec or config
User.created_at:
x-uigen-label: "Created At"
User.user_id:
x-uigen-label: "User ID"Now labels are exactly what I want without touching the FastAPI models.
5. Config Without Touching the Spec
I wanted to hide internal endpoints, rename ugly field labels, and tweak the UI without modifying my FastAPI code or the generated OpenAPI spec.
Fix: Built a config reconciliation system. You create a .uigen/config.yaml file with all your customizations, and UIGen merges them at runtime without touching your source spec:
annotations:
POST:/internal/metrics:
x-uigen-ignore: true
User.created_at:
x-uigen-label: "Created At"
POST:/auth/login:
x-uigen-login: trueYour spec stays clean, your FastAPI code stays clean, but the UI reflects your preferences.
There's a visual config GUI (npx @uigen-dev/cli config openapi.yaml) so you don't have to write YAML by hand. Point-and-click to hide endpoints, rename fields, and customize the theme.
After building this app and fixing the gaps, here's what UIGen generates from my FastAPI spec:
Table views with sorting, pagination, and filtering (query params from the spec)
Create/edit forms with validation matching my Pydantic models
Detail views with related resource links (meetings → templates)
File upload UI for template and recording uploads
Custom action buttons - "Generate Documents", "Convert to PDF", "Download PDF"
Full authentication cycle - login, signup, password reset, token storage, automatic header injection
Vendor extensions - x-uigen-ignore, x-uigen-label, x-uigen-login for customization
Config GUI - visual editor for annotations and theme customization
Dark/light theme toggle
The meeting minutes app is in the UIGen repo as a full example:
git clone https://github.com/darula-hpp/uigen
cd examples/apps/fastapi/meeting-minutes
# Start backend (FastAPI + PostgreSQL)
docker compose up -d
docker compose exec app alembic upgrade head
# Generate frontend
cd ../../../
pnpm install && pnpm build
npx @uigen-dev/cli serve examples/apps/fastapi/meeting-minutes/openapi.yamlOr try it on your own FastAPI app:
npx @uigen-dev/cli serve http://localhost:8000/openapi.jsonThere are still gaps:
Circular references - Deeply nested recursive Pydantic models might skip the deepest levels
Complex relationships - Many-to-many with extra fields on the join table needs manual handling
Custom validation - Pydantic validators with custom logic don't translate to the frontend
WebSockets - Not supported yet
Streaming responses - Not supported
GraphQL - OpenAPI/REST only for now
Every OAuth variant - Works for Bearer/API Key/Basic, but not every custom auth flow
V1 will probably be suited for internal tools, admin panels, and rapid prototyping. Not a replacement for a polished consumer-facing app with custom UX requirements. But yeah, its an intereting challenge to include even more usecases.
I'm trying to figure out:
Better relationship detection and easy relationship config.
A non bloat way to do layout customizations
Adding Polish & a non Bloat way to configure your app (App name etc)
If you've built a FastAPI app and want to see what UIGen generates, I'd love feedback. The more real-world specs I test against, the better this gets.
GitHub: https://github.com/darula-hpp/uigen
npm: https://www.npmjs.com/package/@uigen-dev/cli
Docs: https://uigen-docs.vercel.app
Architecture: https://uigen-docs.vercel.app/blog/uigen-architecture
Happy to hear what you think.
r/FastAPI • u/luxdav • Oct 19 '22
r/FastAPI • u/betazoid_one • Jul 23 '25
Just created a fun little backend using FastAPI and Typer to generate a RaaS, resume-as-a-service. It's a super small project, and kind of quirky, but fun nonetheless. Might be interesting to point a potential employer to their terminal and `curl` your resume eg `curl https://resume.mycooldomain.com`.
r/FastAPI • u/huygl99 • Aug 07 '26
Hey everyone, after taking a bit of a break I decided to write an in-depth tech blog to help those of you building (or about to build) an AI agent in the Python ecosystem, especially on FastAPI, so you can end up with something structured, scalable and efficient. This comes out of a lot of time working on chatbots, streaming and AI agents. There was no good guide for me when I built those, so after suffering plenty of pain and bugs I decided to write it up and open source part of my work to help you avoid the same. Hope it helps.
Full blog here in case you have time to read properly. Whether you're a team lead or senior who needs to build a scalable AI agent project, or a junior or intern who wants to build one the right way, this should be useful (it cost me a lot of time and money to learn): https://huynguyengl99.github.io/posts/pydantic-ai-typed-websockets-fastapi/
Comes with the repo: https://github.com/huynguyengl99/pydantic-ai-ws-agent
If you want to catch up first, TL;DR:
A contract-based, structured protocol still beats an unstructured, code-first one. Instead of writing a pile of if/else and tests to make sure things are correct (and sometimes they still aren't), you keep one up-to-date contract that both the backend and the frontend build against, so no field is silently missing or outdated. For REST APIs that's OpenAPI. For WebSockets it's AsyncAPI. You can even design the whole protocol before writing any code. Trust me, it saves you a lot of 2am bugs.
Prefer a structured, model-independent agent. There are plenty of options now (LangChain, the OpenAI SDK, the Gemini and Anthropic SDKs), but most of the time what matters is being able to switch model or provider without rewriting anything, structured and validated tool calls (without tool calls it's just a chat, not an agent), and something that fits your existing ecosystem. Tie yourself to one vendor's SDK and you'll feel it the first time you want to compare models or a provider has an outage. Pydantic AI is the one that gives you all of that. If you've used LangChain you'll remember the mess around messages and tool handling, a lot of unnecessary complexity. Pydantic AI keeps it structured, and since it comes from the Pydantic team it speaks Pydantic models natively, which is exactly why it fits FastAPI so well.
Once your agent is structured, your server API should be too. Most people reach for SSE because it's simple, but it's missing a few things: bidirectional messages, a proper API schema (OpenAPI 3.2.0 has some support for streaming now, but tooling is still limited and it doesn't feel as natural as it does for REST), and any official way to offload work to a worker or push a message from outside the request, like a notification from somewhere else in your system. WebSockets don't have that schema problem, because AsyncAPI is a real spec built for exactly this: every message your server can send or receive, described in one document your frontend can generate a client from. It's the same deal OpenAPI gives you for REST, just for event-driven APIs.
Bidirectional matters more than people expect, and human-in-the-loop is why. With Pydantic AI you can mark a destructive tool requires_approval=True. The run then stops before executing, hands you the pending calls, and you send an approval request to the UI. The user approves or denies (they can even edit the arguments), and you resume the run from where it paused. That round trip is awkward over SSE and completely natural over a WebSocket, it's just two more messages on a connection you already have.
That's where ChanX and fast-channels come in. Based on the well-known django-channels package, I built fast-channels to bring the channels architecture to FastAPI. ChanX is the only tool I'm aware of that makes WebSocket handlers structured and easy while auto-generating AsyncAPI docs, so your frontend can generate a client straight from the schema. That's the contract you need to stop things going stale or breaking silently. It also gives you the offload story: the run happens in a background task and broadcasts to a conversation group, so a page refresh mid-run doesn't kill the answer, every tab stays in sync, and moving the work to a Celery or taskiq worker later changes nothing else.
One more thing that surprised me: the whole flow becomes testable without an LLM. Because the protocol is typed and the agent is built from a factory, Pydantic AI's FunctionModel can script exactly what the model does. Streaming, tool execution, approve, deny and reconnect all become deterministic tests. Mine run in about a second with no API key, which is the difference between having tests and pretending to.
That's the core and the summary for a quick catch up. When you have time, reading the blog and looking at the repo will give you more insight into building a structured, scalable, production-ready AI agent.
Related repos:
Pydantic AI, the agent framework: https://github.com/pydantic/pydantic-ai
ChanX, typed WebSocket handlers with AsyncAPI generation, for Django and FastAPI: https://github.com/huynguyengl99/chanx
fast-channels, the Django Channels architecture ported to FastAPI, which ChanX builds on: https://github.com/huynguyengl99/fast-channels
The demo from this post: https://github.com/huynguyengl99/pydantic-ai-ws-agent
If ChanX or fast-channels turn out to be useful for you, a star or any contribution to improve them would be appreciated 😄
I'm open to any discussion in the comments, feel free to bring up any problem you're hitting when building an AI agent. I'll try my best to help, since I've been through most of the pain already.
r/FastAPI • u/TimeCryptographer418 • Aug 14 '24
Yes, I'm really loving fastapi. It's so nice and smooth and convenient
r/FastAPI • u/Lee-stanley • Jan 08 '26
Real-time AI is exploding chatbots, RAG, LLM streaming. Yet I still see new projects using Flask instead of FastAPI. Native async, WebSockets, auto-docs, and Pydantic make it perfect for modern AI serving.Are you using FastAPI for AI/ML APIs? What’s your stack?
r/FastAPI • u/cantdutchthis • Jun 10 '25
r/FastAPI • u/ReputationCautious77 • Apr 26 '26
I released DBWarden 0.6 yesterday. Here is what it does.
https://github.com/emiliano-gandini-outeda/DBWarden
DBWarden is a database toolkit for FastAPI and SQLAlchemy. Migrations, async sessions, startup validation, and health checks. One config call. Zero boilerplate.
Most migration setups spread config across multiple files, multiple abstractions, and multiple sources of truth. DBWarden collapses all of that into a single database_config() call. That one call drives your sessions, your health checks, and your migration state. Nothing else to configure.
Your migrations are plain SQL files. No DSL to learn. No auto-generated Python to decode. You write the SQL, you read the SQL, and that is exactly what runs against your database. What you get:
One config call for everything
Plain SQL migrations with rollback included by default
Async session dependency ready to inject with get_session()
A mountable health router with DBWardenHealthRouter()
A lifespan helper with migration_context()
Dev mode: SQLite locally, PostgreSQL in production, no changes to your migration files
Supported databases: PostgreSQL, MySQL, MariaDB, SQLite, ClickHouse.
Three commands to get started: dbwarden init dbwarden make-migrations "create users table" dbwarden migrate Done. Your schema is versioned, reviewable, and reversible.
No wrappers, no hidden state.
MIT licensed. Actively maintained. Source in this repo.
r/FastAPI • u/UpstairsBaby • Jun 02 '25
I'm designing a backend system for a face recognition feature response can potentially be one of many occasions for the example a phase might not be found in the provided image or a face might be spoofing or a face could be found but couldn't be matched against another face in my database.
How what are the best practices for designing a response to the frontend. Shall I be raising HTTP exceptions or shall IP returning 200 okay with a json saying what has gone wrong? If anyone can provide an example of how such a response could be designed I would be very thankful.
thank you very much in advance.
r/FastAPI • u/RadeN33 • Jun 03 '25
Hi guys. I am trying to learn fastAPI nowadays. although I tried so much but cannot learn anything. Do you have any document or practicing tool advice to learn fastAPI?
r/FastAPI • u/vladkens • Oct 22 '24
r/FastAPI • u/International-Rub627 • Feb 26 '25
Require best practices to reduce Latency on my FASTAPI application which does data science inference.
r/FastAPI • u/bsenftner • Mar 14 '23
You may or may not have heard that Alpine uses the musl library in place of the glibc library, a standard C runtime library used by many tools. Sometimes differences between musl and glibc can cause problems for apps in production. Plus the stated claims of a smaller image for one's app when using Alpine appear to be unfounded.
I have a basic content/document management FastAPI based application I am preparing for a client which I developed in Docker using an Alpine based image. Reading about the glibc/musl issue, I changed to using ubuntu:20.04 as my runner base image and my app's container dropped from 798 MB to 216 MB. I thought that reduction in side to be noteworthy, for those that may be doubting the size reported reductions.
r/FastAPI • u/aaronsreddit- • Sep 29 '23
I'm curious to find out what other people find useful to log in your projects.
r/FastAPI • u/here-i-am-people • Aug 05 '21
r/FastAPI • u/r1qu3 • Aug 17 '21
I was studying FastAPI through it's docs (regular and advanced) and started to write it to a template project.
It is ongoing as I need to finish the test suite and I want to add at least one websocket example: https://github.com/htbrandao/fastemplate
If would like to check how a FastAPI backend with test cases, depends, token validation, auth and a few other features would look like, please be my guest!
Hope it helps, PRs are welcome!
EDIT: It also has Sphinx documentation provided in html files, besides everything well documented =)