r/FastAPI • u/Lonely-Sun4463 • Jun 07 '26
Question lern FastAPI
Hello, I just finished a CS50P course and I want to learn a tool (FastAPI ), What is the best free, and paid source to lerned?
r/FastAPI • u/Lonely-Sun4463 • Jun 07 '26
Hello, I just finished a CS50P course and I want to learn a tool (FastAPI ), What is the best free, and paid source to lerned?
r/FastAPI • u/amine2crf • Nov 29 '25
Hi I'm planning on learning Python for automation and being automation end AI agent specialist wanna help small businesses and large scale clinics and real estate agencies with chat bots, lead generation, scrapping the web and so on can anyone suggest a road map for the libraries I should learn with Python and how to use n8n with Python for better automations and easier tasks and visual understanding I don't wanna rely too much on an n8n, i just want to save time with it also i have a long term goal of making my own ai apps so what other languages that you suggest i learn im a cs student so i want my cv to look good
r/FastAPI • u/According-Promise-23 • Apr 14 '22
I'm trying to use Pydantic models with FastAPI to make return multiple predictions (for a list of inputs), the problem is we can't use Pydantic models directly to model.predict function, so I converted it to a dictionary, I'm getting an error I get an error "value is not a valid dict" trying :
from fastapi
import FastAPI
import uvicorn
from pydantic import BaseModel
import pandas as pd
from typing import List
class Inputs(BaseModel):
id: int
f1: float,
f2: float,
f3: str
class InputsList(BaseModel):
inputs: List[Inputs]
@app.post('/predict')
def predict(input_list: InputsList):
df = pd.DataFrame(input_list.inputs.dict())
prediction = classifier.predict(df.loc[:, df.columns != 'id'])
probability = classifier.predict_proba(df.loc[:, df.columns != 'id'])
return {'id': df["id"].tolist(),
'prediction': prediction.tolist(), 'probability': probability.tolist()} I have also a problem with the return, I need the output to be something like :
[
{
"id": 123,
"prediction": "class1",
"probability": 0.89
},
{ "id": 456,
"prediction": "class3",
"probability": 0.45
}]
PS: the "id" in Inputs class doesn't take place in the prediction (is not a feature) but I need it to be shown next to its prediction (to reference it)
r/FastAPI • u/Ek_aprichit • Apr 05 '25
HELP
r/FastAPI • u/mobileAcademy • Nov 05 '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!
r/FastAPI • u/tmgbedu • Jul 01 '26
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 • u/Weary-Wrangler6798 • Apr 15 '26
I don’t know if it’s just me, but every time I tried to build something with people online it went the same way.
People are interested.
You create a group.
Everyone disappears after a couple of days.
So a couple of weeks ago I started working on something to fix that.
It’s basically a place where you can:
join real projects (not just ideas)
form small teams based on stack
and actually work together (tasks, chat, code, etc.)
Right now we’re around 150 users.
Only a small part is actually active (~20), but those teams are really building stuff.
So now I’m trying to understand what makes the difference.
If you’ve ever tried building with strangers: what made it work (or fail)?
If you’re curious:
r/FastAPI • u/mortalezz • Mar 18 '26
All in MDs and posts
r/FastAPI • u/Ancient-Direction231 • Jan 06 '26
r/FastAPI • u/muayyadalsadi • Feb 01 '23
r/FastAPI • u/Full-Way24 • Aug 18 '22
hi folks, I'm unable to connect to database(mariadb) and it's working fine out of the FastApi framework
r/FastAPI • u/dejavits • Apr 03 '23
Hello all,
I am making a Nextjs application with FastAPI as backend. I receive from the backend the setcookie headers, however, it is not stored by the browser. Does anyone spot the problem? There are a lot of questions about this on Stackoverflow but I have not managed to make it work.
This is my FastAPI configuration for CORS:
origins = [
"http://localhost",
"http://localhost:3000"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)This is the header received:
HTTP/1.1 200 OK
date: Mon, 03 Apr 2023 07:16:25 GMT
server: uvicorn
content-length: 85
content-type: application/json
set-cookie: authzAccessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRlamF2aWhAZ21haWwuY29tIiwiaWQiOiI1YTFhMGNkMS0wZjM1LTQ3ODEtYWIxZC03MjU2MzFiM2M0YjEiLCJleHAiOjE2ODA1MDcwODZ9.3K7aPPD9oz42afEB3Gyi2sjjqyfFkhvJrWMt048PD_o; Domain=http://localhost:3000; expires=Mon, 03 Apr 2023 07:31:26 GMT; HttpOnly; Path=/; SameSite=lax
set-cookie: authzRefreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRlamF2aWhAZ21haWwuY29tIiwiaWQiOiI1YTFhMGNkMS0wZjM1LTQ3ODEtYWIxZC03MjU2MzFiM2M0YjEiLCJ2ZXJzaW9uIjoiMzczYzU4NzUtYTU1OC00ZGYzLWJhMGYtZDU2NDIwMmNlYTVjIiwiZXhwIjoxNjgxMTEwOTg2fQ.SFOY3O8EIHsIMO27s9R7B08YsXM8LPbto22ZEv_G-ho; Domain=http://localhost:3000; expires=Mon, 10 Apr 2023 07:16:26 GMT; HttpOnly; Path=/; SameSite=lax
access-control-allow-credentials: true
access-control-allow-origin: http://localhost:3000
vary: OriginI make the request with axios and withCredentials: true set.
Nextjs runs on localhost port 3000 and fastapi on 127.0.0.1 port 8000
Does anyone see the problem?
r/FastAPI • u/gibbon119 • Feb 22 '23
So my problem is I have multiple endpoints in this API and all are fine except one where the records in the DB cannot be recreated. When this endpoint is called, I want to check first if the record exists, if it does, I throw a HTTPStatus Conflict error. If it does not exist, I go about creating the DB record.
Maybe I am approaching the problem wrong by wanting to handle 1 request at a time? Any thoughts? Any ideas would be appreciated! :D
Bare-bones Code example:
def create_new_task(uuid,user):
record_exists = get_record_query(uuid,user)
if record_exists:
raise HTTPException(status_code=HTTPStatus.CONFLICT)
else:
create_record(uuid,user)Edit: Thanks everyone! I got what I needed! Got a FIFO queue working but the performance of the endpoint definitely diminished with it so I was able to make a strong enough case for a unique constraint. We’re adding a new field to support that so existing data does not cause violations
r/FastAPI • u/No-Butterscotch9679 • Mar 30 '26
How hard is it to actually find good datasets for real feature engineering?
Not the overused ones like Titanic or House Prices—but datasets where you can genuinely explore, clean, and engineer meaningful features that reflect real-world complexity.
Feels like most public datasets are either too clean, too small, or already over-explored.
Where do you all find datasets that are messy enough to learn from but still usable for serious projects?
r/FastAPI • u/Prestigious-Bee2093 • May 17 '26
Hey everyone, a few days ago I shared an update UIGen - a CLI that turns your OpenAPI spec into a full React App at runtime. It was regarding OAuth Support and I continued to iterate.
Recently added override support and payment integration. (The profile page in the demo was a complete override)
Replace any view with custom React components. The runtime handles discovery, transpilation, and injection.
Component Mode - Full control:
// src/overrides/profile-custom.tsx
import type { OverrideDefinition } from '@uigen-dev/react';
function CustomProfile() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('/api/v1/auth/me').then(res => res.json()).then(setData);
}, []);
return <div>Custom Profile View</div>;
}
const override: OverrideDefinition = {
targetId: 'me',
component: CustomProfile,
};
export default override;Render Mode - UIGen fetches, you render:
// src/overrides/users-list.tsx
import type { OverrideDefinition, ListRenderProps } from '@uigen-dev/react';
const override: OverrideDefinition = {
targetId: 'users.list',
render: ({ data, isLoading }: ListRenderProps) => {
if (isLoading) return <div>Loading...</div>;
return <div className="grid">{/* custom UI */}</div>;
},
};
export default override;UseHooks Mode - Side effects only:
// src/overrides/analytics.tsx
import { useEffect } from 'react';
import type { OverrideDefinition } from '@uigen-dev/react';
const override: OverrideDefinition = {
targetId: 'users.list',
useHooks: ({ resource }) => {
useEffect(() => {
analytics.track('page_view', { resource: resource.name });
}, [resource]);
},
};
export default override;Configure in .uigen/config.yaml:
annotations:
GET:/api/v1/auth/me:
x-uigen-override:
id: meAdd payment processing declaratively. Supports Stripe, PayPal, Square. (Tested e2e with Stripe though)
x-uigen-payments:
providers:
- provider: stripe
publishableKey: ${STRIPE_PUBLISHABLE_KEY}
mode: test
currency: usd
pricingPage:
enabled: true
source: inline
products:
- id: free
name: Free
type: subscription
price: 0
interval: month
features:
- Up to 10 meetings per month
- id: pro-monthly
name: Professional
type: subscription
price: 2900
interval: month
highlighted: true
features:
- Unlimited meetings
- Priority supportGenerates pricing page at /pricing with responsive table, feature comparison, and payment buttons.
Payment Gates - Mark resources as monetized:
paths:
/api/v1/meetings:
x-uigen-monetized: true
post:
summary: Create meetingBackend enforces limits and returns 402 when exceeded. Frontend intercepts 402 and shows upgrade prompt automatically.
@router.post("/api/v1/meetings")
async def create_meeting(user: User = Depends(get_current_user)):
if user.plan == "free":
meeting_count = await get_user_meeting_count(user.id)
if meeting_count >= 10:
raise HTTPException(status_code=402, detail="Upgrade to create more meetings")
return await create_meeting(user, meeting)Override System:
File-based discovery from src/overrides/
TypeScript with full type safety
Works with any view type
No build step, dynamic imports on your overrides
Payment Integration:
Frontend-safe keys only (publishableKey exposed, secrets in .env)
Backend enforces limits
Webhook support for subscription events
Environment variable resolution with ${VAR_NAME} syntax
The Meeting Minutes example demonstrates both features.
git clone https://github.com/darula-hpp/uigen
cd uigen/examples/apps/fastapi/meeting-minutes
# Setup backend
docker compose up -d
# Add credentials to .env
echo "STRIPE_PUBLISHABLE_KEY=pk_test_..." >> .env
echo "GOOGLE_CLIENT_ID=your-client-id" >> .env
# Run
npx @uigen-dev/cli serve openapi.yaml --proxy-base http://localhost:8000The OAuth flow works end-to-end. Custom profile override shows component mode. Payment gates trigger on meeting creation. Pricing page is auto-generated.
Repo: https://github.com/darula-hpp/uigen
Docs: https://uigen-docs.vercel.app
Would be great to get your feedback. Seems like a "long" way to v1
r/FastAPI • u/Key-Asparagus5143 • Mar 08 '26
I made the cheapest web based ai with amazing accuracy and cheapest price of 3.5$ per 1000 queries compared to 5-12$ on perplexity, while beating perplexity on the simpleQA with 82% and getting 95+% on general query questions
For devaloper or people with creative web ideas
I am a solo dev, so any advice on advertisement or improvements on this api would be greatly appreciated
if you need any help or have feedback free feel to msg me.
r/FastAPI • u/Professional-Duck971 • May 28 '26
Hey r/FastAPI,
I got tired of manually fighting formatting layouts when trying to turn raw text snippets, messy PDFs, or unstructured documents into professional academic reports or resumes. Most cloud tools require you to hand over your private documents to external entities, which is a massive privacy risk.
So I built DocStream—a fully containerized, monorepo setup designed to process, stream, and automatically compile documents into perfectly structured LaTeX formats.
Here is how it works under the hood:
Frontend (Next.js / TypeScript): Handles file ingestion, template choices, and consumes live Server-Sent Events (SSE) for zero-latency UI updates.
Backend (FastAPI): Exposes async streaming pipelines.
Core Engine (Python Package): Built using a pluggable abstract `PipelineStage` architecture. It automatically analyzes factors such as text sizes to deterministically infer layout hierarchies, reducing unnecessary LLM token usage.
Templates (Lua/LaTeX Skeletons): Easily customizable skeleton wrappers for IEEE formats, resumes, and custom documents.
It includes full setup files for Docker Compose, Railway, and Vercel, so you can spin up your own instance locally or in your private cloud in minutes.
It’s completely open-source. I’d love to hear your thoughts on the pipeline abstraction pattern, get feedback on the formatting routers, or have you drop a star if you find it helpful!
🔗 Repo: https://github.com/YashKasare21/docstream-new.git





r/FastAPI • u/seamoce • Apr 04 '26
I’ve always wanted a way to transcribe my meetings, lectures, and voice notes without sending private audio to cloud providers like Otter or OpenAI. I couldn't find a simple "all-in-one" self-hosted solution that handled Speaker Identification (who said what) out of the box, so I built AmicoScript.

It’s a FastAPI-based web app that acts as a wrapper for OpenAI's Whisper and Pyannote.
Main Features:
🔒 Privacy First: 100% local processing. No audio ever leaves your server.
🐳 Docker Ready: Just docker compose up --build and it’s running on localhost:8002.
👥 Speaker Diarization: Uses Pyannote to label "Speaker 0", "Speaker 1", etc. (Optional, requires a HuggingFace token).
🚀 Performance: Supports models from tiny to large-v3. Background tasking ensures the UI doesn't freeze during long files.
📄 Export Formats: Download results in TXT, SRT (for video subtitles), Markdown, or JSON.
💾 Low Footprint: Temporary files are automatically cleaned up after 1 hour.
Tech Stack:
Backend: Python 3.10+, FastAPI.
Frontend: Vanilla JS/HTML/CSS (Single-page app served by the backend, no complex build steps).
Engine: Faster-Whisper & Pyannote-audio.
I’m still refining the UI and would love some feedback from this community on how it runs on your home labs (NUCs, NAS, etc.).
GitHub:https://github.com/sim186/AmicoScript
A note on AI: I used LLMs to help accelerate the boilerplate and integration code, but I've personally tested and debugged the threading and Docker logic to ensure it's stable for self-hosting.
Happy to answer any questions about the setup!

r/FastAPI • u/Potential-Box6221 • Mar 17 '26
Folks, ever wondered:
How to disable a feature for one customer but enable it for another?
Give limited access to one, unlimited to another?
Make your API behave completely differently per customer?
That's basically multi-tenant SaaS for you, where you configure features, workflows, etc at the tenant (customer) level.
I have noticed most FastAPI tutorials don't touch this, and many struggle to find the right structure/architecture.
It might sound complex, but the core idea is very simple - your app should know which customer(tenant) is calling and behave accordingly. (Usually achieved by Tenant-Id and configuration at tenant level)
I have been building production-grade multi-tenant services like these and have a rough template that I rely on every time to spin these up!
So I thought if you guys are interested, I can polish it up and share it here. Let me know!
Edit: Here the customer in this context means a business/org (B2B) and not a single user.
r/FastAPI • u/International-Rub627 • Apr 02 '25
I try to query GCP Big query table by using python big query client from my fastAPI. Filter is based on tuple values of two columns and date condition. Though I'm expecting few records, It goes on to scan all the table containing millions of records. Because of this, there is significant latency of >20 seconds even for retrieving single record. Could someone provide best practices to reduce this latency. FastAPI server is running on container in a private cloud (US).
r/FastAPI • u/indeem1 • Jun 03 '26
Made a JetBrains plugin so I can stop alt-tabbing to Postman while building APIs
Every time I wrote a new endpoint I’d switch to Postman, dig through the collection, update the URL, create the body… just to do a quick test. Annoying enough that I finally did something about it.
Sonarwhale reads your OpenAPI spec and shows all your endpoints directly in PyCharm. Gutter icon next to the route, click it, create the request, hit send.
Works great with FastAPI and Flask — automatically discovers endpoints from your OpenAPI/Swagger spec, supports pre/post scripts for auth and request prep, multiple environments, and Postman import.
Most features are free to use and there’s a free trial period as well. Feedback very welcome.
r/FastAPI • u/Padmini23 • May 17 '24
Hi,I am completely new to this technology. I have built an API using FastAPI and a MySQL database. However, I am unable to understand how to deploy it. Could someone please explain the deployment process or assist me in resolving this issue?
Thank you
r/FastAPI • u/danosull • Jun 03 '22
r/FastAPI • u/dcbrown73 • Apr 20 '23
Hey all.
I'm new to FastAPI and somewhat async coding in general.
I've created a routed url and the associated function is an async function. The application is complaining that the "validate_address" coroutine was never awaited.
For reference, this uses FastAPI & httpx libraries.
@address_router.get("/validate_address")
@validate_token
async def validate_address():
from models.globals import FEDEX_AUTH_TOKEN, CONFIG
from utils.tools import build_validation_request_schema, generate_transaction_id
_url = CONFIG.get("FEDEX_CONFIG", 'address_validation_api_url')
_data = build_validation_request_schema()
_headers = {
'x-customer-transaction-id': generate_transaction_id(),
'Content-Type': "application/json",
'X-locale': "en_US",
'Authorization': "Bearer {}".format(FEDEX_AUTH_TOKEN.access_token)
}
async with httpx.AsyncClient as client:
response = await client.post(_url, headers=_headers, data=_data)
return response.textI'm unclear the proper way to resolve this given a API request came in and was routed to this function / coroutine under the hood.
I'm unclear as to how / where I'm supposed to await this method especially given the fact that the response is sent to the API requestor.