A modern, type-safe dashboard application built with Next.js 15+, featuring:
- 🔐 Role-based authentication with NextAuth.js
- 📊 Dynamic dashboard widgets with real-time data
- 📝 Server-side CRUD operations with Zod validation
- 🎨 Beautiful UI with Shadcn/ui and Tailwind
- 🛠️ Resource-based architecture with builder pattern
- 🚀 CLI tools for rapid development
- Instruction About how this project is built and what you can expect from this project.
- HOW TO USE About how to use this project for the first time.
- GUIDE If you are Developer, you can use this guide to understand the code and how to extend this project.
If you like this project, you can buy me a coffee:
- Email/password authentication with NextAuth.js
- Role-based access control (Admin, Editor, Viewer)
- Protected routes and API endpoints
- Session management with JWT
- Resource-level permissions
- Real-time statistics with server actions
- Customizable widgets with builder pattern
- Interactive data tables with sorting and filtering
- Activity feeds and audit trails
- Responsive layout with mobile support
- Server-side CRUD operations
- Form validation with Zod
- Advanced data tables with:
- Sorting and filtering
- Pagination
- Bulk actions
- Search functionality
- Resource-based architecture
- Type-safe API endpoints
- TypeScript for type safety
- Resource-based architecture
- CLI tools for scaffolding:
- Model creation with database schema
- Dashboard page generation
- Resource configuration
- Comprehensive documentation
- Hot module reloading
- Node.js 18+
- PostgreSQL
- pnpm
- Clone the repository:
git clone https://github.com/yourusername/next-dashboard.git
cd next-dashboard
- Install dependencies:
pnpm install
- Set up environment variables:
cp .env.example .env
- Update
.env
with your configuration:
DATABASE_URL="postgresql://username:password@localhost:5432/next_dashboard"
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"
- Initialize the database:
pnpm prisma db push
- Start the development server:
pnpm dev
Visit http://localhost:3000 to see your dashboard.
pnpm create-model --name="Product" --fields="
name: z.string().min(1, 'Name is required'),
price: z.number().min(0),
stock: z.number().min(0),
status: z.enum(['draft', 'published'])
"
pnpm create-model-speed
This interactive CLI tool will guide you through:
- Model name and fields
- Field types and validations
- Relations and constraints
- Dashboard page creation
- Database schema updates
pnpm create-page --name="feature" --route="feature" --title="Feature Management" --description="Manage your features"
pnpm push-model
Selectively push models to your database without data loss.
pnpm create-user --name="User Name" --email="user@example.com" --password="password" --role="ROLE"
src/
├── app/ # Next.js app router pages
├── components/ # React components
│ ├── dashboard/ # Dashboard-specific components
│ ├── ui/ # Base UI components
│ └── widgets/ # Dashboard widgets
├── lib/ # Utility functions
├── builders/ # Builder pattern implementations
└── resources/ # Resource configurations
└── [resource]/ # Resource-specific files
├── schema.ts # Zod schema
├── actions.ts # Server actions
├── routes.ts # Route config
└── index.ts # Resource config
pnpm dev
- Start development serverpnpm build
- Build for productionpnpm start
- Start production serverpnpm lint
- Run ESLintpnpm create-model
- Interactive model creationpnpm create-model-speed
- Quick model creationpnpm create-page
- Generate a new pagepnpm push-model
- Push models to database
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this project helpful, please give it a ⭐️ on GitHub!