yanncabral.dev/writing/The smallest useful Next.js setup
Back
Next.js

The smallest useful Next.js setup

YCYann CabralMay 20254 min readminimal

The more I ship, the less I reach for. Here's the whole dependency list for my last three Next.js projects.

The list

  • next
  • react / react-dom
  • drizzle-orm
  • zod

That's it. No tRPC, no NextAuth, no Prisma, no TanStack Query.

Server actions handle the RPC

export async function createTask(data: FormData) {
  "use server";
  const input = TaskSchema.parse(Object.fromEntries(data));
  await db.insert(tasks).values(input);
  revalidatePath("/");
}

Cookies handle the auth

Set an HTTP-only JWT, verify it in a middleware, get on with your life. If the app grows past one table of users, swap in a library. It probably won't.

Every dependency is a future migration. Start without it and add it when the pain is real.

More posts