In a previous post, I talked about my tech stack that lets me quickly start projects and has a good developer experience. Over the second half of last year, however, I started exploring new technologies to add to my stack. I used them to build a couple of projects and breakable toys that I'm excited to tell you about.
As a recap, this was my tech stack last year:
- Chakra UI for pre-built components
- MongoDB as the database
- ESLint + Prettier + Husky for linting and prettifying my code
- SWR for calling API routes and caching
- Formik + Yup for form handing and validation
- Mailgun for transactional emails
- Vercel/Netlify for deployments
Here are the changes to the stack for 2022:
For a long time, I was skeptical of TypeScript. But I realized that TypeScript is here to stay and that I might as well learn it. The reason is because a lot of NPM packages and popular applications are written in TypeScript. If I want to contribute to or debug one of those packages, I need to know TypeScript. I've also heard TypeScript developers talk about having a peace of mind because it's catching issues early.
MongoDB to PostgreSQL/MySQL
I learned a bit of Postgres last year and decided to start using it for my projects. Setting up MongoDB on AWS was required a bit of work to get started. But there was another glaring issue with a monolithic database. Since Next.js is deployed as serverless functions, my applications were creating too many connection requests to the MongoDB instance. This was causing crashes.
Deploying Postgres on AWS might have the same problem but I never got to that point. I learned about Supabase and got hooked instantly. They have great official and community-supported SDKs, work great with Next.js and serverless functions, and their API is so easy to use. Supabase also has an authentication library! Plus they have a generous free account.
While I loved Supabase, there were missing features. The product is still new so I'm sure they'll add it over time. I also wanted to pick up some more technologies in this space. So I turned to Prisma. If you're a Node.js developer, you've probably heard of Prisma. It's an ORM for Node.js, has first-class support for TypeScript and is super fun to use.
For the actual database, I started exploring Planetscale and boy do I love it! Planetscale uses MySQL and is made for serverless applications and microservices. I especially love the git-like workflow in Planetscale. Planetscale lets you manage changes to your database schema, like you would your code with git. You can create branches for schema changes, and merge them to production without your database ever going down.
More about how to set up Planetscale with Prisma and Next.js in an upcoming post. So give me a follow/subscribe if you'd like to be notified when it comes out.
If you've used Next.js, you've heard of NextAuth. It's an authentication library for Next.js applications. Currently in v4, NextAuth supports several authentication mechanisms (passwordless, OAuth) and connects with multiple databases. It's quite flexible and has great documentation.
Next.js to Next.js/Remix
When Remix went open-source in December, I started playing with it immediately. Remix is built by the folks behind
react-router. Like Next.js, Remix is also a meta-framework. It uses React under the hood (for now. Remix wants to be a web framework and not be tied to React).
After going through their jokes app tutorial, I gotta say that Remix has some great features. It's quite different from Next.js but so far I like it enough to start using it for projects. I'm not gonna drop Next.js completely since I've to maintain my existing projects that are built in Next.js. But I'm gonna use Remix for a couple of new apps this year.
Those are the changes to my tech stack for 2022. The rest of the stack stays pretty much the same. Have you picked up any new technologies that you're excited to use this year? What would you like to learn this year that will improve your work?