An up-to-date Next.js starter template focused on developer DX and modern best practices.
Key technologies and highlights:
- Next.js 16 with Turbopack for fast local dev and builds
- React 19 + TypeScript
- Tailwind CSS (configured; global CSS at
src/app/globals.css) - shadcn/ui (configured for RSC and TSX)
- next-themes for client-side theme management
- @t3-oss/env-nextjs + Zod for typed runtime/shared environment variables
- ESLint + Prettier (with Tailwind plugin)
- pnpm as the recommended package manager
Clone the template and start developing:
git clone https://github.com/omarmaharem/next-template
cd next-template
pnpm install
pnpm devOpen http://localhost:3000 in your browser.
Available npm scripts (see package.json):
pnpm dev— start dev server (Next + Turbopack)pnpm build— build for productionpnpm start— start the production serverpnpm lint— run ESLintpnpm format— run Prettier to format files
- Theme provider:
src/components/theme-provider.tsxwrapsnext-themesand is used in the root layout. The app layout insrc/app/layout.tsxconfigures the provider withattribute="class",defaultTheme="system", anddisableTransitionOnChangeto provide smooth theme behavior. - Typed environment variables:
src/lib/env.tsuses@t3-oss/env-nextjswithzodschemas. The repo expects at leastNEXT_PUBLIC_APP_NAME(used for page metadata). - shadcn/ui:
components.jsonis configured for RSC and TSX. The generated components place their CSS intosrc/app/globals.cssby default. - Fonts: the layout uses Next's built-in font utilities (Google font Geist) through
next/font.
├── src/
│ ├── app/ # App router pages & layouts (root layout uses ThemeProvider)
│ ├── components/ # Reusable React components (shadcn/ui under this)
│ └── lib/ # Utilities (env, utils, etc.)
├── components.json # shadcn/ui config
├── next.config.ts # Next.js config
├── postcss.config.mjs # PostCSS config
├── package.json # Scripts & deps
└── tsconfig.json # TypeScript config
This template uses @t3-oss/env-nextjs to validate env variables. You should set at least:
NEXT_PUBLIC_APP_NAME— used in the site metadata (title). Example in a.envfile:
NEXT_PUBLIC_APP_NAME="My App"When developing locally, create a .env file at the project root and restart the dev server after editing.
Use the shadcn CLI to add components. The template's components.json is already configured for RSC/TSX:
pnpm dlx shadcn-ui@latest add [component-name]- Keep components small and composable.
- Use the App Router (server + client components) and prefer RSC for data-heavy slices.
- Use
envutility fromsrc/lib/env.tsfor typed access to runtime/shared variables.
MIT