I have been a full-stack developer for the last decade, building smaller projects like gitup and bigger projects like crosspublic.
Over the years, I have tested different tools to:
Be more productive
Have fewer bugs
Write less code
I have curated a list of libraries to help you develop great NextJS
stuff that I am using daily with an explanation of what you can do with
them. Let's dig in.
Prisma is not NextJS-specific. It's an ORM to work with your database.
ORM is a unified wrapper for DB queries.
It keeps a good structure and lets you quickly change between different database providers.
While there are a lot of ORMs you can use, Prisma is unique by
offering Typescript support for your queries, making everything 100x
faster. NextJS imbraced typescript in their default configuration,
making it a perfect match.
SEO is the process of making your website appear on the google feed
for different queries by providing keywords, descriptions, and images to
your website preview.
If you use the new NextJS app router, you might not need to use it.
You can use their export metadata approach or generateMetadata
but if you use the old app router, that's the best way to add SEO to your website.
Zod is an object validator (both server and client).
You can put different rules on an object and validate it later, such as
username and password, or more complex things like the array length or
conditions on other keys. Zod is not NextJS specific.
Over the years, I have seen a lot of object validators, such as Yup and class-validator.
Yup, it looks not as maintained as Zod, and the class-validator is
powerful when using things like NestJS - so you best go with Zod.
I would admit that I have never used tRPC before, but it looks like it's getting a lot of eyes today.
It has a similar concept as Prisma; they generate an interface for
your request and response, so when you use frontend calls, you get that
autocomplete.
That's great because it reduces the chance of bugs - let's say you
modified a backend route, you won't be able to compile the project - the
client will return an error of nonexisting parameters or response keys.
It's a library for mutating data, and while JavaScript progressed a lot
during the years with excellent native functions like flatMap, there are
still things that are missing, such as unique array by key or chunking
and array.
I find myself using lodash for almost any project.
day.js is a library for everything related to dates, formatting, timezones, etc.
I might get roasted for that one. I have been working with moment.js for years.
Now that it's not maintained anymore, dayjs is a good alternative.
Some people prefer the new JS functions to deal with dates, but I
still feel a significant gap exists between the dayjs options and the
native JS date functions.
This is not a must, but I have been using it lately for many projects as an alternative to cheerio.
You can take an entire page content (<html><body>β¦.</html>) and turn it into an object you can manipulate later with the βnativeβ javascript dom functions querySelector, innerHTML, etcβ¦