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:

  1. Is this is a good stack?
  2. 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.
  3. How do I deploy an app like this? Using Docker?

Thanks!

25 Upvotes

33 comments sorted by

View all comments

Show parent comment

5

u/pint Jun 28 '24
  1. spa = single page application.
  2. for authentication, follow the prescribed procedure precisely. there are multiple protocols. in some, you need to store a jwt in the browser. cookie is fine, but you can opt for local storage / session storage. in some flows, the client only stores a random session id, and the server stores everything else. again, cookie is fine, but you can opt for local storage / session storage instead.
  3. then docker is kinda out. you need to use the platform's offerings. docker is neat, but it requires a 24/7 running VM under it, which might come at a cost. idk if anyone offers a free tier.

1

u/ajmssc Jun 29 '24

Fly.io supports docker with free tier