steakfisher
TTCTheo's Typesafe Cult
•Created by Jimmy Page on 12/27/2024 in #questions
JWT with long-lived Refresh Tokens
if u have an access token valid for 5 mins, and a refresh token valid for 365 days
blacklisting the refresh token, u gotta store the blacklisted value for an entire year.. by which time a lotta blacklists could've happened, so storing it in an in memory database isnt really possible
On the flip side, blacklisting the access token is only necessary for 5 mins, which IS possible in an in memory database.. AND u get the added benefit of instant token revokability..
A Redis lookup isnt really all that time consuming when u really consider things
SO doing both.. the refresh token in a proper database, whereas the access token in an in-memory database works well
Now this is just an educated guess which sorta takes into account ur specific guess.. how they REALLY go is hidden for security reasons.. but they could be using smth like this in combination with "security contexts" that they keep track of to pull this off
61 replies
TTCTheo's Typesafe Cult
•Created by I'm Not An Engineer on 12/28/2024 in #questions
Are Serverless functions the right thing for me?
ok we make a lotta assumptions about ur tech stack here
We're assuming ur using react
SINCE ur using react we're gonna assume ur using NextJS cuz its the "best" meta framework for React
SINCE ur using NextJS we assume ur using Vercel cuz it's objectively the best way to deploy a NextJS application
NOW u could go down the JSON route.. which is PERFECTLY valid for such a use case cuz ur the only one who is writing data, so u just rebuild the entire website whenever u wanna add a new keyboard (yes its just a git push cmd)
OR U could go down the db route.. which might not be necessary.. at least not at ur scale
now IF you go down the JSON route.. u could use Vercel Edge Servers... Vercel edge servers is basically just ur code spun up at a million different locations.. and since u dont have a database call, NOR will ur code require tm complicated libraries.. edge servers would be easy to setup AND really performant
24 replies
TTCTheo's Typesafe Cult
•Created by I'm Not An Engineer on 12/28/2024 in #questions
Are Serverless functions the right thing for me?
whats the alternative to a Database? a JSON file? honestly valid for such a use case.. the only problem would be.. you'd need to redeploy everytime u make a change to the JSON file.. other than that ur good
24 replies
TTCTheo's Typesafe Cult
•Created by I'm Not An Engineer on 12/28/2024 in #questions
Are Serverless functions the right thing for me?
u could host ur database in EU, and then cache the response for like a ridiculously long time, so the FIRST request would have to come all the way to EU but subsequent requests would be served from not too far
replicating servers into multiple regions is not a good idea in general.. that was the thought behind Vercel Edge servers.. but that has a lotta problems u initially dont realize
https://www.youtube.com/watch?v=yOP5-3_WFus&pp=ygUNZmlyZXNoaXAgZWRnZQ%3D%3D
Fireship explains it really well in this vid
u ideally should have 1 central server, 1 database as close as possible to that server, and then aggressively cache the responses from there
24 replies
TTCTheo's Typesafe Cult
•Created by I'm Not An Engineer on 12/28/2024 in #questions
Are Serverless functions the right thing for me?
not necessarily? but if ur gonna build ur frontend out in react.. NextJS would be ur best (easiest) bet
24 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
thats the only solution I can think of tbh
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
a VERY messy solution for this could be making dashboard a dynamic route.. so that it ACCEPTS any child routes.. but regardless of the child route u can return a Dashboard 404
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
it can have getStaticProps btw
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
k so apparently whats happening is
U make a req for dashboard/blah, the server takes it, realizes the url doesnt exist, redirects u to /404 and then returns the html for 404 to the client
But the client RECEIVING the html for that 404 page is still on dashboard/blah hence both of them have a different asPath, and hence the html returned by the server doesnt match the one being rendered on the client..
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
lemme see if I can figure smth out..
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
good god
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
also theres a decent chance a "use client" at the top MAY fix ur issue.. but not sure tho
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
while the client thinks its on dashboard?
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
y does the server think the user is on 404
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
do u know why..?
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
wait can u explain WHY it does that?
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
k so thats the problem.. lemme see how we can fix that
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
hold up.. so its logging 404 in the server and dashboard in the browser?
43 replies
TTCTheo's Typesafe Cult
•Created by Casal0x on 8/17/2023 in #questions
Custom 404 page with multiple layouts
ye thats cuz its a server component
43 replies