Skip to content

Modern ticket management system with email integration, real-time collaboration, and customizable workflows built with Next.js 15

License

Notifications You must be signed in to change notification settings

jonax1337/Ticket-System

Repository files navigation

๐ŸŽฏ Professional Ticket Management System

Version Node.js Next.js React TypeScript Prisma SQLite TailwindCSS License

A comprehensive, enterprise-grade ticket management system designed for professional IT teams and customer service operations. This self-hosted solution provides advanced email integration, automated workflows, intelligent template management, and powerful analyticsโ€”all with a modern, intuitive interface.

๐Ÿ”— Quick Links: Demo โ€ข Installation โ€ข Features โ€ข API Docs โ€ข Contributing


๐Ÿš€ Key Highlights

โœจ 2024-2025 Major Updates

  • ๐ŸŽจ Revolutionary Email Template System - No-code section builder with drag & drop
  • ๐Ÿ”„ Intelligent Email Processing - Multi-account IMAP sync with smart reply detection
  • ๐ŸŽฏ Advanced Workflow Automation - Due dates, SLA tracking, and auto-escalation
  • ๐ŸŒˆ Dynamic Theme Engine - 10+ preset themes + custom color picker
  • ๐Ÿ“ฑ Mobile-First Experience - Fully responsive with touch-optimized interactions
  • ๐Ÿ” Enterprise Security - Role-based access, audit trails, and session management

๐Ÿ“š Table of Contents


๐Ÿš€ Features

๐ŸŽฏ Core Ticket Management

  • ๐ŸŽซ Intelligent Ticket System - Auto-generated ticket numbers, custom workflows, queue-based routing
  • ๐Ÿ’ฌ Unified Communication - Internal/external comments with full email thread preservation
  • ๐Ÿ‘ฅ Advanced Participant Management - CC/BCC tracking, external user involvement, notification preferences
  • ๐Ÿ” Smart Search & Filtering - Multi-criteria filters, saved presets, fuzzy search with Fuse.js
  • ๐Ÿ“Ž Comprehensive File Handling - Drag & drop uploads, MIME validation, UUID-based storage
  • โฐ Workflow Automation - Due dates, reminders, SLA tracking, auto-close functionality

๐Ÿ“ง Revolutionary Email Integration

  • ๐Ÿ”„ Multi-Account IMAP Sync - Unlimited email accounts with individual sync intervals
  • ๐Ÿง  Smart Reply Detection - Advanced regex patterns for automatic ticket threading
  • ๐Ÿ›ก๏ธ Duplicate Prevention - Content-based and timing algorithms prevent duplicate tickets
  • ๐Ÿ“จ Intelligent Email Processing - Automatic participant extraction, attachment handling
  • ๐ŸŽฏ Advanced Filtering - Subject/sender regex filters, folder monitoring, action rules

๐ŸŽจ No-Code Email Template System (Latest Innovation)

  • ๐ŸŽฏ Visual Section Builder - Drag & drop email content creation without HTML knowledge
  • ๐Ÿ“ Pre-Built Templates - 8 professional section templates (Ticket Info, Status Changes, Comments, etc.)
  • ๐Ÿ”ง Smart Configuration - Checkbox-based options, variable dropdowns, live preview
  • ๐ŸŽ›๏ธ Template Management - One-click reset to defaults, template duplication, style variants
  • ๐Ÿ”„ Backward Compatibility - Seamless migration from HTML-based to visual sections
  • ๐Ÿ“ฑ Responsive Design - Mobile-optimized templates with automatic formatting

๐ŸŒˆ Advanced User Experience

  • ๐ŸŽจ Dynamic Theme System - 10+ predefined themes, custom color picker with live preview
  • ๐Ÿ“ฑ Mobile-First Design - Touch-optimized interactions, responsive breakpoints
  • โšก Performance Optimized - Server components, lazy loading, optimistic UI updates
  • ๐ŸŽญ Smooth Animations - Framer Motion integration with micro-interactions
  • ๐Ÿ”” Real-Time Notifications - In-app notification center with read status tracking
  • ๐ŸŒ Accessibility First - ARIA compliance, keyboard navigation, screen reader support

๐Ÿข Enterprise Features

  • ๐Ÿ” Role-Based Security - Admin/Supporter roles with granular permissions
  • ๐Ÿ“Š Advanced Analytics - Ticket volume charts, performance metrics, trend analysis
  • ๐Ÿท๏ธ Custom Workflows - Dynamic status/priority systems with icons and colors
  • ๐Ÿ“‹ Queue Management - Departmental routing, workload balancing, user assignments
  • โš™๏ธ Deep Customization - Logo uploads, brand colors, app naming, automation rules
  • ๐Ÿ”„ Background Services - Automated cron jobs, health monitoring, service recovery

๐Ÿš€ Technical Excellence

  • ๐Ÿ—๏ธ Modern Architecture - Next.js 15 App Router, React 19, TypeScript 5.8
  • ๐Ÿ—„๏ธ Optimized Database - SQLite with strategic indexing and query optimization
  • ๐Ÿ”ง Developer Experience - Comprehensive type safety, extensive documentation
  • ๐Ÿ“ˆ Performance Monitoring - Built-in analytics, error tracking, health checks
  • ๐Ÿ”„ Scalable Design - Microservice-ready architecture with clean separation

๐Ÿ› ๏ธ Technology Stack

๐Ÿ—๏ธ Core Framework

Next.js TypeScript React Prisma

  • Frontend: Next.js 15.4.1 with App Router and React Server Components
  • Language: TypeScript 5.8.3 with strict mode and comprehensive type safety
  • Database: SQLite with Prisma ORM for optimized performance
  • Authentication: NextAuth.js 4.24.11 with JWT and session management

๐ŸŽจ UI & Design

TailwindCSS ShadCN/UI Radix UI Framer Motion

  • Styling: TailwindCSS 3.4.1 with dynamic CSS variables and theme system
  • Components: ShadCN/UI + Radix UI primitives for accessibility
  • Icons: Lucide React with 1000+ icons and custom icon system
  • Animations: Framer Motion for smooth micro-interactions

๐Ÿ“ง Email & Communication

ImapFlow MailParser

  • IMAP Processing: ImapFlow 1.0.191 for robust email server connections
  • Email Parsing: MailParser 3.7.4 for advanced content extraction
  • Template Engine: Custom HTML/text templates with variable substitution
  • Visual Builder: No-code section builder for email customization

๐Ÿ”ง Backend Services

  • File Handling: Multer 2.0.2 with UUID-based storage and MIME validation
  • Rich Text Editor: Lexical 0.33.1 for advanced comment editing
  • Search: Fuse.js 7.1.0 for intelligent fuzzy search
  • Date Processing: date-fns 4.1.0 for comprehensive date manipulation
  • Performance: Built-in caching, lazy loading, and optimized queries

โšก Quick Start

๐Ÿ“‹ Prerequisites

System Requirements:

  • Node.js: 18.x or higher (Download)
  • npm: 9.x+ (included with Node.js) or yarn/pnpm
  • Email Server: IMAP/SMTP access for email integration (optional but recommended)

Recommended Environment:

  • RAM: 4GB+ available memory
  • Storage: 2GB+ free space (more for file attachments)
  • OS: Linux (Ubuntu 20.04+), macOS (10.15+), or Windows 10+ with WSL2

๐Ÿš€ Installation

  1. Clone and install dependencies:

    git clone https://github.com/jonax1337/Ticket-System.git
    cd Ticket-System
    npm install
  2. Configure environment variables:

    cp .env.example .env

    Edit .env with your configuration:

    # Database (SQLite by default)
    DATABASE_URL="file:./dev.db"
    
    # NextAuth Configuration
    NEXTAUTH_URL="http://localhost:3000"
    NEXTAUTH_SECRET="your-strong-secret-key-here"
    
    # Optional: Email Automation
    ENABLE_EMAIL_CRON=true
    TICKET_AUTOMATION_ENABLED=true
  3. Setup database:

    npx prisma generate
    npx prisma db push
  4. Start the application:

    npm run dev
  5. Complete setup: Visit http://localhost:3000 and follow the setup wizard to create your admin account and configure basic settings.

๐Ÿ”ง Post-Installation Setup

After installation, configure these essential features:

  1. Admin Account: Create your first administrator account through the setup wizard
  2. Email Integration: Add IMAP/SMTP accounts in Admin โ†’ Email Settings
  3. Customization: Upload logo, set theme colors, and customize branding
  4. User Management: Create supporter accounts and assign queues
  5. Workflow Configuration: Set up custom statuses, priorities, and automation rules

๐Ÿ“ธ Screenshots

๐ŸŽฏ Dashboard Overview

Modern, clean interface with powerful ticket management:

  • Smart Ticket List - Sortable columns, advanced filtering, bulk operations
  • Real-Time Search - Instant results with multi-criteria filtering
  • Status Indicators - Visual priority and status badges with custom colors
  • Quick Actions - One-click ticket assignment, status updates, and commenting

๐Ÿ“ฑ Mobile Experience

Fully responsive design optimized for mobile workflows:

  • Touch-Optimized Interface - Gesture-friendly interactions and navigation
  • Responsive Tables - Adaptive layouts for different screen sizes
  • Mobile Notifications - Native-like notification experience
  • Offline Capability - Basic functionality when connectivity is limited

โš™๏ธ Admin Panel

Comprehensive administration with intuitive controls:

  • User Management - Role assignment, queue allocation, permission control
  • System Configuration - Branding, themes, automation settings
  • Email Template Designer - Visual email builder with live preview
  • Analytics Dashboard - Performance metrics and trend analysis

๐ŸŽจ Theme Customization

Advanced theming system with real-time preview:

  • 10+ Preset Themes - Professional color schemes (Default, Blue, Green, Purple, Red, etc.)
  • Custom Color Picker - Unlimited color possibilities with HSL support
  • Logo Management - Upload and preview custom logos
  • Brand Consistency - Automatic color derivation for UI components

๐Ÿ“ง Email Template Designer (Revolutionary Feature)

No-code email template creation:

  • Visual Section Builder - Drag & drop email content without HTML knowledge
  • Template Gallery - 8 pre-built professional templates
  • Smart Configuration - Checkbox options, variable dropdowns, style variants
  • Live Preview - Real-time email preview with sample data
  • Mobile Preview - See how emails look on different devices

๐Ÿ”ง Configuration

๐ŸŒ Environment Variables

Variable Description Default Example
DATABASE_URL SQLite database file path file:./dev.db file:./production.db
NEXTAUTH_URL Application base URL http://localhost:3000 https://yourdomain.com
NEXTAUTH_SECRET Session encryption key (required) your-super-secret-jwt-key
SKIP_SETUP Skip initial setup wizard false true
ENABLE_EMAIL_CRON Enable automatic email sync true false
CRON_SECRET External cron endpoint secret (optional) cron-webhook-secret
TICKET_AUTOMATION_ENABLED Enable ticket automation true false
TICKET_AUTOMATION_WARNING_DAYS Days before warning 7 5
TICKET_AUTOMATION_CLOSE_DAYS Days before auto-close 14 30

โš™๏ธ System Configuration

Configure these settings through the admin panel:

๐ŸŽจ Branding & Appearance

  • App Name: Customize the application name and title
  • Logo Upload: Upload custom logos (PNG, JPG, SVG supported)
  • Theme Selection: Choose from preset themes or create custom colors
  • Color Customization: Advanced color picker with HSL support
  • Typography: Custom font selection and scaling

๐ŸŽซ Ticket Management

  • Ticket Numbering: Sequential or random number generation
  • Custom Statuses: Create status workflows with icons and colors
  • Priority Levels: Define priority hierarchies with visual indicators
  • Queue System: Departmental routing and workload balancing
  • Automation Rules: Due date tracking, escalation, and auto-close

๐Ÿ“ง Email Integration

  • IMAP Accounts: Configure multiple email accounts for ticket creation
  • SMTP Settings: Outbound email configuration for notifications
  • Sync Intervals: Individual account sync scheduling
  • Email Filters: Subject and sender regex filtering
  • Template Management: Visual email template designer

๐Ÿ“ง Email Integration

๐Ÿš€ Advanced Email Processing Engine

The system features a sophisticated IMAP-based email-to-ticket conversion system with enterprise-level capabilities:

Multi-Account Architecture

  • Unlimited Accounts: Configure multiple email accounts with independent settings
  • Smart Sync Intervals: Individual sync schedules per account (default: 5 minutes)
  • Folder Monitoring: Monitor specific IMAP folders or entire mailboxes
  • Connection Health: Automatic connection monitoring and recovery

Intelligent Email Processing

  • Smart Reply Detection: Advanced regex patterns automatically thread email replies
  • Duplicate Prevention: Content-based and timing algorithms prevent duplicate tickets
  • Participant Management: Automatic extraction of all email participants (FROM, TO, CC, BCC)
  • Attachment Processing: Seamless file upload integration with UUID-based storage
  • HTML/Text Processing: Intelligent content extraction and formatting preservation

Advanced Configuration Options

// Email Account Configuration
{
  host: "imap.gmail.com",
  port: 993,
  username: "[email protected]",
  password: "app-password",
  useSSL: true,
  folder: "INBOX",
  syncInterval: 300, // seconds
  processOnlyUnread: true,
  subjectFilter: "\\[SUPPORT\\].*",
  fromFilter: ".*@company\\.com",
  emailAction: "mark_read", // or "delete", "move"
  moveToFolder: "Processed",
  defaultPriority: "Medium",
  defaultStatus: "Open",
  defaultAssigneeId: "user-id"
}

Email Filters & Rules

  • Subject Filtering: Regex patterns for selective email processing
  • Sender Filtering: Allow/block specific email addresses or domains
  • Content Analysis: Spam detection and content validation
  • Post-Processing Actions: Mark as read, delete, or move to folders

๐Ÿ”„ Background Processing

Automated Sync Services

  • Server-Side Cron Manager: Handles multiple account syncing
  • Configuration Change Detection: Automatic service restart on settings updates
  • External Cron Support: REST API endpoints for external scheduling systems
  • Health Monitoring: Email sync status tracking and error reporting

Performance & Reliability

  • Error Recovery: Graceful error handling with automatic retry mechanisms
  • Rate Limiting: Prevents email server overload
  • Connection Pooling: Efficient IMAP connection management
  • Memory Optimization: Large email handling without memory leaks

๐ŸŽจ Email Template System

๐Ÿš€ Revolutionary No-Code Template Builder (Latest Innovation)

The new visual email template system eliminates the need for HTML knowledge while providing powerful customization options:

Visual Section Builder

  • Drag & Drop Interface: Intuitive section management with reordering
  • Pre-Built Templates: 8 professional section templates for common use cases
  • Smart Configuration: Checkbox-based options instead of HTML editing
  • Variable Assistance: Dropdown menus for available template variables
  • Live Preview: Real-time email preview with realistic sample data

Professional Section Templates

Template Description Use Case
๐ŸŽซ Ticket Information Automatic ticket details display Show ticket number, subject, status, priority
๐Ÿ”„ Status Change Status update notifications Display previous/new status with reasons
๐Ÿ’ฌ Comment Display New comment presentation Show comment content with author and timestamp
๐Ÿ“ Custom Text Flexible text content Add custom messages with variable support
๐Ÿ“‹ Action Instructions Step-by-step guidance Provide bulleted action lists for customers
โš ๏ธ Warning Notice Important alerts Display warnings and urgent information
๐Ÿ“ž Contact Information Support contact details Show support email and contact options
๐Ÿ‘ฅ Participant Info Participant notifications Display participant addition details

Template Features

  • Style Variants: Info, Success, Warning, Error, Default styling options
  • Conditional Content: Smart content display based on available data
  • Variable Substitution: 25+ available variables for dynamic content
  • Mobile Optimization: Responsive email design for all devices
  • Reset Functionality: One-click return to default templates

Available Template Variables

// Ticket Information
{{ticketNumber}}     // T-123456
{{ticketSubject}}    // Ticket title
{{ticketStatus}}     // Current status
{{ticketPriority}}   // Priority level
{{ticketCreatedAt}}  // Creation date

// User Information  
{{customerName}}     // Customer name
{{customerEmail}}    // Customer email
{{assignedToName}}   // Assigned agent
{{actorName}}        // Action performer

// System Information
{{systemName}}       // Application name
{{supportEmail}}     // Support contact
{{currentDate}}      // Current date
{{currentTime}}      // Current time

// Status Changes
{{previousStatus}}   // Old status
{{newStatus}}        // New status
{{statusChangeReason}} // Change reason

// Comments
{{commentContent}}   // Comment HTML
{{commentAuthor}}    // Comment author
{{commentCreatedAt}} // Comment date

// Participants
{{participantName}}  // Participant name
{{participantType}}  // Participant role

Template Management

  • Visual Editor: Point-and-click section configuration
  • Template Gallery: Browse and select from pre-built templates
  • Duplication: Copy existing sections for quick customization
  • Bulk Operations: Enable/disable multiple sections
  • Export/Import: Share templates between installations

๐ŸŽฏ Template Configuration Per Email Type

Each email type supports complete customization:

Ticket Created

  • Welcome message and ticket confirmation
  • Ticket details section with configurable fields
  • Contact information and next steps
  • Custom branding and styling

Status Changed

  • Status change notification with previous/new status
  • Change reason and actor information
  • Updated ticket details
  • Action instructions for customer

Comment Added

  • New comment notification
  • Full comment content with formatting
  • Author information and timestamp
  • Ticket context and details

Participant Added

  • Participant welcome notification
  • Role and permission information
  • Ticket context and access details
  • Contact information

Automation Warning

  • Inactivity warning with urgency indicators
  • Clear action instructions
  • Deadline information
  • Contact options for assistance

Automation Closed

  • Closure notification with summary
  • Ticket resolution information
  • Reopen instructions
  • Satisfaction survey (optional)

๐Ÿ”„ Backward Compatibility

  • Seamless Migration: Existing HTML templates automatically converted
  • Hybrid Support: Both visual and HTML editing available
  • Data Preservation: No loss of existing template customizations
  • Gradual Adoption: Switch to visual builder at your own pace

๐Ÿ‘ฅ User Management

๐Ÿ” Role-Based Access Control

Administrator Role

Full System Access:

  • โœ… Complete user management (create, edit, delete, role assignment)
  • โœ… System configuration (themes, branding, automation settings)
  • โœ… Email account management and template configuration
  • โœ… Analytics and reporting access
  • โœ… Queue management and workflow configuration
  • โœ… All ticket management capabilities
  • โœ… Security settings and audit log access

Supporter Role

Ticket-Focused Access:

  • โœ… View and manage all tickets within assigned queues
  • โœ… Create internal comments and customer communications
  • โœ… Update ticket status, priority, and assignments
  • โœ… File attachment handling and management
  • โœ… Personal "My Tickets" dashboard
  • โœ… Basic profile and password management
  • โŒ No user management or system configuration access
  • โŒ Limited to assigned queues and tickets

๐Ÿ‘ค User Profile Management

Personal Settings

  • Profile Information: Name, email, contact details
  • Avatar Upload: Custom profile pictures with image optimization
  • Password Management: Secure password changes with strength validation
  • Notification Preferences: Email and in-app notification settings
  • Theme Preferences: Personal theme selection and customization
  • Language Settings: Multi-language support (when available)

Security Features

  • Password Hashing: bcrypt with configurable salt rounds
  • Session Management: JWT-based secure session handling
  • Two-Factor Authentication: TOTP support (when configured)
  • Login Audit: Track login attempts and security events
  • Permission Verification: Real-time permission checking
  • Session Timeout: Configurable session expiration

๐Ÿข Team & Queue Management

Queue System

  • Departmental Organization: Organize tickets by department or category
  • User Assignment: Assign users to specific queues
  • Workload Balancing: Automatic ticket distribution
  • Priority Routing: High-priority tickets to experienced agents
  • Escalation Rules: Automatic escalation based on time or complexity

User Analytics

  • Performance Metrics: Tickets resolved, response times, satisfaction scores
  • Workload Analysis: Current assignment load and capacity
  • Activity Tracking: Login history, ticket interactions, system usage
  • Team Performance: Comparative analysis and team statistics

๐Ÿš€ Deployment

๐Ÿณ Docker Deployment

Quick Docker Setup

# Dockerfile
FROM node:18-alpine

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm ci --only=production

# Copy application code
COPY . .

# Generate Prisma client and build
RUN npx prisma generate
RUN npm run build

# Create data directory for SQLite
RUN mkdir -p /app/data

EXPOSE 3000
CMD ["npm", "start"]
# Build and run
docker build -t ticket-system .
docker run -p 3000:3000 \
  -v ticket-data:/app/data \
  --env-file .env \
  ticket-system

Docker Compose Setup

# docker-compose.yml
version: '3.8'
services:
  ticket-system:
    build: .
    ports:
      - "3000:3000"
    volumes:
      - ./data:/app/data
      - ./uploads:/app/uploads
    environment:
      - DATABASE_URL=file:/app/data/production.db
      - NEXTAUTH_URL=http://localhost:3000
      - NEXTAUTH_SECRET=your-production-secret
    restart: unless-stopped

โ˜๏ธ Cloud Platform Deployment

Vercel (Recommended)

  1. Connect Repository: Import from GitHub/GitLab
  2. Environment Variables: Configure in Vercel dashboard
  3. Database Setup: Use Vercel Postgres or external SQLite hosting
  4. Deploy: Automatic deployment on push
# Vercel CLI deployment
npm i -g vercel
vercel
vercel --prod

Railway

# Railway deployment
npm i -g @railway/cli
railway login
railway init
railway up

Heroku

# Heroku deployment
heroku create your-app-name
heroku config:set NEXTAUTH_SECRET=your-secret
git push heroku main

๐Ÿ—๏ธ Self-Hosted Deployment

Production Server Setup

# 1. Server preparation (Ubuntu/Debian)
sudo apt update && sudo apt upgrade -y
sudo apt install -y nodejs npm nginx certbot

# 2. Application setup
git clone https://github.com/jonax1337/Ticket-System.git
cd Ticket-System
npm install
npm run build

# 3. Process management with PM2
npm install -g pm2
pm2 start npm --name "ticket-system" -- start
pm2 startup
pm2 save

# 4. Nginx reverse proxy
sudo nano /etc/nginx/sites-available/ticket-system
# Configure nginx (see below)
sudo ln -s /etc/nginx/sites-available/ticket-system /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

# 5. SSL certificate
sudo certbot --nginx -d yourdomain.com

Nginx Configuration

server {
    listen 80;
    server_name yourdomain.com;
    
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}

๐Ÿ“Š Production Considerations

Performance Optimization

  • Database Optimization: Regular VACUUM operations for SQLite
  • File Storage: Consider object storage for attachments (S3, CloudFlare R2)
  • CDN Setup: Static asset delivery optimization
  • Caching: Redis for session storage and caching
  • Monitoring: Application performance monitoring (APM)

Security Hardening

  • Environment Variables: Secure secret management
  • HTTPS: Always use SSL/TLS in production
  • Firewall: Restrict access to necessary ports only
  • Updates: Regular security updates and patches
  • Backups: Automated database and file backups

Scaling Considerations

  • Load Balancing: Multiple application instances
  • Database Scaling: Consider PostgreSQL for high traffic
  • File Storage: Distributed file storage systems
  • Email Processing: Separate email processing workers
  • Monitoring: Comprehensive monitoring and alerting

๐Ÿ’ป Development

๐Ÿ“‹ Development Scripts

# Development
npm run dev          # Start development server with hot reload
npm run build        # Build optimized production bundle
npm run start        # Start production server
npm run lint         # Run ESLint code quality checks
npm run typecheck    # Run TypeScript type checking

# Database Management
npx prisma generate  # Generate Prisma client after schema changes
npx prisma db push   # Push schema changes to database
npx prisma migrate dev    # Create and apply migration (recommended)
npx prisma migrate deploy # Apply migrations in production
npx prisma studio    # Open visual database browser
npx prisma db seed   # Run database seeder (if configured)

# Email Testing
npm run email:test   # Test email configuration
npm run email:sync   # Manual email sync trigger

๐Ÿ—๏ธ Development Setup

Local Development Environment

# 1. Clone and setup
git clone https://github.com/jonax1337/Ticket-System.git
cd Ticket-System
npm install

# 2. Environment configuration
cp .env.example .env
# Edit .env with your settings

# 3. Database setup
npx prisma generate
npx prisma db push

# 4. Start development
npm run dev

Development Tools & Extensions

Recommended VS Code Extensions:

  • Prisma: Database schema IntelliSense
  • TypeScript Hero: Advanced TypeScript support
  • Tailwind CSS IntelliSense: CSS class autocompletion
  • ESLint: Code quality and formatting
  • Prettier: Code formatting
  • GitLens: Git integration and history

Development Dependencies:

{
  "@types/node": "^20",
  "@types/react": "^19", 
  "@types/react-dom": "^19",
  "autoprefixer": "^10.4.17",
  "eslint": "^9",
  "postcss": "^8.4.35",
  "tailwindcss": "^3.4.1",
  "typescript": "5.8.3"
}

๐Ÿ”ง Development Guidelines

Code Style & Standards

  • TypeScript: Strict mode enabled, comprehensive type coverage
  • ESLint: Enforced code quality rules and best practices
  • Prettier: Consistent code formatting across the project
  • Component Structure: Organized in logical feature-based folders
  • API Routes: RESTful conventions with proper error handling

Database Development

# Schema changes workflow
1. Edit prisma/schema.prisma
2. npx prisma migrate dev --name describe_change
3. npx prisma generate
4. Test changes locally
5. Commit migration files

# Reset database (development only)
npx prisma migrate reset

Testing Strategy

  • Component Testing: Test React components in isolation
  • API Testing: Test API endpoints with various scenarios
  • Integration Testing: Test complete user workflows
  • E2E Testing: Full application testing with Playwright
  • Email Testing: Mock email providers for development

Performance Optimization

  • React Server Components: Minimize client-side JavaScript
  • Image Optimization: Next.js image optimization for uploads
  • Database Queries: Use Prisma query optimization
  • Caching: Implement strategic caching for frequently accessed data
  • Bundle Analysis: Regular bundle size analysis and optimization

๐Ÿš€ Feature Development Workflow

Adding New Features

  1. Design Phase: Plan feature architecture and database changes
  2. Database Schema: Update Prisma schema if needed
  3. API Development: Create necessary API endpoints
  4. Frontend Development: Build user interface components
  5. Integration: Connect frontend with backend APIs
  6. Testing: Comprehensive testing of new functionality
  7. Documentation: Update documentation and README

Email Template Development

// Adding new section template
export const NEW_TEMPLATE: SectionTemplate = {
  id: 'custom_template',
  name: 'Custom Template',
  description: 'Description of the template',
  category: 'custom',
  icon: '๐ŸŽฏ',
  preview: 'Preview text',
  fields: [
    {
      id: 'field1',
      type: 'text',
      label: 'Field Label',
      required: true
    }
  ],
  generateHtml: (fieldValues) => {
    return `<p>Generated HTML content</p>`
  }
}

๐Ÿ” Debugging & Troubleshooting

Common Development Issues

  • Database Sync Issues: Run npx prisma migrate reset and npx prisma db push
  • Type Errors: Ensure npx prisma generate after schema changes
  • Build Errors: Check TypeScript errors with npm run typecheck
  • Email Sync Issues: Verify IMAP credentials and connection settings
  • Authentication Issues: Check NextAuth configuration and secrets

Development Tools

  • Prisma Studio: Visual database browser and editor
  • React DevTools: Component state and props inspection
  • Network Tab: API request/response debugging
  • Console Logs: Structured logging for debugging
  • Error Tracking: Comprehensive error reporting and tracking

๐Ÿ“– API & Integrations

๐Ÿ”Œ RESTful API Architecture

The system provides a comprehensive REST API for external integrations and custom development:

Authentication & Security

// API Authentication
Headers: {
  'Authorization': 'Bearer JWT_TOKEN',
  'Content-Type': 'application/json'
}

// Session-based authentication for web interface
// JWT tokens for API access
// Role-based access control (RBAC)

Core API Endpoints

Ticket Management:

GET    /api/tickets                    // List tickets with filtering
POST   /api/tickets                    // Create new ticket
GET    /api/tickets/:id                // Get ticket details
PUT    /api/tickets/:id                // Update ticket
DELETE /api/tickets/:id                // Delete ticket
POST   /api/tickets/:id/comments       // Add comment
GET    /api/tickets/:id/participants   // Get participants
POST   /api/tickets/:id/participants   // Add participant

User Management:

GET    /api/users                      // List users
POST   /api/users                      // Create user
GET    /api/users/:id                  // Get user details
PUT    /api/users/:id                  // Update user
DELETE /api/users/:id                  // Delete user
POST   /api/users/:id/avatar           // Upload avatar

Email Integration:

GET    /api/admin/email                // List email accounts
POST   /api/admin/email                // Create email account
PUT    /api/admin/email/:id            // Update email account
POST   /api/admin/email/:id/test       // Test email connection
POST   /api/admin/email/:id/sync       // Manual sync trigger
GET    /api/admin/email/sync-status    // Get sync status

Email Templates:

GET    /api/admin/email-templates/types              // List email types
GET    /api/admin/email-templates/types/:type        // Get type config
PUT    /api/admin/email-templates/types/:type        // Update type config
POST   /api/admin/email-templates/types/:type/reset  // Reset to default
POST   /api/admin/email-templates/base/preview       // Preview template

Webhook Support

// Incoming webhooks for external integrations
POST   /api/webhooks/tickets          // Create ticket via webhook
POST   /api/webhooks/status           // Update ticket status
POST   /api/webhooks/comment          // Add comment via webhook

// Outgoing webhooks (configurable)
- Ticket created/updated events
- Comment added events  
- Status change events
- User assignment events

๐Ÿ”— Integration Examples

Slack Integration

// Send ticket notifications to Slack
const slackNotification = {
  channel: '#support',
  text: `New ticket created: ${ticket.subject}`,
  attachments: [{
    color: 'good',
    fields: [
      { title: 'Ticket ID', value: ticket.ticketNumber, short: true },
      { title: 'Priority', value: ticket.priority, short: true },
      { title: 'Status', value: ticket.status, short: true }
    ]
  }]
}

await fetch(SLACK_WEBHOOK_URL, {
  method: 'POST',
  body: JSON.stringify(slackNotification)
})

External CRM Integration

// Sync tickets with external CRM
const crmData = {
  external_id: ticket.id,
  title: ticket.subject,
  description: ticket.description,
  status: ticket.status,
  contact_email: ticket.fromEmail,
  created_at: ticket.createdAt
}

await fetch('https://api.crm.com/tickets', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer CRM_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(crmData)
})

Custom Email Processing

// External email processing service
POST /api/cron/email-sync
Headers: {
  'X-Cron-Secret': process.env.CRON_SECRET
}

// Response includes processing statistics
{
  "success": true,
  "accounts_processed": 3,
  "total_imported": 15,
  "total_skipped": 2,
  "total_errors": 0,
  "processing_time": "2.3s"
}

๐Ÿ“Š Analytics & Reporting API

// Ticket analytics
GET /api/analytics/tickets/volume      // Ticket volume over time
GET /api/analytics/tickets/status      // Status distribution
GET /api/analytics/tickets/priority    // Priority breakdown
GET /api/analytics/performance         // Agent performance metrics
GET /api/analytics/resolution-time     // Average resolution times

// System health
GET /api/system/health                 // Overall system health
GET /api/system/email-status           // Email sync status
GET /api/system/performance            // Performance metrics

๐Ÿ› ๏ธ SDK & Libraries

JavaScript/TypeScript SDK

import { TicketSystemClient } from '@ticket-system/sdk'

const client = new TicketSystemClient({
  baseURL: 'https://your-instance.com',
  apiKey: 'your-api-key'
})

// Create ticket
const ticket = await client.tickets.create({
  subject: 'API Integration Issue',
  description: 'Having trouble with API integration',
  priority: 'High',
  fromEmail: '[email protected]'
})

// Add comment
await client.tickets.addComment(ticket.id, {
  content: 'Working on the integration issue',
  isInternal: false
})

Python Client Library

from ticket_system import TicketSystemClient

client = TicketSystemClient(
    base_url='https://your-instance.com',
    api_key='your-api-key'
)

# Create ticket
ticket = client.tickets.create(
    subject='Python Integration',
    description='Testing Python client library',
    priority='Medium',
    from_email='[email protected]'
)

# List tickets
tickets = client.tickets.list(
    status='Open',
    priority='High',
    limit=50
)

๐Ÿ” API Security

Authentication Methods

  • JWT Tokens: Stateless API authentication
  • API Keys: Simple authentication for service integrations
  • Session Cookies: Web application authentication
  • OAuth 2.0: Third-party application authentication (planned)

Rate Limiting

// Rate limiting configuration
{
  windowMs: 15 * 60 * 1000,  // 15 minutes
  max: 100,                   // 100 requests per window
  message: 'Too many requests, please try again later'
}

// Per-endpoint rate limiting
{
  '/api/tickets': { max: 50 },
  '/api/users': { max: 20 },
  '/api/admin/*': { max: 10 }
}

Data Validation

  • Input Sanitization: All inputs validated and sanitized
  • Schema Validation: Zod-based request/response validation
  • Type Safety: Full TypeScript coverage for API contracts
  • Error Handling: Consistent error responses with proper HTTP status codes

๐Ÿค Contributing

We welcome contributions from the community! Here's how to get involved:

๐Ÿš€ Getting Started

  1. Fork the Repository

    # Fork on GitHub, then clone locally
    git clone https://github.com/YOUR_USERNAME/Ticket-System.git
    cd Ticket-System
  2. Setup Development Environment

    npm install
    cp .env.example .env
    npx prisma generate
    npx prisma db push
    npm run dev
  3. Create Feature Branch

    git checkout -b feature/amazing-new-feature

๐Ÿ“ Development Guidelines

Code Standards

  • TypeScript: Use strict typing, avoid any types
  • ESLint: Follow established linting rules
  • Prettier: Maintain consistent code formatting
  • Comments: Document complex logic and API changes
  • Naming: Use descriptive, self-documenting names

Commit Convention

# Commit message format
type(scope): description

# Examples
feat(email): add visual template builder
fix(auth): resolve session timeout issue
docs(readme): update installation instructions
refactor(api): optimize ticket query performance

Testing Requirements

  • Unit Tests: Test individual functions and components
  • Integration Tests: Test API endpoints and workflows
  • UI Tests: Test user interface interactions
  • Email Tests: Mock email providers for testing

๐Ÿ› Bug Reports

Before Submitting:

  • Search existing issues to avoid duplicates
  • Test with the latest version
  • Gather detailed reproduction steps

Bug Report Template:

## Bug Description
Brief description of the issue

## Steps to Reproduce
1. Step one
2. Step two
3. Step three

## Expected Behavior
What should happen

## Actual Behavior
What actually happens

## Environment
- OS: [e.g., Ubuntu 20.04]
- Node.js: [e.g., 18.17.0]
- Browser: [e.g., Chrome 115]
- Version: [e.g., 0.1.0]

## Additional Context
Screenshots, logs, or other relevant information

๐Ÿ’ก Feature Requests

Feature Request Template:

## Feature Description
Clear description of the proposed feature

## Use Case
Why this feature would be valuable

## Proposed Implementation
How you think it should work

## Alternatives Considered
Other approaches you've thought about

## Additional Context
Mockups, examples, or related features

๐Ÿ”ง Development Areas

High-Priority Contributions

  • ๐ŸŒ Internationalization: Multi-language support implementation
  • ๐Ÿ“ฑ Mobile App: React Native companion app
  • ๐Ÿ”Œ Integrations: Slack, Teams, Discord, Zendesk connectors
  • ๐Ÿ“Š Advanced Analytics: Custom dashboards and reporting
  • ๐Ÿ” SSO Integration: SAML, LDAP, Active Directory support

Documentation Improvements

  • API Documentation: OpenAPI 3.0 specification
  • Tutorial Content: Step-by-step guides and tutorials
  • Video Guides: Screen recordings for complex features
  • Translation: Documentation in multiple languages

Performance Optimizations

  • Database Optimization: Query performance improvements
  • Caching Strategy: Redis integration and caching layers
  • Bundle Optimization: JavaScript bundle size reduction
  • Image Processing: Advanced image optimization and compression

๐ŸŽฏ Contribution Workflow

  1. Issue Discussion: Discuss major changes in issues first
  2. Development: Implement changes following guidelines
  3. Testing: Ensure all tests pass and add new tests
  4. Documentation: Update relevant documentation
  5. Pull Request: Submit PR with clear description
  6. Code Review: Address feedback and iterate
  7. Merge: Maintainers merge approved PRs

๐Ÿ† Recognition

Contributors are recognized in:

  • README Contributors Section: Public recognition
  • Release Notes: Feature attribution in releases
  • Hall of Fame: Special recognition for significant contributions
  • Beta Access: Early access to new features and releases

๐Ÿ“ž Community & Support

  • GitHub Discussions: General questions and community discussion
  • Discord Server: Real-time chat and collaboration (coming soon)
  • Monthly Calls: Virtual meetups for contributors (planned)
  • Documentation Wiki: Community-maintained documentation

๐Ÿ“„ License

This project is open source and available under the MIT License.

MIT License

Copyright (c) 2024 Ticket System Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿค License Benefits

  • โœ… Commercial Use: Use in commercial projects
  • โœ… Modification: Modify source code freely
  • โœ… Distribution: Distribute copies and modifications
  • โœ… Private Use: Use for private/internal projects
  • โœ… Patent Grant: Protection against patent claims

๐Ÿ“‹ License Requirements

  • ๐Ÿ“ License Notice: Include license in distributions
  • ๐Ÿ“ Copyright Notice: Preserve copyright notices
  • ๐Ÿ“ Attribution: Credit original authors

๐Ÿ†˜ Support & Community

๐Ÿ› Issue Reporting

๐Ÿ’ฌ Community Channels

๐Ÿ“Š Project Statistics

GitHub stars GitHub forks GitHub issues GitHub pull requests GitHub last commit GitHub license

๐Ÿ—บ๏ธ Roadmap & Future Plans

๐ŸŽฏ Planned Features (Next 6 Months)

  • ๐Ÿ”Œ Webhook Integrations - Slack, Teams, Discord, and custom endpoints
  • ๐Ÿ“– API Documentation - Complete OpenAPI 3.0 specification with Swagger UI
  • ๐Ÿ“Š Advanced Analytics - Custom dashboards, SLA tracking, and performance metrics
  • ๐Ÿ”„ Bulk Operations - Mass ticket updates, batch assignments, multi-select actions
  • ๐Ÿ—๏ธ Custom Fields - Dynamic ticket metadata with validation and conditional logic
  • ๐ŸŒ Multi-language Support - Full i18n with RTL support and locale formatting

๐Ÿš€ Long-term Vision (6-12 Months)

  • ๐Ÿ“ฑ Mobile Applications - Native iOS and Android apps with offline capability
  • ๐Ÿ” SSO Integration - SAML, LDAP, Active Directory, and OAuth providers
  • ๐Ÿ“š Knowledge Base - Integrated documentation system with search and suggestions
  • ๐Ÿค– AI Assistant - Intelligent ticket categorization and response suggestions
  • ๐Ÿข Multi-tenant Support - Support for multiple organizations in single instance
  • ๐Ÿ“ˆ Advanced Reporting - Custom report builder with scheduled exports

๐Ÿ”ง Recent Major Updates

  • โœ… Visual Email Template Builder - No-code section creation with drag & drop
  • โœ… Enhanced Email Processing - Multi-account sync with smart reply detection
  • โœ… Advanced Theme System - Custom color picker with 10+ preset themes
  • โœ… Modern Architecture - Next.js 15, React 19, TypeScript 5.8 upgrade
  • โœ… Database Migration - Seamless MySQL to SQLite migration support
  • โœ… Security Enhancements - Improved authentication and authorization
  • โœ… Performance Optimization - Server components and optimized queries
  • โœ… Mobile Responsiveness - Complete mobile-first design overhaul

๐ŸŽ‰ Community Achievements

  • ๐ŸŒŸ GitHub Stars: Growing community of users and contributors
  • ๐Ÿ”ง Active Development: Regular updates and feature releases
  • ๐Ÿ› Issue Resolution: Fast response times and community support
  • ๐Ÿ“š Documentation: Comprehensive guides and API documentation
  • ๐Ÿ›ก๏ธ Security: Regular security audits and vulnerability assessments

๐ŸŽฏ Why Choose This Ticket System?

๐Ÿš€ Enterprise-Ready from Day One

  • Production-Tested: Battle-tested architecture with comprehensive security
  • Scalable Design: Grows with your organization from startup to enterprise
  • Modern Technology: Built with the latest frameworks and best practices
  • Self-Hosted: Complete control over your data and infrastructure
  • Cost-Effective: No per-agent fees or monthly subscriptions

๐ŸŽจ Unmatched Customization

  • Visual Email Builder: Revolutionary no-code template system
  • Theme System: Unlimited visual customization options
  • Workflow Flexibility: Adapt to any support process or methodology
  • API-First: Integrate with any existing tools or systems
  • Open Source: Modify anything to fit your exact needs

๐Ÿ”ง Developer-Friendly

  • Modern Stack: Next.js 15, React 19, TypeScript 5.8
  • Clean Architecture: Well-documented, maintainable codebase
  • Comprehensive APIs: RESTful APIs for all functionality
  • Active Community: Growing ecosystem of contributors and users
  • Extensive Documentation: Detailed guides for every aspect

๐Ÿ“ˆ Future-Proof Investment

  • Regular Updates: Continuous improvement and new features
  • Community-Driven: Roadmap influenced by real user needs
  • Standards-Based: Built on web standards and best practices
  • Migration-Friendly: Easy to migrate data in and out
  • Vendor-Independence: Never locked into proprietary systems

๐ŸŒŸ Built with โค๏ธ for IT Support Teams and Customer Service Excellence

Transform your support operations with a modern, intelligent, and completely customizable ticket management system.


About

Modern ticket management system with email integration, real-time collaboration, and customizable workflows built with Next.js 15

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •  

Languages