Build Scalable Apps with Feature-Based Architecture
A starter template for building scalable applications with Next.js and a feature-based architecture. All-in one tools, from scratch to production with Next.js, Better Auth and Drizzle.
# Clone the repository
git clone https://github.com/MicrowebPG/nextjs-templateBuilt on proven tools
Every dependency is chosen for reliability, developer experience, and production readiness.
Next.js
React framework with Turbopack for blazing fast builds and server components.
React
Latest React with improved performance, new hooks, and concurrent features.
Better Auth
Modern auth library with email/password, RBAC, and session management.
Drizzle ORM
Lightweight type-safe ORM that compiles to raw SQL. Zero runtime overhead.
Tailwind CSS
Latest utility-first CSS with enhanced performance and new architecture.
TypeScript
End-to-end type safety across the entire stack, from schema to UI.
Husky
Git hooks for automated linting, formatting, and quality enforcement.
Commitlint
Conventional commit message validation for clean, readable git history.
Feature-based structure
Organize by feature, not file type. Each domain owns its components, logic, types, and tests.
Co-located features
Each feature contains its own components, hooks, types, and utilities — everything in one place.
Clear boundaries
Features communicate through well-defined interfaces. No cross-feature imports creating hidden coupling.
Scale naturally
Add new features by creating a new folder. Remove features by deleting one. Zero entanglement.
Auth that just works
Better Auth handles the complexity. Email/password, roles, sessions — configured and ready to go.
Email & Password
Built-in support for traditional email and password authentication flows.
Role-Based Access
Three user roles — USER, ADMIN, DEVELOPER — with granular permissions.
Session Management
Secure sessions with 7-day expiry, daily refresh, IP and user-agent tracking.
Database Adapter
Drizzle adapter for seamless PostgreSQL storage of users, accounts, and sessions.
Schema to query, type-safe
Drizzle ORM with PostgreSQL. Define schemas in TypeScript, get full type inference everywhere.
Type-safe queries
Full TypeScript inference from schema definition to query result.
PostgreSQL native
Direct pg driver — no abstraction layers standing in the way.
Schema-driven
Define your schema in TypeScript, then push or generate migrations.
Zero overhead
Drizzle compiles to raw SQL at build time. No runtime query builder penalty.