r/FastAPI • • Aug 15 '22

Question raw Flask vs FastAPI ?

4 Upvotes

According to tech empower benchmark, if I use Flask without ORM library, it performs faster than FastAPI. Raw Flask could handle 13,574 requests per second. FastAPI could handle 12,406 req /s. Flask with an ORM library could handle only 552 req /s.

Do you guys think this is true? is Flask still faster than FastAPI? then develoeprs can stick with Flask with raw SQL queries.

Here's a link to flask-raw github repo:

https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Python/flask/app_raw.py


r/FastAPI • • Oct 26 '22

Other FastAPI - Open-Source Starters / MIT / Mini Stripe eCommerce APP / Soft Dashboard Design

Thumbnail
blog.appseed.us
7 Upvotes

r/FastAPI • • Oct 25 '21

Question does tiangolo in a vacation or something?

0 Upvotes

No activity on any of the repos in the last 18 fays, it seems little bit unusual considering the past update cadence, is fastapi still being actively developed?


r/FastAPI • • Jun 07 '26

Other Built a production- style LLMOps Gateway using FastAPI

7 Upvotes

Link: https://github.com/vikramanand05/llmops-gateway

Built an open-source LLMOps Gateway inspired by Portkey and Langfuse. Includes FastAPI, React dashboard, Docker, Kubernetes, Prometheus, Grafana, CI/CD, and AWS deployment patterns. Looking for contributors interested in AI infrastructure and observability.


r/FastAPI • • Jan 24 '26

Tutorial How to Connect FastAPI to PostgreSQL

Thumbnail
thirdygayares.com
11 Upvotes

r/FastAPI • • Jun 18 '26

feedback request I built a production-grade Async Redis Proxy that blocks Cache Stampede and prevents SSRF attacks.

8 Upvotes

I built a production-grade Async Redis Proxy that blocks Cache Stampede and prevents SSRF attacks. Open sourcing it today to get your some feedbacks!

What My Project Does

This project is an asynchronous proxy caching server built from scratch using FastAPI, Uvicorn, redis.asyncio, and httpx. It intercepts HTTP requests, caches responses in Redis based on configurable TTLs, and implements advanced software engineering patterns to handle high-concurrency bottlenecks and network security flaws.

Key architectural features include:

Cache Stampede Mitigation (Request Coalescing): Utilizes a custom SingleFlight pattern via asyncio.shield. If 1,000 concurrent requests hit a cache miss for the exact same URL, only 1 request goes upstream. The other 999 callers await and share the same result safely, preventing upstream service degradation (Thundering Herd problem).

Hardened Security (SSRF Protection): Includes a strict validation layer that drops requests targeting localhost, 127.0.0.1, or private IP ranges (RFC 1918), mitigating Server-Side Request Forgery before httpx touches the network.

Graceful Circuit Breaker (Fail-Open): If the Redis instance becomes unavailable, the proxy handles a seamless fail-through scenario, bypassing the cache layer completely and letting traffic flow directly to the upstream API without raising 500 Internal Server Error.

Production Containerization: Fully dockerized with a docker-compose.yml configuring Redis with an explicit memory cap (--maxmemory 100mb) and an LRU eviction policy (--maxmemory-policy allkeys-lru) to guarantee memory stability.

Performance Optimization: Powered by orjson for fast JSON serialization and deserialization.

Target Audience

This project is desgined for production environments and backend engineers managing high-traffic microservices. It is specifically aimed at scenarios where upstream APIs are fragile, expensive, or prone to failure under sudden traffic spikes, and where infrastructure security (SSRF prevention) is a hard requirement.

Comparison

Unlike basic, "tutorial-tier" Redis wrappers or simple FastAPI caching middlewares that only store key-value pairs, this proxy actively manages concurrency at the application layer.

Traditional caching solutions often suffer from Cache Stampede when keys expire under heavy load, causing a bottleneck on the upstream database. By implementing the SingleFlight pattern directly into the async event loop, this implementation guarantees that duplicate concurrent requests never stack up. Additionally, most standard proxies leave the responsibility of SSRF protection to external firewalls, whereas this solution integrates network boundary validation directly into the request cycle.

GitHub Repository: https://github.com/Jacopos311/redis-async-proxy


r/FastAPI • • Aug 04 '26

Hosting and deployment I've been building a small open-source project called FastStrapy

9 Upvotes

I've been building a small open-source project called FastStrapy over the past few weeks, and I'd love some feedback from the Python/FastAPI community.

The idea came from repeatedly recreating the same FastAPI project structure every time I started a new API. Copying folders, configuring environment variables, setting up Alembic, wiring configuration—it became repetitive.

So I built a CLI inspired by create-next-app that generates a FastAPI project through an interactive prompt.

Some of the design choices:

  • Typed project configuration using Pydantic

  • Registry-based generator architecture

  • Jinja2-powered templates

  • Typer-based CLI

It's still very early (v0.1), so I'm more interested in feedback than promotion.

A few questions I'd love your thoughts on:

  • What features would you expect from a FastAPI scaffolding tool?

  • Is there anything about the generated structure you'd change?

  • Are there existing tools you think I should learn from?

GitHub:
https://github.com/AnoopGeorge418/faststrapy

Constructive criticism is very welcome. I'd rather improve the project now than after it grows.


r/FastAPI • • Jan 03 '25

Hosting and deployment FastAPI debugging using LLMs?

12 Upvotes

Would anyone consider using LLMs for debugging a production FastAPI service?

If so, what have you used/done that brought success so far?

I’m thinking from super large scale applications with many requests to micro services


r/FastAPI • • Jan 18 '26

Other 🚀 I built FastAPI Blogs & Tools Directory — a curated resource hub for FastAPI-related content, blogs & open-source tools

12 Upvotes

I’ve been deep into FastAPI for a while and noticed how much great content is scattered across blogs, repos, and other community projects. Sometimes it’s hard to discover high-quality posts, tutorials, or tools unless you already know they exist — so I built something to help with that.

👉 FastAPI Blogs & Tools Directory — https://fastapiblogs.fly.dev/

What it does

This site is a curated directory of:

  • 🔗 Blog posts & tutorials about FastAPI

  • 🛠️ Tools, libraries, and starter kits on GitHub or elsewhere

  • 📚 Helpful resources for learning, building, and deploying FastAPI apps

Instead of digging through search results or bookmarks, you can browse by topic and discover content others have shared. It’s open-source and community-focused — not a commercial project.

How it helps the community

  • 📍 A single place to find interesting FastAPI content

  • 🧠 Helps newbies and experienced devs alike discover articles, guides, and tools

  • 🤝 Encourages authors to share their work and get visibility

  • 🛠️ All links point to original sources — no scraping or reposting of full content

Built with community in mind

The idea came from seeing posts like “I built X, what do you think?” where people share projects and ask for feedback, and the community actively engages. I’d love to get your thoughts on:

  • What categories or tags you think should exist

  • Good FastAPI blogs or repos that are missing

  • Ways to improve the browsing experience

I’m happy to expand this into something more collaborative (e.g., letting users submit links) if there’s demand for it.

Thanks for reading — excited to hear what you think! 🧡


r/FastAPI • • Nov 28 '25

Question Feeling Lost in CS College — Want to Shift Toward Python, Automation, and Freelancing

5 Upvotes

I’m a computer science student in Algeria, but I no longer feel that studying CS in college is worth the time and energy it takes, even though it provides fundamentals. I’ve spent the last two months thinking about learning Python and automation (using tools like n8n) to start freelancing and eventually build an agency. I regret not starting earlier at home, but my exams are close, so I plan to begin after they end. I don’t enjoy college, but I feel obligated to continue for practical reasons. I don’t want a lifelong 9-to-5 career; I want to build my own path, even if I work a regular job temporarily. I feel lost because studying has been my whole routine for years. I’d like advice from Python or automation specialists and hope to ask a few questions.


r/FastAPI • • Jun 13 '26

feedback request Made a simple tool to map out FastAPI routes because I keep getting lost in my own AI-generated code

Thumbnail
youtube.com
0 Upvotes

AI wrote 3,000 lines of my FastAPI backend in 5 minutes.

I wrote a CLI because I had no idea how any of it connected together. It scans your project and generates an interactive graph of routes → function calls → DB access. Great for debugging AI-generated code.

I tried using tools like "Understand Anything" to map it out, but it burned through 20M tokens and still couldn't give me a clear picture of how everything connected.

npx api-understanding scan /path/to/your-fastapi-project npx api-understanding dashboard analysis.json

Or just run npx api-understanding demo to see it in action

GitHub: https://github.com/IntegerAlex/understand-anything-better Video walkthrough: https://www.youtube.com/watch?v=cGLzNSMqpbo

It's open source and still a bit rough around the edges, but it works for me. Let me know what you think or drop a bug report if you find one.


r/FastAPI • • Mar 28 '25

Hosting and deployment FastAPI code deployment issue

0 Upvotes

I have created FastAPI to automate my work. Now I am trying to deploy it.

I am facing trouble in deployment, the code is working well in local host. But when I am trying to integrate it with Node.js the code isn't working

Also what is the best way to deploy FASTAPI code on servers

I am new with FastAPI kindly help


r/FastAPI • • May 16 '25

Question Looking for a car dataset

2 Upvotes

Hey folks, I’m building a car spotting app and need to populate a database with vehicle makes, models, trims, and years. I’ve found the NHTSA API for US cars, which is great and free. But I’m struggling to find something similar for EU/UK vehicles — ideally a service or API that covers makes/models/trims with decent coverage.

Has anyone come across a good resource or service for this? Bonus points if it’s free or low-cost! I’m open to public datasets, APIs, or even commercial providers.

Thanks in advance!


r/FastAPI • • Jan 06 '23

Question Backend security

3 Upvotes

I have a backend in fastApi that serves an app. How would I secure the API?
Right now it's hosted on a remote server and everyone with an IP address can access it. I want to lock it down, but how can I require Auth on the API when the users are using this API to register?

I have auth in my application and it works fine, however i want to lock down the /docs and /redocs


r/FastAPI • • Aug 30 '24

Question Learning curve without python experience

2 Upvotes

Hey there, Just got an introduction interview in 4 days from now for a position of fullstack. In backend they use FastApi. Which I’ve seen people working with in my current company but never used it. Also I didn’t touch python since university (3 years ago). I was wondering about the learning curve for FastApi. Can I be prepared for my live coding interview by the end of next week or if I’m lucky the weeks after?


r/FastAPI • • Jan 04 '24

Question Handling asynchronous requests

2 Upvotes

Does pydantic handle asynchronous requests automatically with FastAPI? Which is the correct way to do this:

async def create_order(request: Request):
    body = await request.json()
    order = schemas.OrderCreate(**body)
...

or this:

async def create_order(order: schemas.OrderCreate): 
    ...

r/FastAPI • • Dec 04 '24

Question Newbie learning fast api

0 Upvotes

Async def login(request: LoginBase) If i use the above one for login api it works fine but when i change to below one it gives me 422error and in swagger when i check my api, it has some extra parameters as arg and kwarg which are required so can any one help me out to solve this and remove arg kwargs, i just need username password to do login.

Async def login(request:OAuth2PasswordRequestForm, Depends())


r/FastAPI • • Aug 22 '24

Question Can someone help me out to create this API?

0 Upvotes

There is this account that 24/7 live the bitcoin price / buy & sells / liquidations streams. I heard that he does that thru the Coinbase API (crypto exchange). Can someone help me with this, i have 0 experience with APIs but do you think i could create this?
youtube link: https://www.youtube.com/@BitcoinLIVEyt

Hope someone can help me out a little!

Kind regards,

Martijn


r/FastAPI • • Dec 07 '23

Question Nood with Fast API here

0 Upvotes

Hey guys, im a noob with fast api. I have a really simple app thats letting some LLM's post data to and from a chromaDB. I intend to dockerize it, and this is meant to be an extrapolation layer.

but for some reasonI am getting a 404 on the routes i am trying to apply (i come for dotnet mvc so sorry i used the wrong terms)

Maybe someone can tell me why one works and one doesnt ? it doesnt seem logical, so i assume there is some idosyncrasis that im missing

For example this works

@ app.get("/collections/")async def list_collections():return {"collections": collections_list}

But this doesnt, ive stripped it down to not accept any input in a vein attempt to troubleshoot. Its not hitting any of the lines in the r_data at all, nor the original which was /retrieve/ def retrieve_data which took arguments.

@ app.get("/pulldata/")async def r_data( ): #= Query(5, ge=1, le=100)collection_name = "example_collection"query = "example_query"return_size = 1print(collection_name)print(query)  try:# Retrieve data from the specified collection with the specified return sizetry:collection = client.get_collection(name=collection_name)except Exception as e:raise HTTPException(status_code=500, detail={"Col not found error": str(e)})                    result = collection.query(query_texts=[query], n_results=return_size)        return {"context": [x['documents'] for x in result]}except Exception as e:        raise HTTPException(status_code=500, detail={"error1": str(e)})

INFO: Started server process [2578081]

INFO: Waiting for application startup.

INFO: Application startup complete.

INFO: Uvicorn running on http://0.0.0.0:8500 (Press CTRL+C to quit)

INFO: 192.168.0.94:60474 - "GET /pulldata HTTP/1.1" 404 Not Found

INFO: 192.168.0.94:60474 - "GET /pulldata/ HTTP/1.1" 404 Not Found


r/FastAPI • • Sep 21 '23

Question Running localhost

Post image
0 Upvotes

Learning how to use docker/fastapi but running into an error saying:

from ..queries.signup_query import create_signup_form ImportError: attempted relative import beyond top-level package

Am I missing something?


r/FastAPI • • Jun 08 '23

Question How to integrate a custom API into a web app? Is it advisable?

2 Upvotes

Consider a scenario where there is an API designed to retrieve user data from a database. What is the best approach to utilizing it within a web app? One option is to fetch the data on the client side and display it, but this may lead to sluggish performance. Another option is to fetch the data through the API on the server side, incorporate it into an HTML file using a templating engine, and then send it to the client. However, this approach may also result in performance issues. Alternatively, the data could be directly retrieved from the database and embedded without utilizing an API.

The discussion here is limited to the specific case of retrieving data. It is worth noting that APIs, such as the ChatGPT API, serve a broader purpose beyond simple data retrieval. They involve processing capabilities, which OpenAI's team has integrated into their web app to enable client interaction.

Hence, the question at hand is: Do APIs primarily serve the purpose of providing/selling data when direct access to the database is undesirable? Any assistance on this matter would be greatly appreciated.


r/FastAPI • • Nov 01 '23

Question Following a tutorial and they are showing the modules get auto imported through intellisence on VSCode; however its not working on mine.

0 Upvotes

Anyone have a a solution to this issue?

VScode Settings

{
  "workbench.iconTheme": "material-icon-theme",
  "editor.wordWrap": "bounded",
  "files.autoSave": "afterDelay",
  "prettier.htmlWhitespaceSensitivity": "strict",
  "editor.rulers": [80],
  "explorer.compactFolders": false,
  "editor.minimap.enabled": false,
  "liveServer.settings.donotShowInfoMsg": true,
  "javascript.preferences.quoteStyle": "single",
  "prettier.jsxSingleQuote": true,
  "prettier.singleQuote": true,
  "workbench.colorTheme": "Panda Syntax",
  "editor.formatOnSave": true,
  "editor.formatOnType": true,
  "editor.tabSize": 2,
  "liveServer.settings.donotVerifyTags": true,
  "window.zoomLevel": 1,
  "terminal.integrated.fontFamily": "JetBrains Mono",
  "editor.fontFamily": "JetBrains Mono",
  "editor.fontLigatures": true,
}

r/FastAPI • • Dec 26 '21

Hosting and deployment How do I deploy react + fastapi on same heroku server ?

Thumbnail self.learnprogramming
2 Upvotes

r/FastAPI • • May 16 '22

Question please help me aout fastapi/sqlqlachemy question

Thumbnail
stackoverflow.com
2 Upvotes