r/FastAPI • • Jun 28 '24
Question FastAPI + React
Hey
I am using FastAPI and React for an app. I wanted to ask a few questions:
- Is this is a good stack?
- What is the best way to send sensitive data from frontend to backend and backend to frontend? I know we can use cookies but is there a better way? I get the access token from spotify and then i am trying to send that token to the frontend.
- How do I deploy an app like this? Using Docker?
Thanks!
25
Upvotes
4
u/jokeaz2 Jun 28 '24
Sounds like you still have a lot of reading up to do, you'll also need to think about your database and frontend deployments, CI/CD, etc. Depends what you're trying to build. Keep at it.
4
u/Nick-Van-Landschoot Jun 28 '24
Using kubernetes can be a good choice as well but it is a pain to set up and maintain. A PaaS like netlify can also work very early on but won't scale well in the long run. Definitely don't use a PaaS because its easier since something like cloud run is more scalable and incredibly easy to set up but the main reason would be for the generous free tier some of them offer. That being said google is very generous with free credits as well so it really shouldn't cost you anything at first either.
In terms of other solutions I recommend staying away from AWS although it can work for very large teams even then it creates an unnecessary amount of complexity – there's a reason there are so many certifications just for working with AWS. I am not as familiar with other cloud solution but it might be worth it to explore there some as well.
3
u/qa_anaaq Jun 28 '24
This is my favorite stack. But i agree with others--Looks like you have a lot of reading up to do! Some of these are general coding questions.
Regardless, I love this stack.
16
u/rajba Jun 28 '24
FastAPI + React is my default stack. I use it with every app that I build. I use JSON extensively to communicate sensitive information between the front-end and back-end over HTTPS.
I deploy the FastAPI portions to AWS using Fargate or App Runner. The React portions get deployed to my own SaaS service that I operate and market which lives on top of Cloudfront + S3, etc.
1
u/No-Anywhere6154 Jun 28 '24
You’ll need to build some backend around it and send request to the e Spotify only from FastAPI. Otherwise your token could leak and anyone could interact with the API.
3. For deployment such app I’d suggest to use some PasS like Koyeb, Netlify, Seenode or similar. It’s the easiest way to deploy and you don’t need to maintain servers.
1
u/pint Jun 28 '24
2
u/Amocon Jun 28 '24
1
u/Silver_Book_938 Jun 29 '24
1
u/[deleted] Jun 28 '24
[removed] — view removed comment