A production-ready Next.js template featuring modern architecture patterns, complete authentication system, and scalable project structure. Built with TypeScript, Domain-Driven Design principles, and enterprise-level best practices.
- ✅ Complete Authentication System (JWT-based with HTTP-only cookies)
- ✅ Domain-Driven Design Architecture with clean separation of concerns
- ✅ Type-Safe API with Zod validation and TypeScript
- ✅ Modern State Management using Redux Toolkit + RTK Query
- ✅ Protected Routes with Next.js middleware
- ✅ Form Handling with React Hook Form and validation
- ✅ Error Handling with custom error classes
- ✅ MongoDB Integration with Mongoose
- ✅ Responsive UI with Tailwind CSS
- ✅ Developer Experience optimized with ESLint, Prettier, and Turbopack
src/
├── app/(client)/ # App Router client pages (Route Groups)
│ ├── auth/ # Authentication pages (login, register)
│ ├── dashboard/ # Protected dashboard page
│ └── layout.tsx # Root layout with providers
├── app/api/ # API Routes
│ ├── auth/ # Authentication endpoints
│ └── users/ # User management endpoints
├── components/ # Shared UI components
├── domain/ # Domain layer (DDD pattern)
│ └── user/ # User domain with entities, repos, services
├── features/ # Feature modules
│ └── auth/ # Authentication feature module
├── shared/ # Shared utilities and infrastructure
│ ├── auth/ # Authentication utilities
│ ├── container/ # Dependency injection container
│ ├── database/ # Database connection
│ └── errors/ # Custom error classes
└── store/ # Redux store configuration
- Next.js 15.4.5 - React framework with App Router & Turbopack
- React 19.1.0 - UI library
- TypeScript 5.x - Type safety
- Tailwind CSS 4.1.11 - Styling
- Redux Toolkit 2.8.2 - State management
- RTK Query - API state and caching
- React Redux 9.2.0 - React integration
- JWT (jose, jsonwebtoken) - Token-based authentication
- bcryptjs - Password hashing
- Zod 4.0.14 - Schema validation
- MongoDB - Database
- Mongoose 8.17.0 - ODM with custom repository pattern
- React Hook Form 7.61.1 - Form management
- @hookform/resolvers - Schema integration
- ESLint + Prettier - Code quality and formatting
- TypeScript - Static type checking
- Path aliases (
@/*) - Clean imports
- Node.js 18+
- MongoDB database
- npm or yarn
-
Clone the repository
git clone <repository-url> cd next-job-board
-
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile:MONGODB_URI=your_mongodb_connection_string JWT_ACCESS_SECRET=your_jwt_access_secret JWT_REFRESH_SECRET=your_jwt_refresh_secret
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
- Multiple Language Support: English and Farsi
- Localized Routing: Language-specific routes
- Automatic Language Detection
- Domain Layer: Business logic and entities
- Repository Pattern: Data access abstraction
- Service Layer: Business operations
- Dependency Injection: Loose coupling with custom DI container
- JWT with HTTP-only cookies for secure token storage
- Password hashing with bcrypt
- Request validation with Zod schemas
- Custom error handling preventing information leakage
- Route protection with Next.js middleware
- Turbopack for faster development builds
- RTK Query for automatic caching and background refetching
- Route Groups for organized routing
- Middleware for efficient auth checks
This template is perfect for:
- ✅ Job Boards & Career Platforms
- ✅ SaaS Dashboards with user authentication
- ✅ E-commerce Platforms (user management foundation)
- ✅ Content Management Systems
- ✅ Multi-tenant Applications
- ✅ Any CRUD-heavy web application
- Registration/Login - Secure user authentication
- JWT Token Generation - Access and refresh tokens
- HTTP-only Cookies - Secure token storage
- Middleware Protection - Route-level authentication
- Automatic Token Refresh - Seamless user experience
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutPOST /api/auth/refresh- Token refreshGET /api/users/currentuser- Get current user
- Responsive design with Tailwind CSS
- Form components with validation
- Toast notifications for user feedback
- Loading states and error handling
- Clean and modern interface
# Development server with Turbopack
npm run dev
# Production build
npm run build
# Start production server
npm start
# Lint code
npm run lintEach feature (auth, jobs, etc.) is self-contained with its own:
- Components
- Services
- Types
- Schemas
- Hooks
- End-to-end TypeScript coverage
- Zod schema validation
- Type-safe API responses
- IntelliSense support
- Custom error classes for different scenarios
- Consistent API error responses
- User-friendly error messages
- Proper HTTP status codes
- Server state with RTK Query
- Client state with Redux Toolkit
- Authentication context
- Optimistic updates
This template follows clean architecture principles. When adding new features:
- Follow the feature-based folder structure
- Implement proper domain separation
- Add appropriate error handling
- Include type definitions
- Write validation schemas
This project is open source and available under the MIT License.
Built with ❤️ using Next.js, TypeScript, and modern web development practices.