AI-Powered Next.js Starter Template with Feature Driven Development
A modern, production-ready Next.js 15 starter template designed for developers who want to build scalable applications with clean architecture, AI integration, and enterprise-grade features.
CorePilot isn't just another Next.js template—it's a comprehensive development ecosystem that combines modern web technologies with AI-powered features and Feature Driven Development (FDD) architecture. Built for developers who demand quality, scalability, and maintainability.
- Startups building MVP products with enterprise scalability in mind
- Development Teams adopting Feature Driven Development methodology
- Solo Developers who want production-ready architecture from day one
- AI-First Applications requiring integrated AI tools and content generation 💎
- SaaS Products needing authentication, user management, and content systems
- E-Commerce Platforms with complete product and order management 💎
- Content-Heavy Websites with advanced CMS capabilities 💎
- Enterprise Applications requiring RBAC and comprehensive system management 💎
💎 = Pro features included
CorePilot's AI integration provides enterprise-grade content generation capabilities:
- Multi-Model Support - OpenRouter integration with 50+ AI models (GPT-4, Claude, Llama, etc.)
- Context-Aware Generation - Maintains conversation history and context across sessions
- Custom Prompt Templates - Create reusable prompts for consistent content generation
- Image Generation - AI-powered image creation with multiple style options
- Content Optimization - SEO-optimized content generation with meta tags and descriptions
Built for modern online businesses with comprehensive features:
- Advanced Product Catalog - Categories, attributes, variants, and inventory tracking
- Smart Order Management - Automated workflows for order processing and fulfillment
- Dynamic Pricing - Flexible coupon system with percentage, fixed, and conditional discounts
- Marketing Automation - Campaign management with analytics and conversion tracking
- Multi-Currency Support - Global commerce capabilities with localized pricing
Professional content management with advanced publishing capabilities:
- Visual Page Builder - Drag-and-drop interface for dynamic page creation
- Advanced Blog System - Categories, tags, featured posts, and scheduled publishing
- Media Management - Organized file library with automatic optimization and CDN integration
- SEO Optimization - Built-in tools for meta management, sitemap generation, and schema markup
- Content Workflow - Draft, review, and publish workflows with role-based permissions
Comprehensive payment and subscription handling:
- Payment Processing - Multiple payment providers (Stripe, PayPal, etc.)
- Subscription Management - Recurring billing with automated renewals and cancellations
- Financial Reporting - Revenue analytics, transaction history, and tax reporting
- Automated Invoicing - Generate and send invoices automatically
Enterprise-level system management and monitoring:
- Advanced Analytics - User behavior tracking, conversion funnels, and performance metrics
- System Monitoring - Real-time logs, error tracking, and performance monitoring
- API Management - Rate limiting, authentication, and comprehensive API documentation
- Backup & Recovery - Automated database backups with point-in-time recovery
- Feature Driven Development (FDD) - Modular, scalable architecture following SOLID principles
- SOLID Principles Implementation - Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
- TypeScript-First - Complete type safety across the stack with strict mode
- Monorepo Structure - Organized, feature-based modules with barrel exports
- AI Content Generator 💎 - AI-powered content creation with multiple models
- AI Image Generator 💎 - Generate images using AI models
- AI Chat Assistant 💎 - Interactive chat interface with context management
- AI Settings & Model Management 💎 - Configure and manage multiple AI providers (OpenRouter, etc.)
- Custom Prompts 💎 - Create and manage reusable AI prompts
- Better Auth - Modern authentication with Prisma adapter
- Role-Based Access Control (RBAC) - Comprehensive permission system with granular controls
- Email Verification - Built-in email verification flow
- Password Security - bcryptjs with 12 rounds encryption
- Session Management - Secure session handling with configurable expiration
- Product Management 💎 - Complete product catalog with categories and attributes
- Inventory Management 💎 - Stock tracking and management
- Order Management 💎 - Full order lifecycle (pending, completed, cancelled)
- Coupons & Discounts 💎 - Flexible coupon system
- Marketing Campaigns 💎 - Campaign management and tracking
- Blog System 💎 - Complete blog with categories, tags, and comments
- Page Management 💎 - Dynamic page creation and management
- Media Library 💎 - Advanced file management with variants and folders
- Comment System 💎 - Moderated comments with nested replies
- Menu Management 💎 - Dynamic navigation menu builder
- SEO Optimization 💎 - Built-in SEO tools and meta management
- Payment History 💎 - Complete transaction tracking
- Subscription Management 💎 - Recurring payment handling
- Payment Settings 💎 - Multiple payment provider integration
- Site Settings - Global site configuration
- Theme Settings - Light/dark mode with next-themes
- SEO Settings 💎 - Advanced SEO configuration
- Notifications 💎 - System-wide notification management
- API Integrations 💎 - Third-party service integrations
- System Logs 💎 - Comprehensive logging and monitoring
- Support System 💎 - Built-in help and support features
CorePilot follows Feature Driven Development (FDD) methodology with a modular architecture that promotes:
- Feature-Centric Organization - Each feature is self-contained and independent
- Domain-Driven Design - Business logic organized by domains
- Progressive Development - Build by feature completion
- Client-Valued Functionality - Focus on user value delivery
- SOLID Principles - Maintainable, extensible, and testable code
src/
├── features/ # Feature-based modules (FDD)
│ ├── [feature-name]/ # Standard feature structure
│ │ ├── views/ # Feature-specific views
│ │ ├── components/ # Feature-specific components
│ │ ├── hooks/ # Feature-specific hooks
│ │ ├── services/ # Business logic layer
│ │ ├── types/ # TypeScript definitions
│ │ ├── schemas/ # Zod validation schemas
│ │ └── constants/ # Local constants
│ └── ...
├── components/ # Shared UI components
├── lib/ # Shared utilities
├── hooks/ # Global hooks
└── app/ # Next.js App Router
Each feature follows a consistent service pattern:
- get.service.ts - Read operations (GET)
- create.service.ts - Create operations (POST)
- update.service.ts - Update operations (PUT/PATCH)
- delete.service.ts - Delete operations (DELETE)
- validation.service.ts - Validation logic
- stats.service.ts - Analytics and statistics 💎
|
|
- Node.js 18+ (recommended: 20+)
- Bun (recommended) or npm/yarn
- PostgreSQL database
- Git for version control
-
Clone the repository
git clone https://github.com/codelifynet/corepilot-nextjs-prisma-shadcn-ai-starter-kit.git cd corepilot -
Install dependencies
bun install # or npm install -
Environment setup
cp .env.example .env.local
Configure your environment variables:
# Application URL NEXT_PUBLIC_APP_URL="http://localhost:3007" # Database DATABASE_URL="postgresql://username:password@localhost:5432/corepilot" # Authentication (Required) AUTH_SECRET="your-auth-secret-key" BETTER_AUTH_SECRET="your-better-auth-secret" BETTER_AUTH_URL="http://localhost:3007" NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3007" # File Uploads (Required for media features) 💎 UPLOADTHING_SECRET="your-uploadthing-secret" UPLOADTHING_TOKEN="your-uploadthing-token" # AI Tools (Pro Features) 💎 OPENROUTER_API_KEY="your-openrouter-api-key" ELEVENLABS_API_KEY="your-elevenlabs-api-key" # SEO & Analytics (Optional) GOOGLE_SITE_VERIFICATION="your-google-verification-code" YANDEX_VERIFICATION="your-yandex-verification-code" YAHOO_VERIFICATION="your-yahoo-verification-code"
Variable Required Purpose Where to Get DATABASE_URL✅ PostgreSQL connection Your database provider BETTER_AUTH_SECRET✅ Authentication security Generate: openssl rand -base64 32BETTER_AUTH_URL✅ Auth callback URL Your app URL UPLOADTHING_SECRET💎 File upload service UploadThing Dashboard OPENROUTER_API_KEY💎 AI content generation OpenRouter ELEVENLABS_API_KEY💎 AI voice synthesis ElevenLabs GOOGLE_SITE_VERIFICATION⚪ SEO verification Google Search Console -
Database setup
# Generate Prisma client bun prisma generate # Run migrations bun prisma migrate dev # Seed database with RBAC system bun prisma db seed
CorePilot includes a comprehensive RBAC (Role-Based Access Control) seeding system that sets up:
- 12 predefined roles with granular permissions
- 500+ permissions across all system features
- Complete RBAC hierarchy for enterprise-grade access control
After seeding, you can login with these accounts:
| Role | Password | Access Level | |
|---|---|---|---|
| Super Admin | superadmin@superadmin.com |
superadmin123 |
Full system access |
| Admin | admin@admin.com |
admin123 |
Management access |
| Standard User | user@user.com |
user123 |
Basic user access |
- Super Administrator - Complete system control
- Business Manager - Business operations & analytics 💎
- Operations Manager - Orders, inventory & customer service 💎
- Marketing Manager - Content & campaigns 💎
- Content Creator - Content management & AI tools 💎
- Customer Support Agent - Customer service & support
- Data Analyst - Analytics & reporting 💎
- API Developer - API access & integrations 💎
- Read-Only User - View-only access
- Standard User - Basic features
# Full RBAC system seeding (recommended)
bun prisma db seed
# Individual seeding options
npx tsx prisma/seeds/master-rbac.seed.ts # Complete RBAC setup
npx tsx prisma/seeds/permissions.seed.ts # Permissions only
npx tsx prisma/seeds/roles.seed.ts # Roles only
npx tsx prisma/seeds/users.seed.ts # Users only
npx tsx prisma/seeds/comprehensive-roles.seed.ts # Advanced roles 💎The seeding system creates permissions for:
- User Management - Complete user lifecycle
- Content Management 💎 - CMS with categories, tags, scheduling
- E-Commerce 💎 - Products, orders, inventory, coupons
- Customer Management 💎 - Customer profiles, groups, history
- Analytics & Reporting 💎 - Comprehensive business intelligence
- AI Tools 💎 - Content generation, chat, prompt management
- Finance & Billing 💎 - Payment processing, financial reports
- System Administration - Settings, security, integrations
- API Management 💎 - API keys, rate limiting, logs
-
Start development server
bun dev # or npm run dev -
Open your browser Navigate to http://localhost:3007
- Create an admin account - Register your first user (automatically gets admin role)
- Explore the dashboard - Navigate to
/dashboardto see all features - Configure AI tools 💎 - Set up your AI providers in Settings > AI Tools
- Create your first content 💎 - Use the CMS to create pages and blog posts
- Set up your store 💎 - Configure products and inventory in E-Commerce section
💎 = Pro features require additional configuration
# Start PostgreSQL with Docker
docker run --name corepilot-db \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=corepilot \
-p 5432:5432 -d postgres:15
# Update DATABASE_URL in .env.local
DATABASE_URL="postgresql://postgres:password@localhost:5432/corepilot"The project includes comprehensive schemas for:
- User Management: Users, roles, permissions, sessions
- Content Management: Blog posts, categories, tags, comments
- Media Library: Files, folders, variants, processing
- SEO: Meta tags, Open Graph, Twitter Cards
The seed script creates sample data including:
- Users: Admin, Editor, and Author users
- Roles & Permissions: Comprehensive role-based access control
- Blog Content: 3 sample blog posts with categories and tags
- Comments: Sample comments with moderation status
- Media Files: Sample images with variants and folders
- SEO Settings: Default SEO configurations
# Seed database with sample data
npm run db:seed
# Reset database and reseed
npm run db:reset
# Run specific seed (content management only)
npx tsx prisma/seeds/content-management.seed.tsAfter seeding, you'll have:
- 4 Blog Categories (Technology, Web Development, Design, Business)
- 6 Tags (React, Next.js, TypeScript, Tailwind CSS, Prisma, UI/UX)
- 4 Media Folders with hierarchical structure
- 3 Featured Images with multiple variants
- 3 Published Blog Posts with rich content
- 8 Comments (7 approved, 1 pending moderation)
- 3 Blog Post Revisions for version tracking
CorePilot implements Feature Driven Development methodology, which provides:
- 🔧 Modular Architecture - Each feature is self-contained and independent
- 👥 Team Scalability - Multiple developers can work on different features simultaneously
- 🚀 Faster Development - Clear structure reduces decision fatigue and speeds up development
- 🔄 Easy Maintenance - Features can be updated, removed, or added without affecting others
- 📦 Reusability - Features can be easily extracted and reused in other projects
📦 corepilot/
├── 🎯 src/
│ ├── 📱 app/ # Next.js App Router (Routes & Pages)
│ │ ├── 🏠 (dashboard)/ # Dashboard routes
│ │ ├── 🔐 auth/ # Authentication pages
│ │ ├── 📝 blog/ # Blog pages
│ │ ├── 💼 about/ # About page
│ │ ├── 🎯 careers/ # Careers page
│ │ └── 🔌 api/ # API Routes
│ │ ├── 🤖 ai-tools/ # AI integration endpoints
│ │ ├── 👤 users/ # User management API
│ │ ├── 📝 blog/ # Blog API
│ │ └── 📊 analytics/ # Analytics API
│ │
│ ├── 🎨 features/ # 🏗️ FDD Feature Modules
│ │ ├── 🤖 ai-tools/ # AI Integration Feature
│ │ │ ├── 📄 views/ # AI Tools pages
│ │ │ ├── 🧩 components/ # AI-specific components
│ │ │ ├── 🪝 hooks/ # AI-related hooks
│ │ │ ├── ⚙️ services/ # AI business logic
│ │ │ ├── 📋 schemas/ # AI validation schemas
│ │ │ └── 🔧 types/ # AI TypeScript types
│ │ │
│ │ ├── 🔐 auth/ # Authentication Feature
│ │ ├── 📝 content-management/ # CMS Feature
│ │ ├── 👥 users/ # User Management Feature
│ │ ├── 📊 analytics/ # Analytics Feature
│ │ ├── 🛒 products/ # Product Catalog Feature
│ │ └── 💰 finance/ # Finance Feature
│ │
│ ├── 🧩 components/ # Shared UI Components
│ │ ├── 🎨 ui/ # ShadcnUI components
│ │ ├── 🏗️ layout/ # Layout components
│ │ └── 🔐 auth/ # Auth components
│ │
│ ├── 📚 lib/ # Shared Utilities
│ │ ├── 🔐 auth.ts # Better Auth config
│ │ ├── 🗄️ prisma.ts # Prisma client
│ │ └── 🛠️ utils.ts # General utilities
│ │
│ └── 🌐 Global Shared/
│ ├── 🪝 hooks/ # Global hooks
│ ├── 🏪 store/ # Zustand stores
│ ├── 📋 types/ # Global types
│ └── 🔧 constants/ # Global constants
│
├── 🗄️ prisma/
│ ├── 📋 schema/ # Database Schemas
│ │ ├── schema.prisma # Main schema
│ │ ├── users.prisma # User management
│ │ ├── content-management.prisma # CMS features
│ │ └── ai-tools.prisma # AI tools schema
│ ├── 🌱 seeds/ # Sample Data
│ └── 📊 migrations/ # Database migrations
│
└── 📖 docs/ # Documentation
├── 🏗️ architecture.md # Architecture guide
├── 🤖 ai-integration.md # AI features guide
└── 🔐 authentication.md # Auth setup guide
Each feature follows this consistent structure:
// Example: features/ai-tools/
📁 ai-tools/
├── 📄 views/ # Page Components
│ ├── SettingsView.tsx # Main settings page
│ └── index.ts # Barrel exports
├── 🧩 components/ # Feature Components
│ ├── ChatAssistant.tsx # AI chat component
│ ├── ModelSelector.tsx # Model selection
│ └── index.ts # Barrel exports
├── 🪝 hooks/ # Feature Hooks
│ ├── use-ai-models.ts # AI models hook
│ ├── use-chat-api.ts # Chat functionality
│ └── index.ts # Barrel exports
├── ⚙️ services/ # Business Logic
│ ├── get.service.ts # Read operations
│ ├── create.service.ts # Create operations
│ ├── update.service.ts # Update operations
│ └── index.ts # Barrel exports
├── 📋 schemas/ # Validation
│ ├── ai-models.schemas.ts # Zod schemas
│ └── index.ts # Barrel exports
├── 🔧 types/ # TypeScript Types
│ ├── api.types.ts # API types
│ ├── settings.types.ts # Settings types
│ └── index.ts # Barrel exports
└── 📖 docs/ # Feature Documentation
└── README.md # Feature guideThis project follows FDD principles:
- Feature-Centric Organization: Each feature is self-contained
- Domain-Driven Design: Business logic organized by domains
- Modular Architecture: Independent, reusable modules
- SOLID Principles: Clean, maintainable code structure
CorePilot comes with pre-built AI integration features:
- 🤖 AI Chat Assistant - Interactive chat interface with multiple AI models
- 📝 Content Generation - AI-powered content creation tools
- 🔧 Model Management - Easy switching between different AI providers
- 📊 Usage Analytics - Track AI usage and performance metrics
- 🎯 Custom Prompts - Create and manage custom AI prompts
- 🔌 OpenRouter Integration - Access to 400+ AI models via OpenRouter API
// AI Chat Hook Usage
import { useAI } from '@/features/ai-tools/hooks';
const ChatComponent = () => {
const { sendMessage, messages, isLoading } = useAI({
model: 'gpt-4',
systemPrompt: 'You are a helpful assistant.'
});
return (
<div className="chat-container">
{messages.map(msg => (
<div key={msg.id}>{msg.content}</div>
))}
<button onClick={() => sendMessage('Hello!')}>Send</button>
</div>
);
};// Content Generation Service
import { generateContent } from '@/features/ai-tools/services';
const blogPost = await generateContent({
type: 'blog-post',
topic: 'Next.js Best Practices',
tone: 'professional',
length: 'medium'
});# 🏃♂️ Development
npm run dev # Start development server with Turbopack
npm run build # Build for production
npm run start # Start production server
# 🧹 Code Quality
npm run lint # Run Biome linter
npm run lint:fix # Fix linting issues
npm run format # Format code with Biome
npm run check # Run all checks (lint + type-check)
# 📝 TypeScript Type Checking
npm run type-check # Check all TypeScript files
npm run type-check:src # Check only source files (recommended)
npm run type-check:watch # Watch mode for type checking
# 🗄️ Database Management
npm run db:generate # Generate Prisma client
npm run db:push # Push schema to database
npm run db:migrate # Run migrations
npm run db:seed # Seed database with sample data
npm run db:reset # Reset and seed database
npm run db:studio # Open Prisma Studio- 📋 Plan Feature - Define feature requirements and API contracts
- 🗄️ Database First - Create Prisma schema for the feature
- 🔧 Types & Schemas - Define TypeScript types and Zod validation
- ⚙️ Services Layer - Implement business logic and API services
- 🪝 Custom Hooks - Create React hooks for state management
- 🧩 Components - Build reusable UI components
- 📄 Views - Create page components using the feature
- 🔌 API Routes - Implement Next.js API endpoints
- 🧪 Testing - Write unit and integration tests
- 📖 Documentation - Update feature documentation
- 🔒 Type Safety - Use TypeScript strict mode and Zod validation
- ♻️ Reusability - Create composable components and hooks
- 📦 Barrel Exports - Use index.ts files for clean imports
- 🧪 Testing - Write tests for critical business logic
- 📖 Documentation - Document complex features and APIs
- 🔐 Security - Validate all inputs and protect sensitive data
- ⚡ Performance - Optimize for Core Web Vitals and user experience
CorePilot includes comprehensive TypeScript type checking to ensure code quality and prevent runtime errors:
# Type checking commands
npm run type-check # Check all TypeScript files (includes .next types)
npm run type-check:src # Check only source files (recommended for development)
npm run type-check:watch # Watch mode for continuous type checkingtype-check: Full type checking including Next.js generated typestype-check:src: Source-only checking to avoid Next.js build conflictsprebuild: Automatic type checking before production buildsskipLibCheck: Enabled for faster checking of source files
tsconfig.json: Main TypeScript configuration for Next.jstsconfig.src.json: Source-specific configuration for type checking- Strict mode: Enabled for maximum type safety
# If build fails with type errors
npm run type-check:src # Check source files first
npm run build # Then attempt build// ✅ Use proper imports
import { User } from '@/types/user';
import { Button } from '@/components/ui/button';
// ❌ Avoid relative imports outside feature
import { User } from '../../../types/user';# Install type definitions
npm install --save-dev @types/package-name- Run source type check:
npm run type-check:src - Check specific file:
npx tsc --noEmit path/to/file.ts - Enable verbose output: Add
--verboseflag to see detailed information - Skip library checks: Use
--skipLibCheckfor faster checking
The project uses Better Auth with:
- Email/password authentication
- Session management
- Role-based access control
- Email verification
- Password reset functionality
- TailwindCSS v4: Utility-first CSS framework
- ShadcnUI: High-quality React components
- Radix UI: Accessible component primitives
- Dark Mode: Built-in theme switching
For detailed documentation on specific features:
# Install Vercel CLI
npm i -g vercel
# Deploy to Vercel
vercel --prodEnvironment Variables for Vercel:
DATABASE_URL="postgresql://..."
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="https://your-domain.vercel.app"
OPENROUTER_API_KEY="your-openrouter-key"
UPLOADTHING_SECRET="your-uploadthing-secret"- Netlify: Use
npm run buildand deployout/folder - Railway: Connect GitHub repo and set environment variables
- DigitalOcean App Platform: Use Node.js buildpack
- AWS Amplify: Connect repository and configure build settings
-
🍴 Fork the Repository
git clone https://github.com/musayazlik/corepilot.git cd corepilot -
🌿 Create Feature Branch
git checkout -b feature/amazing-feature
-
💻 Make Changes
- Follow the FDD architecture
- Write tests for new features
- Update documentation
-
✅ Run Quality Checks
npm run check # Lint + type check npm run test # Run tests npm run build # Ensure build works
-
📤 Submit Pull Request
- Provide clear description
- Reference related issues
- Include screenshots for UI changes
- 🎯 Feature Requests: Open an issue with detailed requirements
- 🐛 Bug Reports: Include reproduction steps and environment details
- 📖 Documentation: Help improve guides and examples
- 🧪 Testing: Add tests for edge cases and new features
- 🎨 UI/UX: Follow existing design patterns and accessibility standards
- 📖 Documentation: Check the
/docsfolder for detailed guides - 💬 Discussions: Use GitHub Discussions for questions
- 🐛 Issues: Report bugs via GitHub Issues
- 📧 Email: Contact maintainers for urgent matters
If CorePilot helps your project:
- ⭐ Star the repository on GitHub
- 🐦 Share on social media with #CorePilot
- 📝 Write a blog post about your experience
- 🤝 Contribute improvements and new features
Using CorePilot for your project? We'd love to feature it! Open an issue with:
- Project name and description
- Live URL (if available)
- Screenshot or demo
- What features you're using
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - React framework
- Prisma - Database toolkit
- Better Auth - Authentication library
- ShadcnUI - UI components
- TailwindCSS - CSS framework