noob question - data flow in app / app architecture

Hey folks! I want to expand my knowledge and get some experience with databases and how to properly handle the data. I am using the full T3 stack, and planetscale for DB. The app which I am building should be an trading journal. So basically, the user will submit his read only api keys from the given exchange, the app will load all the relevant data, store them in the database and then work with them in some calculations. And thats exactly what I need help with - how should the data flow look like in order for the app to be efficient and also the database is not called every single time. My initial thoughts how this should look like: 1. the user submits the keys, API's are called (the user has to then manually trigger the import again to call the APIs and refresh data) 2. The data is processed and only relevant pieces which will be used in the components are stored in the database and also the pushed into the components to show the statistics Now, what to do when the users comes back? - Should I call the database again when the page is refreshed? - Should I maybe store the data in localStorage or some server cache? (not sure if this is thing from security standpoint) With calling the data from database again then the user re-enters the site I am worried about two things; - the speed of the app (how long it will take to get the data and render the components)
- how many reads this will consume from the monthly limit Maybe I should cache the results on the server for some time (1 hour?) so that the database is not called everytime the page is being refreshed? Yeah so basically I am having a hard time wrapping my head around how this should all work in an ideal scenario. Thank you.!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server