Dev Log 01 - Sprint Padawan v2
What are these?
These Dev Logs act as a way for me to get my thoughts and reasons behind the changes to projects I work on down somewhere myself and others can reference down the line.
2.0?! What’s new?
Under the hood, EVERYTHING! Sprint Padawan hit version 2, and with it comes HUGE changes in the background. Those are:
- Moving to serverless Postgres from Neon.tech
- Moving Auth to Clerk, enabling much better user management and removing some unneeded tables in my DB
- Moving to Drizzle for the ORM vs Prisma, which provided HUGE gains in performance
- Re-architecting to using Middleware for auth, rate-limiting, and API key validation
So… the DB
Why did I make this move? Quite frankly, it came down to flexibility. Neon.tech allows for 20 projects with unlimited DBs per project on the pro plan. Planetscale, while a wonderful product, has only 3 projects available on its free tier, and no pay-as-you-go plan. So its 30 bucks to experiment. That or make multiple accounts, each with a different CC attached. Also, Postgres had better support from Drizzle, and the lack of foreign key constraints in Planetscale makes deletions annoying (no cascade).
No self-hosted auth?
Nope. Never doing this again. Managing users in a scalable and responsible way is HARD. Combine that with Auth.js’s slow progress and lack of edge support and it was not working. Clerk is an AMAZING product and I will gladly shill for them anytime.
Drizzle who?
Drizzle is a newer ORM which provides barely any overhead over raw SQL, making it ideal for performance. The lack of gode-gen combined with the convenience of drizzle-kit + drizzle studio make it a no-brainer!
Middlewhat?
Middleware… this is something I was not using previously. It sits between any client and function and ensures that the checks needed are run. In this case: auth, rate-limiting, and API key validation! It makes it easy to apply this logic without boilerplate in every function!
And theres more!
To cement all of these changes, I made a template based on Sprint Padawan here. If you would like to try this stack, feel free to fork from the template!
I hope this was helpful! As usual, if you have any questions, please reach out over email.