A production-ready, full-stack Next.js 16 template with TypeScript, Tailwind CSS, MongoDB, and a comprehensive admin panel. Perfect for building websites with content management capabilities without user authentication complexity.
This template provides a solid foundation for building modern web applications with:
- Public Website - Beautiful, SEO-optimized frontend
- Admin Panel - Full-featured content management system
- No User Login Required - Simplified authentication (admin-only)
- Production Ready - Error handling, logging, caching, and more
Perfect for portfolios, business websites, agencies, and any project needing content management without user accounts.
- Next.js 16.0.1 - Latest App Router with React Server Components
- React 19.2.0 - Latest React with improved performance
- TypeScript - Full type safety across the stack
- Tailwind CSS v4 - Modern utility-first styling
- MongoDB - Flexible NoSQL database with Mongoose ODM
- Redis - High-performance caching and session storage
- Cloudflare R2 - S3-compatible file storage (optional)
- RESTful API - Well-structured API routes with Next.js App Router
- Database Seeding - Automatic initial data setup
- Error Handling - Comprehensive error middleware
- Request Validation - Zod schema validation
- Authentication - JWT-based admin authentication
- File Uploads - Presigned URL uploads to Cloudflare R2
- Email System - SMTP email sending with Nodemailer
- Job Queues - Background job processing with BullMQ
- Logging - Winston-based structured logging
- Rate Limiting - Built-in request throttling
- CORS & Security - Secure API configuration
- Server Components - Optimized rendering with RSC
- Client Components - Interactive UI where needed
- State Management - Zustand for global state
- Form Handling - Type-safe forms with Zod validation
- UI Components - shadcn/ui component library
- Responsive Design - Mobile-first approach
- SEO Optimization - Dynamic metadata and Open Graph
- Error Boundaries - Graceful error handling
- Loading States - Smooth UX transitions
- Dashboard - Overview with quick actions and statistics
- Services Management - Create, edit, and organize services
- Projects Management - Showcase portfolio projects
- Testimonials - Manage client feedback
- Team Members - Team page management
- Brands - Client/partner logo management
- Site Settings - Comprehensive settings including:
- App details (name, logo, description)
- Contact information
- Social media links
- SEO configuration
- Branding (colors, fonts)
- Email settings
- Legal documents
- Feature flags
- Localization
- Analytics integration
- Type Safety - End-to-end TypeScript
- Code Formatting - Prettier configuration
- Linting - ESLint with Next.js rules
- Hot Reload - Turbopack for fast development
- Git Hooks - Pre-commit validation (optional)
- Node.js 20.x or higher
- MongoDB (local or Atlas)
- Redis (optional but recommended)
- Cloudflare R2 (optional, for file uploads)
- SMTP Email credentials
git clone <repository-url>
cd next-16-template
npm installCreate a .env.local file in the root directory:
# Application
APP_NAME=next-16-template
APP_URL=http://localhost:3000
NODE_ENV=development
# Internal styleguide (production only): /internal/styleguide?key=YOUR_SECRET
STYLEGUIDE_SECRET=
# Database (MongoDB)
DB_URL=mongodb://localhost:27017/your-database-name
# JWT Tokens (generate with: openssl rand -base64 32)
ACCESS_TOKEN_SECRET=your-access-token-secret
REFRESH_TOKEN_SECRET=your-refresh-token-secret
ACCESS_TOKEN_EXPIRES_IN=15m
REFRESH_TOKEN_EXPIRES_IN=7d
ACCESS_COOKIE_EXPIRES_IN=15
REFRESH_COOKIE_EXPIRES_IN=7
# Email (SMTP)
FROM_EMAIL=[email protected]
TO_EMAIL=[email protected]
MAIL_PASSWORD=your-email-password
MAIL_HOST=smtp.example.com
MAIL_PORT=587
# Redis
REDIS_URL=redis://localhost:6379
CACHE_EXPIRY=3600
# Cloudflare R2 (Optional)
R2_ACCOUNT_ID=your-r2-account-id
R2_ACCESS_KEY_ID=your-r2-access-key-id
R2_SECRET_ACCESS_KEY=your-r2-secret-access-key
R2_BUCKET_NAME=your-bucket-name
R2_CDN_URL=https://cdn.yourdomain.com
R2_PUBLIC_URL=https://your-bucket.r2.dev
R2_FOLDER_PREFIX=staging-filesSee SETUP.md for detailed setup instructions.
npm run dev- Website: http://localhost:3000
- Admin Panel: http://localhost:3000/admin/auth/login
After first run, the database is automatically seeded with:
- Email:
[email protected](customize inapp/_server/lib/seed/index.ts) - Password:
Password123
next-16-template/
βββ app/ # Next.js App Router
β βββ _server/ # Server-side code (not routes)
β β βββ controllers/ # Business logic
β β β βββ auth/ # Authentication controllers
β β β βββ services/ # Service management
β β β βββ projects/ # Project management
β β β βββ testimonials/ # Testimonial management
β β β βββ team-members/ # Team management
β β β βββ brands/ # Brand management
β β β βββ site/ # Site settings
β β β βββ upload/ # File upload handlers
β β β βββ webhooks/ # Webhook handlers
β β βββ lib/ # Server utilities
β β β βββ config/ # Configuration
β β β βββ utils/ # Utility functions
β β β βββ types/ # TypeScript types
β β β βββ validation/ # Validation schemas
β β β βββ seed/ # Database seeding
β β βββ middlewares/ # Request middlewares
β β βββ models/ # Mongoose models
β β βββ queues/ # Background jobs
β βββ admin/ # Admin panel routes
β β βββ auth/ # Admin authentication
β β βββ dashboard/ # Admin dashboard pages
β βββ api/ # API routes
β β βββ admin/ # Admin-only APIs
β β βββ auth/ # Authentication APIs
β β βββ [public-apis] # Public APIs
β βββ [routes]/ # Public website routes
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
β βββ error.tsx # Error boundary
β βββ not-found.tsx # 404 page
β βββ globals.css # Global styles
βββ components/ # React components
β βββ atoms/ # Basic UI components
β βββ forms/ # Form components
β βββ general/ # General components
β βββ layout/ # Layout components
β βββ section/ # Page sections
β β βββ home/ # Home page sections
β β βββ admin/ # Admin panel sections
β β βββ [other]/ # Other sections
β βββ ui/ # shadcn/ui components
βββ lib/ # Shared utilities
β βββ constants/ # Constants and configs
β βββ hooks/ # Custom React hooks
β βββ services/ # API client
β βββ store/ # Zustand stores
β βββ types/ # TypeScript types
β βββ utils/ # Utility functions
βββ public/ # Static assets
β βββ fonts/ # Custom fonts
β βββ [assets] # Other assets
βββ .env.local # Environment variables (create this)
βββ next.config.ts # Next.js configuration
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run lint:fix- Fix ESLint errors automaticallynpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run checks- Run lint, format check, and build
The admin dashboard provides a central hub for managing your website:
- Quick Actions - Fast access to common tasks
- Statistics - Overview of content counts
- Recent Activity - Track recent changes
Manage your service offerings:
- Create, edit, and delete services
- Upload service images
- Set display order
- Configure SEO per service
Showcase your portfolio:
- Add project details
- Upload multiple images
- Link to live projects
- Categorize projects
- Set featured projects
Manage client feedback:
- Add testimonials with ratings
- Link testimonials to projects
- Set featured testimonials
- Manage display order
Build your team page:
- Add team member profiles
- Upload photos
- Set roles and descriptions
- Manage display order
Showcase clients/partners:
- Add brand logos
- Link to brand websites
- Set active/inactive status
- Manage display order
Comprehensive settings panel with multiple tabs:
- App Details - App name, logo, description
- Contact Info - Address, phone, office hours
- Social Media - All social platform links
- SEO - Meta tags, Open Graph, structured data
- Branding - Colors, fonts, visual identity
- Email - Email configuration and templates
- Legal - Privacy policy, terms, cookies
- Features - Feature flags and toggles
- Localization - Language and regional settings
- Analytics - Tracking codes and analytics IDs
The template uses a role-based permission system:
- Super Admin - Full access to everything
- Admin - Limited permissions (configurable)
- Permissions are managed per-role in the database
- Admin logs in with email/password
- Server validates credentials
- JWT tokens are issued (access + refresh)
- Tokens stored in HTTP-only cookies
- Access token expires in 15 minutes
- Refresh token expires in 7 days
- Automatic token refresh on expiry
- HTTP-only cookies (XSS protection)
- Secure cookies in production
- Token rotation on refresh
- Password hashing with bcrypt
- Rate limiting on auth endpoints
POST /api/admin/auth/login- Admin loginPOST /api/admin/auth/logout- Admin logoutGET /api/admin/auth/session- Get current session
GET /api/services- List services (paginated)GET /api/services/:slug- Get service by slug
GET /api/projects- List projects (paginated)GET /api/projects/:slug- Get project by slug
GET /api/testimonials- List testimonialsGET /api/testimonials/:id- Get testimonial
GET /api/team-members- List team membersGET /api/team-members/:id- Get team member
GET /api/brands- List brandsGET /api/brands/:id- Get brand
GET /api/site-settings/:slice- Get settings slice
POST /api/upload/presigned-url- Generate presigned upload URL
All admin endpoints require authentication and are prefixed with /api/admin/:
- Services: CRUD operations + reorder
- Projects: CRUD operations + reorder
- Testimonials: CRUD operations
- Team Members: CRUD operations + reorder
- Brands: CRUD operations
- Site Settings: Update operations
- File Upload: Generate presigned URLs
All endpoints support:
- Pagination (
?page=1&limit=10) - Filtering and sorting
- Type-safe request/response handling
On first database connection, the following is automatically seeded:
- Roles: Super Admin, Admin, Customer
- Default Admin: Creates initial admin account
- Sample Data: Services, projects, testimonials, brands
Edit files in app/_server/lib/seed/:
index.ts- Seed functionsseedData.ts- Seed data definitions
- Admin - Admin user accounts
- Role - User roles and permissions
- Service - Service offerings
- Project - Portfolio projects
- Testimonial - Client testimonials
- TeamMember - Team member profiles
- Brand - Client/partner brands
- SiteSettings - Site configuration
- ActivityLog - Activity tracking
- AuditLog - Audit trail
- EmailLog - Email tracking
- Notification - Notifications
Edit app/_server/lib/seed/index.ts:
export const DEFAULT_SUPER_ADMIN = {
firstName: 'Your',
lastName: 'Name',
email: '[email protected]',
accountStatus: 'active',
};- Create model in
app/_server/models/ - Create controllers in
app/_server/controllers/ - Create API routes in
app/api/ - Create admin pages in
app/admin/dashboard/ - Create store in
lib/store/ - Add to seed data if needed
- Edit site settings in admin panel
- Update colors in
tailwind.config.ts - Modify fonts in
app/globals.css - Update company config in
app/_server/lib/config/environment.ts
- Create page in
app/admin/dashboard/ - Add route to
lib/constants/routing.ts - Create API endpoints if needed
- Add permissions if required
Ensure all environment variables are set in your hosting platform:
- MongoDB connection string
- Redis URL
- JWT secrets (use strong random strings)
- Email credentials
- R2 credentials (if using file uploads)
- Set
NODE_ENV=production
- Push to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
CMD ["npm", "start"]The app follows Next.js standards and can be deployed to:
- Netlify
- AWS Amplify
- Railway
- Render
- Any Node.js hosting
- Set all required environment variables
- Use production database (MongoDB Atlas)
- Use production Redis instance
- Configure proper CORS settings
- Set up error monitoring
- Configure CDN for static assets
- Set up SSL/HTTPS
- Change default admin credentials
- Review security settings
- Set up backups
- β JWT tokens in HTTP-only cookies
- β Password hashing with bcrypt
- β Request validation with Zod
- β Error handling (no sensitive data exposure)
- β Rate limiting on auth endpoints
- β CORS configuration
- β Environment variable protection
- Use strong JWT secrets (32+ characters)
- Enable HTTPS in production
- Regularly update dependencies
- Review and restrict permissions
- Monitor for suspicious activity
- Keep backups of your database
- Verify
DB_URLis correct - Check MongoDB is running/accessible
- Ensure network/firewall allows connection
- Check connection string format
- App continues without Redis but caching is disabled
- Verify
REDIS_URLformat - Check Redis server is accessible
- Clear
.nextfolder:rm -rf .next - Delete
node_modulesand reinstall - Check Node.js version (20+)
- Verify all environment variables are set
PORT=3001 npm run dev- SETUP.md - Detailed setup guide
- TEMPLATE_COMPLETION_CHECKLIST.md - Completion status
This is a template repository. Feel free to:
- Fork and customize for your needs
- Report issues you encounter
- Suggest improvements
- Share your customizations
MIT License - see LICENSE file for details.
Built with:
For questions or issues:
- Check the SETUP.md guide
- Review existing issues
- Open a new issue with details
Made with β€οΈ for developers who want to ship fast
Happy coding! π