M
nextjs-template
Next.js · React · Turbopack

The Production-Ready Next.js Template

A scalable, feature-based architecture with authentication, database ORM, and code quality tooling already configured. Stop boilerplating, start building.

terminal
$ git clone https://github.com/MicrowebPG/nextjs-template.git
$ npm install
$ npm run dev

Tech Stack

Everything you need, nothing you don't

A carefully curated set of tools and libraries that work together seamlessly, so you can focus on building your product.

Next.js 16

Latest App Router with Turbopack for blazing-fast builds and HMR.

Better Auth

Email/password auth with role-based access control and session management.

Prisma ORM

Type-safe MySQL database access with custom client generation and migrations.

Tailwind CSS v4

Utility-first CSS framework with enhanced performance and design tokens.

Shadcn UI

Beautiful, accessible React components with New York styling variant.

TypeScript

Full type safety across the stack with strict mode enabled.

Husky + Commitlint

Enforced conventional commits and pre-commit hooks for code quality.

ESLint 9

Flat config with Next.js Core Web Vitals and Prettier integration.

Architecture

Feature-based, scalable by design

Each feature is self-contained with its own components, types, constants, and business logic. Easy to maintain, easy to scale.

Project Structure
src/
├── app/
├── api/auth/[...all]/
├── globals.css
├── layout.tsx
└── page.tsx
├── features/
├── auth/
├── components/
├── lib/
├── types/
├── constants.ts
└── index.ts
└── lib/
├── prisma.ts
└── utils.ts
prisma/
├── schema.prisma
└── migrations/

Self-Contained Features

Each feature module encapsulates its own components, library code, types, and constants. Add or remove features without touching the rest of the app. The auth module is a perfect reference implementation.

Role-Based Access Control

Three built-in roles—User, Admin, and Developer—with fine-grained access control powered by Better Auth's admin plugin. Permissions are centralized and easy to extend.

From Template to Production, Faster

With authentication, database ORM, and a scalable architecture already set up, you can focus on building your unique features instead of boilerplate. Get to market faster with a solid foundation.

Authentication

Auth that just works

Better Auth is pre-configured with email/password login, session management, and a role system. Here is exactly what ships out of the box.

src/features/auth/lib/auth.ts
import { betterAuth } from 'better-auth'
import { prismaAdapter } from 'better-auth/adapters/prisma'
export const auth = betterAuth({
database: prismaAdapter(prisma, { provider: 'mysql' }),
session: { expiresIn: 7 days, updateAge: 1 day },
emailAndPassword: { enabled: true },
user.roles: [USER, ADMIN, DEVELOPER],
plugins: [admin({ ac, roles })] }
USER

Default role for all new signups. Standard access to app features.

ADMIN

Full administrative access. Can manage users, roles, and settings.

DEVELOPER

Admin-level access with development permissions and tooling.

Database

Prisma ORM with MySQL

A fully typed database layer with custom client generation, migrations support, and models designed around authentication and user management.

User

Relations: Sessions, Accounts

idemailusernamerolenameemailVerifiedimage

Session

Relations: User

idtokenexpiresAtipAddressuserAgentuserId

Account

Relations: User

idaccountIdproviderIdaccessTokenrefreshTokenpassword

Verification

Relations: None

ididentifiervalueexpiresAt

Role Enum

Enum-based user roles

USERADMINDEVELOPER

Setup

Up and running in minutes

Five steps from zero to a fully functional development environment with auth, database, and code quality tooling.

01

Clone the repository

$ git clone https://github.com/MicrowebPG/nextjs-template.git
02

Install dependencies

$ npm install
03

Configure your environment

$ cp .env.example .env

Set your DATABASE_URL and auth secrets

04

Set up the database

$ npx prisma generate && npx prisma migrate deploy
05

Start building

$ npm run dev

Turbopack dev server at http://localhost:3000

Ready to build