A production-ready Next.js template with authentication, database, and all the essentials pre-configured.
| Layer | Tech |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript |
| Styling | Tailwind CSS v4 |
| UI Components | shadcn/ui |
| Icons | Lucide React |
| Auth | NextAuth.js (credentials + OAuth) |
| Database | Convex |
| Forms | React Hook Form + Zod |
| Resend | |
| Toasts | Sonner |
| Linting | ESLint |
| Formatting | Prettier |
| Git Hooks | Husky + lint-staged |
- Click "Use this template" on GitHub
- Clone your new repo
- Run setup:
npm run setupgit clone https://github.com/yourusername/nextjs-template.git my-app
cd my-app
npm run setupIf you prefer manual setup:
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env.local
# Generate NextAuth secret
openssl rand -base64 32
# Add output to NEXTAUTH_SECRET in .env.local
# Initialize Convex
npx convex dev
# Copy the URL to NEXT_PUBLIC_CONVEX_URL in .env.local
# Setup Husky
npx husky init
echo "npx lint-staged" > .husky/pre-commit# Run both Convex and Next.js
npm run dev
# Or run separately
npm run dev:convex # Terminal 1
npm run dev:next # Terminal 2Copy .env.example to .env.local and fill in:
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_CONVEX_URL |
Yes | Convex deployment URL |
NEXTAUTH_SECRET |
Yes | Random string for session encryption |
NEXTAUTH_URL |
Yes | Your app URL (http://localhost:3000 for dev) |
GITHUB_ID |
No | GitHub OAuth client ID |
GITHUB_SECRET |
No | GitHub OAuth client secret |
RESEND_API_KEY |
No | Resend API key for emails |
EMAIL_FROM |
No | Email sender address |
├── convex/ # Convex backend
│ ├── schema.ts # Database schema
│ └── users.ts # User queries/mutations
├── src/
│ ├── app/
│ │ ├── (auth)/ # Auth pages (login, register)
│ │ ├── (dashboard)/ # Protected pages
│ │ ├── api/ # API routes
│ │ └── ...
│ ├── components/
│ │ ├── ui/ # shadcn components
│ │ ├── layout/ # Header, Sidebar, etc.
│ │ └── features/ # Feature components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities
│ └── types/ # TypeScript types
├── scripts/
│ └── setup.mjs # Setup wizard
└── ...
| Command | Description |
|---|---|
npm run dev |
Run Convex + Next.js |
npm run dev:next |
Run Next.js only |
npm run dev:convex |
Run Convex only |
npm run build |
Build for production |
npm run lint |
Run ESLint |
npm run format |
Format with Prettier |
npm run typecheck |
Run TypeScript checks |
npm run setup |
Run setup wizard |
- Email/password authentication
- GitHub OAuth (optional)
- Protected routes via
proxy.ts - Session management with NextAuth.js
- Convex for real-time data
- Type-safe queries and mutations
- Automatic TypeScript generation
- shadcn/ui components pre-installed
- Dark mode support
- Responsive sidebar layout
- Toast notifications
- Go to GitHub Developer Settings
- Create a new OAuth App
- Set callback URL to
http://localhost:3000/api/auth/callback/github - Add
GITHUB_IDandGITHUB_SECRETto.env.local
- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Add provider to
src/app/api/auth/[...nextauth]/route.ts
- Push to GitHub
- Import to Vercel
- Add environment variables
- Deploy
npx convex deployMIT