A production-ready, full-stack Next.js 16 boilerplate with authentication, admin dashboard, database, file uploads, and type-safe APIs β all pre-configured so you can skip the setup and start building.
π PRD Prompt Template β’ π PRD Example
Tech Stack β’ Features β’ Getting Started β’ Project Structure β’ tRPC Usage β’ Customization β’ Deployment β’ Special Thanks β’ PRD Generator β’ License
| Category | Technology | Version |
|---|---|---|
| Framework | Next.js | 16 |
| Language | TypeScript | 5 |
| UI Runtime | React + React Compiler | 19 |
| Styling | Tailwind CSS | 4 |
| UI Components | shadcn/ui (New York) | Latest |
| Authentication | Better Auth | 1.x |
| Database ORM | Prisma | 7 |
| Database | PostgreSQL (Neon recommended) | β |
| API Layer | tRPC | 11 |
| Data Fetching | TanStack React Query | 5 |
| File Uploads | UploadThing | 7 |
| Form Handling | React Hook Form + Zod | Latest |
| Charts | Recharts | 2 |
| Animations | GSAP | 3 |
| Resend (pre-configured, commented) | β | |
| Icons | Lucide React | Latest |
| Fonts | Geist Sans & Geist Mono | β |
- Email & Password authentication with configurable password policy
- Admin plugin β role-based access control out of the box
- Rate limiting β brute-force and spam protection on auth endpoints
- Secure cookies β
httpOnly,sameSite,securein production - Session management β cookie caching, configurable expiry
- Password reset flow (Resend email template included, commented out)
- Forgot password flow with email-based reset link
- Pre-built client exports:
signIn,signUp,signOut,useSession,changePassword,resetPassword,admin
- Prisma 7 with the new
PrismaPgdriver adapter for connection pooling - Pre-defined schema:
User,Account,Credential,Session,Verification - Admin fields:
role,banned,banReason,banExpires - Generated client output to
app/generated/prisma(git-ignored) - Migration-ready setup
baseProcedureβ public endpointsprotectedProcedureβ requires authentication (auto-injects user session)adminProcedureβ requiresadminrole- Server-side prefetching with
HydrationBoundaryfor zero-waterfall SSR - SuperJSON transformer for Date, Map, Set serialization
- Configured
TRPCReactProviderwith singleton query client
- 4 pre-configured file routes:
productImageβ single image (4MB, auth required)productImagesβ multiple images up to 5 (4MB each, auth required)pdfUploaderβ single PDF (4MB, auth required)publicImageβ single image (4MB, no auth)
- Ready-to-use components:
UploadButton,UploadDropzone,useUploadThing
- 56 shadcn/ui components pre-installed (New York style)
- 12 custom components β password input, image/file upload, toast, alert dialog, theme toggle, user avatar, responsive modal, page container, icons, heading, login account info
- Tailwind CSS v4 with CSS variables and
tw-animate-css - React Compiler enabled for automatic memoization
- next-themes for dark/light mode support (dark by default)
- Sonner for toast notifications
- Embla Carousel for carousels
- Vaul for drawer components
- Recharts for data visualization
- react-resizable-panels for resizable layouts
- react-day-picker for date pickers
- cmdk for command palette
- input-otp for OTP inputs
- CVA + clsx + tailwind-merge for class utilities
- GSAP animated 404 page with glitch effect, floating particles, and scanline animation
- Collapsible sidebar navigation with icon-based and expanded modes
- RBAC-based navigation filtering β show/hide items based on
role,permission,plan,feature, orrequireOrg - Breadcrumbs with auto-generated items based on the current route
- Search (Cmd+K) command palette for quick navigation
- Notification dropdown component
- Sign-out button with confirmation dialog
- User avatar profile with role badge
- Pre-configured nav items: Dashboard, Inbox, Workspaces (Portfolio, Resume), Tracker
useCurrentUser()β reactive current user state (client)getSession()β server-side session retrievaluseFilteredNavItems()β RBAC-based navigation filtering (client-side, no server calls)useBreadcrumbs()β dynamic breadcrumb generation from URL segmentsuseDebounce()β debounce valuesuseMobile()β responsive breakpoint detection
- Login β email/password with "Remember me" and "Forgot password" link, includes demo account info
- Register β email/password/name with password strength indicator and rules
- Forgot Password β email-based reset link request
- Reset Password β set new password from email link
- Beautiful auth layout with animated gradient background
- Node.js β₯ 20
- npm, pnpm, or yarn
- A PostgreSQL database (we recommend Neon β free tier available)
- An UploadThing account (for file uploads)
git clone https://github.com/chndrwali/nextjs-starter-kit.git
cd nextjs-starter-kit
npm installInitialize Prisma client and run migrations:
npx prisma init --db --output ../app/generated/prisma
npx prisma generate
npx prisma migrate devnpx @better-auth/cli@latest secretCopy the generated secret into your .env file.
Copy the example env file and fill in your values:
cp .env.example .env# Auth Secret (generated in step 3)
BETTER_AUTH_SECRET=your_generated_secret_here
BETTER_AUTH_URL=http://localhost:3000
# Resend (for emails β optional)
RESEND_API_KEY=re_xxxxxxxxxxxxx
# Public URL
NEXT_PUBLIC_URL=http://localhost:3000
# Database (get this from https://neon.com/)
DATABASE_URL="postgresql://user:password@ep-xxxx.region.aws.neon.tech/dbname?sslmode=require"
# UploadThing (get this from https://uploadthing.com/)
UPLOADTHING_TOKEN='your_uploadthing_token'| Variable | Source |
|---|---|
BETTER_AUTH_SECRET |
Run npx @better-auth/cli@latest secret |
DATABASE_URL |
Create a free database at neon.com β copy the connection string |
UPLOADTHING_TOKEN |
Sign up at uploadthing.com β create an app β copy the token |
RESEND_API_KEY |
Sign up at resend.com β API Keys β create key (optional) |
npm run devOpen http://localhost:3000 to see your app.
.
βββ app/
β βββ (admin)/ # Admin dashboard route group
β β βββ admin/ # Admin pages (dashboard, inbox, etc.)
β β βββ layout.tsx # Admin layout with session guard
β βββ (auth)/ # Auth route group
β β βββ login/ # Login page with demo account info
β β βββ register/ # Registration page
β β βββ forgot-password/ # Forgot password page
β β βββ reset-password/ # Reset password page
β β βββ layout.tsx # Auth layout with redirect if logged in
β βββ (public)/ # Public route group
β β βββ page.tsx # Home page (redirects to /login)
β βββ api/
β β βββ auth/[...all]/ # Better Auth catch-all handler
β β βββ trpc/[trpc]/ # tRPC API handler
β β βββ uploadthing/ # UploadThing route handler + file router
β βββ generated/prisma/ # Prisma generated client (git-ignored)
β βββ globals.css # Tailwind CSS + design tokens
β βββ layout.tsx # Root layout (Geist fonts, providers)
β βββ not-found.tsx # Animated 404 page (GSAP)
βββ components/
β βββ custom/ # 12 custom reusable components
β β βββ alert-dialog-custom.tsx
β β βββ app-toast.tsx
β β βββ file-upload.tsx
β β βββ heading.tsx
β β βββ icons.tsx
β β βββ image-upload.tsx
β β βββ login-account-info.tsx
β β βββ page-container.tsx
β β βββ password-input.tsx
β β βββ responsive-modal.tsx
β β βββ theme-mode-toggle.tsx
β β βββ user-avatar-profile.tsx
β βββ ui/ # 56 shadcn/ui components
β βββ theme-provider.tsx # next-themes provider
β βββ uploadthing.ts # UploadThing component exports
βββ hooks/
β βββ get-session.ts # Server-side session helper
β βββ use-breadcrumbs.ts # Dynamic breadcrumb hook
β βββ use-current-user.ts # Client-side current user hook
β βββ use-debounce.ts # Debounce hook
β βββ use-mobile.ts # Mobile breakpoint hook
β βββ use-nav.ts # RBAC-based nav filtering hook
βββ lib/
β βββ auth.ts # Better Auth server config
β βββ auth-client.ts # Better Auth client exports
β βββ config-env.ts # Centralized env config
β βββ form-schema.ts # Zod schemas (login, register, etc.)
β βββ prisma.ts # Prisma client singleton
β βββ utils.ts # Utility functions (cn, formatters)
βββ modules/
β βββ admin/ui/
β β βββ components/ # Breadcrumbs, notifications, search, signout
β β βββ config/ # Nav config, search config (RBAC)
β β βββ layout/ # Admin layout, app sidebar, header
β βββ auth/ui/
β βββ form/ # Login, register, forgot & reset password forms
β βββ layout/ # Auth layout (animated gradient bg)
βββ prisma/
β βββ migrations/ # Database migrations
β βββ schema.prisma # Prisma schema
βββ trpc/
β βββ client.tsx # tRPC client provider + React Query setup
β βββ init.ts # tRPC procedures (base, protected, admin)
β βββ query-client.ts # TanStack Query client factory
β βββ routers/
β β βββ _app.ts # Root tRPC router
β βββ server.tsx # Server-side tRPC caller + prefetch helpers
βββ types/
β βββ index.ts # NavItem, PermissionCheck types
βββ .env.example # Environment variable template
βββ components.json # shadcn/ui configuration
βββ next.config.ts # Next.js config (React Compiler enabled)
βββ prisma.config.ts # Prisma config (datasource URL)
βββ tsconfig.json # TypeScript config
Create a new router in trpc/routers/:
// trpc/routers/example.ts
import { z } from "zod/v4";
import {
createTRPCRouter,
baseProcedure,
protectedProcedure,
} from "@/trpc/init";
export const exampleRouter = createTRPCRouter({
// Public query
hello: baseProcedure
.input(z.object({ name: z.string() }))
.query(({ input }) => {
return { greeting: `Hello, ${input.name}!` };
}),
// Protected mutation (requires auth)
create: protectedProcedure
.input(z.object({ title: z.string() }))
.mutation(({ ctx, input }) => {
// ctx.auth contains the user session
console.log("User:", ctx.auth.user.id);
return { success: true };
}),
});Register it in trpc/routers/_app.ts:
import { createTRPCRouter } from "@/trpc/init";
import { exampleRouter } from "./example";
export const appRouter = createTRPCRouter({
example: exampleRouter,
});
export type AppRouter = typeof appRouter;After creating a router, you can use it in client components with the TanStack React Query integration.
π Full documentation: tRPC + TanStack React Query Usage
Example usage in a client component:
"use client";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { useTRPC } from "@/trpc/client";
export function ExampleComponent() {
const trpc = useTRPC();
const queryClient = useQueryClient();
// Query
const { data, isLoading } = useQuery(
trpc.example.hello.queryOptions({ name: "World" })
);
// Mutation
const createMutation = useMutation(
trpc.example.create.mutationOptions({
onSuccess: () => {
// Invalidate and refetch
queryClient.invalidateQueries(trpc.example.hello.queryFilter());
},
})
);
if (isLoading) return <p>Loading...</p>;
return (
<div>
<p>{data?.greeting}</p>
<button onClick={() => createMutation.mutate({ title: "New Item" })}>
Create
</button>
</div>
);
}Example server-side prefetching (SSR) in a server component:
import { trpc, HydrateClient, prefetch } from "@/trpc/server";
export default async function Page() {
// Prefetch on server β zero waterfall
await prefetch(trpc.example.hello.queryOptions({ name: "World" }));
return (
<HydrateClient>
<ExampleComponent />
</HydrateClient>
);
}π‘ For more details on
useQuery,useMutation,useSuspenseQuery,useInfiniteQuery, and more, visit the official tRPC documentation.
- Uncomment the Resend import and email logic in
lib/auth.ts - Add your
RESEND_API_KEYto.env - Set
requireEmailVerification: truein the auth config
npx shadcn@latest add [component-name]Edit app/api/uploadthing/core.ts to add new file routes following the existing pattern.
This starter is optimized for deployment on Vercel:
- Push your repo to GitHub
- Import the project on vercel.com
- Add all environment variables from
.env.example - Update
BETTER_AUTH_URLandNEXT_PUBLIC_URLto your production domain - Deploy π
This project was made possible by the following amazing open-source projects, tools, and resources:
| Library | Description |
|---|---|
| Next.js | The React framework for the web |
| React | Library for building user interfaces |
| TypeScript | Typed JavaScript at any scale |
| Tailwind CSS | Utility-first CSS framework |
| shadcn/ui | Beautiful, accessible UI components |
| Radix UI | Unstyled, accessible UI primitives |
| Library | Description |
|---|---|
| Better Auth | Authentication library for Next.js |
| Prisma | Next-generation ORM for Node.js |
| tRPC | End-to-end type-safe APIs |
| TanStack React Query | Powerful data synchronization |
| UploadThing | File uploads made easy |
| Resend | Modern email sending API |
| Zod | TypeScript-first schema validation |
| SuperJSON | Serialization for complex types |
| Library | Description |
|---|---|
| GSAP | Professional-grade animation library |
| Recharts | Composable charting library for React |
| Lucide React | Beautiful & consistent icon toolkit |
| Sonner | Opinionated toast notifications |
| Embla Carousel | Lightweight carousel library |
| Vaul | Drawer component for React |
| cmdk | Command palette component |
| next-themes | Theme management for Next.js |
| React Hook Form | Performant form handling |
| react-day-picker | Date picker component |
| react-resizable-panels | Resizable panel layouts |
| input-otp | One-time password input component |
The admin sidebar implementation in this project is inspired by and credits go to:
π next-shadcn-dashboard-starter by Kiranism
A beautifully crafted admin dashboard starter with shadcn/ui and Next.js.
| Resource | Description |
|---|---|
| favicon.io | Generate favicons from text, image, or emoji |
| tweakcn | Visual theme editor for shadcn/ui β customize colors and styles |
| Aceternity UI | Beautiful animated components for React & Tailwind CSS |
Starter kit ini menyertakan file PRD.md yang berisi prompt template untuk generate Product Requirements Document yang lengkap dan implementation-ready.
- Buka file
PRD.md - Copy seluruh isi file tersebut
- Paste ke AI tool favoritmu (ChatGPT, Claude, Gemini, dll.)
- Isi bagian Project Input dengan detail proyekmu β ganti semua
{{placeholder}}dengan informasi yang sesuai - AI akan generate PRD lengkap dengan struktur:
- Overview, User Personas & Stories
- Functional & Non-Functional Requirements (MoSCoW)
- Core Features dengan Acceptance Criteria
- User Flows (Mermaid flowchart)
- System Architecture & Sequence Diagram
- Database Schema & ER Diagram
- API Design, Tech Stack, Development Phases
- Testing Strategy
π‘ Tip: Semakin detail input yang kamu berikan, semakin akurat dan actionable PRD yang dihasilkan.
π Contoh hasil PRD: Lihat PRD-EXAMPLE.md untuk contoh PRD yang sudah di-generate menggunakan prompt template ini.
This project is licensed under the MIT License.
If you find this starter kit helpful, consider supporting me:
Created by Candra Wali Sanjaya