A production-ready Next.js starter application with authentication, dashboard, and modern UI components.
✅ Authentication System
- Sign up and sign in forms with validation
- JWT token-based authentication
- Persistent authentication state
- Protected routes
- Automatic redirects
✅ UI & UX
- Animated forms using Framer Motion
- Light/Dark theme support
- Responsive design
- CSS Modules for styling
- Custom design token system
✅ State Management
- Redux Toolkit for client state
- TanStack Query for server state
- Persistent auth state in localStorage
✅ Dashboard
- Responsive sidebar navigation
- Collapsible sidebar for mobile
- Multiple dashboard pages (Profile, Settings)
- Theme switcher
- User information display
✅ Developer Experience
- TypeScript throughout
- React Hook Form + Zod validation
- ESLint configuration
- Modern folder structure
- Component-based architecture
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- State Management: Redux Toolkit + TanStack Query
- Forms: React Hook Form + Zod
- Animations: Framer Motion
- Styling: CSS Modules + CSS Variables
- Authentication: JWT (API integration ready)
npm installCopy the example environment file and configure it:
cp .env.example .env.localUpdate the .env.local file with your API URL:
NEXT_PUBLIC_API_URL=http://localhost:3001/apinpm run devOpen http://localhost:3000 to see the application.
src/
├── app/ # Next.js App Router
│ ├── auth/ # Authentication pages
│ ├── dashboard/ # Dashboard pages
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page (redirects)
├── components/ # Shared components
│ ├── form/ # Form components
│ ├── layout/ # Layout components
│ ├── ui/ # UI primitives
│ ├── ProtectedRoute.tsx # Route protection
│ └── Providers.tsx # App providers
├── features/ # Feature-based modules
│ └── auth/ # Authentication feature
│ ├── components/ # Auth-specific components
│ ├── hooks/ # Auth hooks
│ ├── api.ts # API calls
│ ├── model.ts # Type definitions
│ └── schemas.ts # Validation schemas
├── hooks/ # Global hooks
├── lib/ # Utilities
├── store/ # Redux store
├── styles/ # Global styles
└── types/ # Global types
The authentication system is designed to work with your backend API. The expected API endpoints are:
{
"email": "user@example.com",
"password": "password123"
}Response:
{
"user": {
"id": "user-id",
"name": "John Doe",
"email": "user@example.com",
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z"
},
"token": "jwt-token",
"message": "Signed in successfully"
}{
"name": "John Doe",
"email": "user@example.com",
"password": "password123"
}Response: Same as signin
Headers: Authorization: Bearer <token>
Headers: Authorization: Bearer <token>
- Signin Form: Email/password with validation
- Signup Form: Name/email/password/confirm password with validation
- Form Animations: Smooth transitions and error animations
- Validation: Real-time validation using Zod schemas
- Responsive Sidebar: Collapsible navigation with icons and labels
- Theme Switcher: Toggle between light and dark modes
- User Info: Display user avatar, name, and email
- Navigation: Dashboard, Profile, Settings pages
- Authentication State: User info, token, loading states
- UI State: Sidebar collapse, theme preference
- Server State: API calls with caching and error handling
- CSS Variables: Centralized design tokens
- Dark Mode: Complete dark theme support
- Responsive: Mobile-first responsive design
- Create page in
src/app/dashboard/ - Add route to sidebar navigation in
components/layout/Sidebar.tsx - Wrap with
ProtectedRouteandDashboardLayout
Edit src/styles/tokens.css to customize:
- Colors
- Spacing
- Typography
- Border radius
- Shadows
- Define schema in appropriate feature
schemas.ts - Use
FormInputcomponent with validation - Handle submission in form component
# Development
npm run dev # Start development server
# Building
npm run build # Build for production
npm run start # Start production server
# Linting
npm run lint # Run ESLintMIT License - feel free to use this starter for your projects.