r/FastAPI • • Dec 22 '24

Question Pivot from Flask

Hey everyone,

I recently built an app using Flask without realizing it’s a synchronous framework. Because I’m a beginner, I didn’t anticipate the issues I’d face when interacting with multiple external APIs (OpenAI, web crawlers, etc.). Locally, everything worked just fine, but once I deployed to a production server, the asynchronous functions failed since Flask only supports WSGI servers.

Now I need to pivot to a new framework—most likely FastAPI or Next.js. I want to avoid any future blockers and make the right decision for the long term. Which framework would you recommend?

Here are the app’s key features:

  • Integration with Twilio
  • Continuous web crawling, then sending data to an LLM for personalized news
  • Daily asynchronous website crawling
  • Google and Twitter login
  • Access to Twitter and LinkedIn APIs
  • Stripe payments

I’d love to hear your thoughts on which solution (FastAPI or Next.js) offers the best path forward. Thank you in advance!

10 Upvotes

12 comments sorted by

View all comments

Show parent comment

3

u/adiberk Dec 22 '24

To me what you are describing should not be a process that exists entirely in an endpoint. I would imagine instead, like you said. That you return certain required information so that your Frontend can either pull data (or setup websicket) on an interval, waiting for the process to c omplete.

A process such as the one you described is a great use case for separating it into a job and waiting for the job to complete in a different process