A modern full-stack application combining Next.js 15 with KeystoneJS 6, featuring admin dashboard implementation and sophisticated role-based permissions.
This project features a modern admin architecture with:
- Backend: KeystoneJS 6 providing GraphQL API, authentication, and database operations
- Frontend: Custom Next.js admin dashboard with enhanced UI components
- Image Support: S3-compatible image storage and management
- Next.js 15 with App Router
- React 19 with TypeScript
- Radix UI primitives for accessible components
- Tailwind CSS 4 for styling
- Remix Icons (@remixicon/react) for icons
- SWR for client-side data fetching
- TipTap for rich text editing
- React Hook Form for form management
- Zod for schema validation
- KeystoneJS 6 for GraphQL API and admin interface
- Prisma ORM for database operations
- GraphQL Yoga for GraphQL server
- PostgreSQL database
- S3-compatible storage for image management
- Role-based access control with granular permissions
- Dynamic field controllers with conditional behavior
- Rich text editing with document fields
- Relationship management with inline editing capabilities
- Image upload and management with S3 storage
- Inline create/edit components for seamless UX
- Advanced filtering system for all field types
- Responsive design with mobile support
- Node.js 18+
- PostgreSQL database
-
Clone and install dependencies:
git clone https://github.com/junaid33/next-keystone-starter cd next-keystone-starter npm install -
Configure environment variables:
cp env.example .env
Update
.envwith your database configuration:DATABASE_URL=postgresql://username:password@localhost:5432/database_name SESSION_SECRET=your-super-secret-session-key-change-this-in-production
-
Start development server:
npm run dev
This will:
- Build KeystoneJS schema
- Run database migrations
- Start Next.js development server with Turbopack
-
Access the application:
- Frontend: http://localhost:3000
- Dashboard: http://localhost:3000/dashboard
- GraphQL API: http://localhost:3000/api/graphql
npm run dev- Build Keystone + migrate + start Next.js dev servernpm run build- Build Keystone + migrate + build Next.js for productionnpm run migrate:gen- Generate and apply new database migrationsnpm run migrate- Deploy existing migrations to databasenpm run lint- Run ESLint
- Endpoint:
/api/graphql - Features: Full CRUD operations, relationships, authentication
- Playground: Available in development mode
- User - Authentication and user management
- Role - Role-based access control
- Todo - Example content model with relationships
- TodoImage - Image management for Todo items with S3 storage
Sophisticated role-based permissions including:
canAccessDashboard,canManagePeople,canManageRolescanCreateTodos,canManageAllTodoscanSeeOtherPeople,canEditOtherPeople
├── app/ # Next.js App Router
│ ├── api/
│ │ └── graphql.ts # GraphQL API endpoint
│ └── dashboard/ # Admin dashboard pages
├── features/
│ ├── keystone/ # Backend configuration
│ │ ├── models/ # Keystone list definitions
│ │ ├── access.ts # Permission logic
│ │ └── mutations/ # Custom GraphQL mutations
│ └── dashboard/ # Admin interface implementation
│ ├── actions/ # Server actions
│ ├── components/ # Reusable UI components
│ ├── screens/ # Page-level components
│ └── views/ # Field type implementations
├── keystone.ts # KeystoneJS configuration
└── schema.prisma # Database schema
- GraphQL endpoint available at
/api/graphql - Field implementations follow KeystoneJS controller patterns
- Permission checks are integrated throughout the UI layer
- Server actions used for data mutations in dashboard components
- Inline editing components provide seamless UX for relationship management
- Image uploads configured for S3-compatible storage
- Advanced filtering supports all field types including documents, JSON, and images
The application can be deployed to any platform supporting Node.js and PostgreSQL:
- Set up PostgreSQL database
- Configure environment variables
- Run
npm run build - Run
npm start
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request