Enterprise-Grade Customer Support Platform
A modern, full-stack help desk system built with cutting-edge technologies.
Featuring real-time ticket management, knowledge base, and comprehensive admin controls.
Features β’ Tech Stack β’ Quick Start β’ Architecture β’ Screenshots
- Multi-Role System - User, Staff, and Admin roles with granular permissions
- Smart Ticket Management - Priority-based routing, status tracking, and rich-text responses
- Knowledge Base - Searchable, categorized articles with draft/published workflow
- Real-Time Updates - Server Actions for instant UI updates without page reloads
- Rich Text Editor - Full-featured WYSIWYG editor with React Quill integration
- Dark/Light Theme - System preference detection with user override and persistent storage
- Internationalization - Multi-language support (English, Arabic, Spanish, French) with locale switching
- Ticket submission with file attachments
- Real-time ticket status tracking
- Searchable knowledge base
- Ticket history and thread views
- Unified ticket queue with advanced filtering
- Inline ticket management (status, priority, assignment)
- Knowledge base article authoring
- Customer communication tools
- Team Management - User roles, permissions, and email verification
- System Settings - Configurable business rules and email templates
- Analytics & Reporting - Ticket metrics, response times, and performance KPIs
- Category Management - Organize tickets and KB articles
- Email Templates - Customizable notification templates
- Better Auth integration for secure authentication
- Math-based CAPTCHA on login and signup to prevent abuse
- Password reset flow with email verification
- Session management with role-based access control
- Protected routes and API endpoints
- Graceful email fallback when API keys are not configured
- Next.js 16 (App Router, Turbopack, Server Components)
- React 19 (Latest features including Server Actions)
- TypeScript 5 (Type safety across the stack)
- Tailwind CSS v4 (Utility-first styling)
- React Quill (Rich text editing)
- next-themes (Dark/Light mode support)
- Next.js API Routes (RESTful endpoints)
- Server Actions (Type-safe mutations)
- Better Auth 1.4 (Authentication & authorization)
- Prisma ORM 7.1 (Type-safe database client)
- PostgreSQL (Primary database)
- Prisma Migrations (Schema versioning)
- Bun (Fast package manager and runtime)
- Biome (Lightning-fast linting & formatting)
- TypeScript strict mode (Maximum type safety)
- Prisma Studio (Database GUI)
node >= 18.17.0
bun >= 1.0.0 (or npm/yarn/pnpm)
postgresql >= 14- Clone the repository
git clone https://github.com/tarpagad/nesk.git
cd nesk- Install dependencies
bun install- Set up environment variables
cp .env.example .envEdit .env with your configuration:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/nesk"
# Auth
BETTER_AUTH_SECRET="your-secret-key-here"
BETTER_AUTH_URL="http://localhost:3000"
# Email (Optional - defaults to console logging in dev)
RESEND_API_KEY="your-resend-api-key"
# PUBLIC URL
NEXT_PUBLIC_URL="your-deployed-public-url"- Initialize the database
# Generate Prisma client
bun run db:generate
# Push schema to database
bun run db:push
# Seed with sample data
bun run db:seed- Start the development server
bun devVisit http://localhost:3000 π
Admin: [email protected]
Staff: [email protected]
Staff: [email protected]
Note: Create passwords via signup flow or update roles in Prisma Studio
nesk/
βββ src/
β βββ app/
β β βββ actions/ # Server Actions (type-safe mutations)
β β βββ admin/ # Admin panel pages
β β βββ staff/ # Staff dashboard pages
β β βββ auth/ # Authentication flows
β β βββ tickets/ # Public ticket pages
β β βββ kb/ # Knowledge base
β β βββ api/ # API routes
β βββ components/ # Reusable React components
β βββ lib/ # Utilities & configurations
β β βββ auth.ts # Better Auth setup
β β βββ auth-client.ts # Client-side auth hooks
β β βββ i18n.tsx # Client i18n provider & hooks
β β βββ i18n-server.ts # Server-side locale detection
β β βββ prisma.ts # Prisma client instance
β β βββ email.ts # Email service
β βββ locales/ # Translation JSON files (en, ar, es, fr)
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ seed.ts # Sample data seeder
β βββ types/ # TypeScript type definitions
βββ public/ # Static assets
βββ prisma.config.ts # Prisma configuration
- Server Components - Default for data fetching and SEO
- Client Components - Interactive UI with "use client" directive
- Server Actions - Type-safe form submissions and mutations
- Route Handlers - RESTful API endpoints for Better Auth
- Middleware - Session validation and route protection
User (Better Auth)
βββ Tickets (Customer support requests)
βββ Accounts (OAuth providers)
βββ Sessions (Active user sessions)
Ticket
βββ Category (Categorization)
βββ Priority (Urgency levels)
βββ TicketReply (Conversation threads)
KbArticle (Knowledge base)
βββ Category
βββ TeamMember (Author)
Settings (System configuration)
EmailTemplate (Notification templates)/- Homepage with KB search and ticket submission/kb- Knowledge base articles listing/kb/[id]- View individual KB article/tickets/submit- Submit new support ticket/tickets/status- Check ticket status by ID and email
/auth/signin- User login (with CAPTCHA protection)/auth/signup- User registration (with CAPTCHA protection)/auth/forgot-password- Password reset request/auth/reset-password- Set new password
/staff- Dashboard with ticket overview and statistics/staff/tickets- All tickets with filtering and search/staff/tickets/[id]- Individual ticket view and management/staff/kb- Knowledge base management/staff/kb/new- Create new KB article/staff/kb/edit/[id]- Edit existing KB article
/admin- Admin dashboard with analytics/admin/team- Team member management (roles, permissions)/admin/categories- Ticket and KB category management/admin/email-templates- Email notification templates/admin/settings- System configuration (email, security, etc.)/admin/reports- Performance analytics and metrics
- User - Customer accounts (with Better Auth)
- TeamMember - Staff user accounts (email, name, role)
- Ticket - Support tickets (status, priority, category, replies)
- TicketReply - Ticket messages and notes (internal/public)
- TicketAttachment - File attachments on tickets
- KbArticle - Knowledge base articles (title, content, keywords, status)
- Category - Categorization for tickets and KB articles
- Priority - Ticket priority levels (Low, Medium, High, Critical)
- Settings - System configuration (key-value pairs)
- EmailTemplate - Customizable email notification templates
# Generate Prisma Client
bun run db:generate
# Create migration
bun run db:migrate
# Push schema (dev only)
bun run db:push
# Open Prisma Studio (GUI)
bun run db:studio
# Seed database with sample data
bun run db:seedThe application includes built-in dark/light theme support powered by next-themes:
- Theme Toggle: Located in the top navbar on all pages
- Persistence: User preference is saved to localStorage
- System Detection: Defaults to OS preference (dark/light) on first visit
- Override: Users can manually toggle theme which persists across sessions
- Coverage: All pages, components, and custom styles support both themes
The application supports multiple languages with a complete i18n infrastructure:
- Supported Languages: English (en), Arabic (ar), Spanish (es), French (fr)
- Language Switcher: Dropdown selector in the navbar for easy switching
- Persistence: Selected language saved in cookies and persists across sessions
- Auto-Detection: Falls back to browser's Accept-Language header
- Locale-Aware: Date/time formatting respects the selected language
- Complete Coverage: All UI strings, labels, and messages are fully translated
- Translation Files: Located in
src/locales/as JSON dictionaries
# Lint & format check
bun run lint
# Auto-fix formatting
bun run format- Development: Console logging for emails, hot reload enabled
- Production: Real email sending via Resend, optimized builds
- β Password hashing with bcrypt
- β Math-based CAPTCHA on authentication forms to prevent bot abuse
- β CSRF protection via Better Auth
- β SQL injection prevention via Prisma
- β XSS protection via React's built-in escaping
- β Role-based access control (RBAC)
- β Secure session management
- β Email verification workflow
- β Password reset with token expiration
- β Graceful fallback when email service is unavailable (logs user intent instead of sending)
- Vercel - Zero-config deployment for Next.js
- Railway - Simple PostgreSQL hosting
- Render - Full-stack deployments
- Fly.io - Global edge deployment
- Set
NODE_ENV=production - Configure production database URL
- Set secure
BETTER_AUTH_SECRET - Enable real email sending (Resend API key)
- Run database migrations
- Set up monitoring (Sentry, LogRocket)
- Configure CDN for static assets
Contributions are welcome! This project demonstrates:
- Modern Next.js 16 patterns
- Production-grade TypeScript
- Clean architecture principles
- Comprehensive feature implementation
MIT License - feel free to use this project for learning or commercial purposes.
- Next.js 16 with App Router setup
- PostgreSQL + Prisma ORM configuration
- Tailwind CSS v4 + shadcn/ui components
- Ticket submission and tracking
- Knowledge base with search and categories
- Email notifications (Resend integration)
- Authentication system (Better Auth)
- Ticket management dashboard
- Knowledge base management
- Team collaboration features
- Role-based access control (Admin, Agent, User)
- Team member management
- Email template customization
- System settings and configuration
- Analytics and reporting dashboard
- System preference detection
- Theme toggle with persistent storage
- Full application coverage
- Multi-language support (English, Arabic, Spanish, French)
- Language switcher with cookie-based persistence
- Server-side locale detection from Accept-Language header
- Fully translated UI across all pages and components
- Locale-aware date/time formatting
- Translation infrastructure with JSON dictionaries
- File attachments (Cloudflare R2)
- SLA tracking and automation
- Customer satisfaction surveys
- Additional language support
Built with:
- Next.js - React framework
- Better Auth - Authentication
- Prisma - Database ORM
- Tailwind CSS - Styling
- React Quill - Rich text editor
Made with β€οΈ using Next.js 16 and React 19
β Star this repo if you find it useful!