A comprehensive, full-stack support ticket management system built with the MERN stack (MongoDB, Express.js, React, Node.js). This system provides advanced features for managing customer support tickets, tracking performance, and improving service quality.
- Features
- Tech Stack
- Prerequisites
- Installation
- Configuration
- Running the Application
- Demo Credentials
- API Documentation
- Project Structure
- Features Documentation
- Contributing
- License
- β Create, Read, Update, Delete Tickets - Full CRUD operations
- β Ticket Assignment - Assign tickets to agents
- β Status Management - Customizable ticket statuses
- β Priority Levels - Low, Medium, High, Urgent
- β Department Organization - Organize tickets by departments
- β Ticket History - Track all changes and updates
- β Internal Notes - Private notes for agents
- β Ticket Merging - Merge duplicate tickets
- β Ticket Dependencies - Link related tickets
- β File Attachments - Upload and manage files (images, PDFs, documents)
- β Saved Replies - Quick response templates with variables
- β Ticket Templates - Pre-defined ticket templates for common issues
- β CSAT Surveys - Customer satisfaction surveys with NPS scoring
- β Collision Detection - Prevent multiple agents from editing same ticket
- β Real-time Updates - WebSocket-based live notifications
- β Escalation Rules - Automatic ticket escalation based on rules
- β Auto-close Tickets - Automatically close resolved tickets
- β Dashboard Analytics - Overview of ticket metrics
- β Advanced Analytics - Detailed charts and graphs
- β Custom Dashboards - Drag-and-drop widget customization
- β PDF Reports - Generate and download PDF reports
- β Email Scheduling - Schedule automated report emails
- β ML Predictions - Machine learning-based predictions
- β Anomaly Detection - Identify unusual patterns
- β Natural Language Queries - Ask questions in plain English
- β Role-Based Access Control - Admin, Agent, User roles
- β Google OAuth - Sign in with Google
- β Email Authentication - Traditional email/password login
- β User Profiles - Manage user information
- β Audit Logs - Track all user actions
- β Ticket Replies - Comment on tickets
- β Email Notifications - Automated email alerts
- β Real-time Notifications - Instant updates via WebSocket
- β Mention System - @mention users in comments
- React 18 - UI library
- Vite - Build tool and dev server
- React Router - Client-side routing
- Axios - HTTP client
- Socket.io Client - Real-time communication
- Recharts - Data visualization
- Lucide React - Icon library
- React Hot Toast - Notifications
- Tailwind CSS - Utility-first CSS framework
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- Socket.io - Real-time communication
- JWT - Authentication
- Bcrypt - Password hashing
- Multer - File upload handling
- Node-cron - Scheduled tasks
- Nodemailer - Email sending
- PDFKit - PDF generation
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher) - Download
- MongoDB (v5 or higher) - Download or use MongoDB Atlas
- npm or yarn - Package manager (comes with Node.js)
- Git - Version control
git clone https://github.com/yourusername/support-ticket-system.git
cd support-ticket-systemcd backend
npm installcd ../frontend
npm installCreate a .env file in the backend directory:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/ticket-system
# Or use MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/ticket-system
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRE=7d
# Email Configuration (Gmail example)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-specific-password
EMAIL_FROM=noreply@yourdomain.com
# Frontend URL
FRONTEND_URL=http://localhost:5173
# Google OAuth (Optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:5000/api/auth/google/callback
# Escalation Job Configuration
ESCALATION_CHECK_INTERVAL=*/5 * * * *Create a .env file in the frontend directory:
VITE_API_URL=http://localhost:5000/api- Go to Google Account Settings
- Enable 2-Factor Authentication
- Generate an App Password
- Use the App Password in
EMAIL_PASSWORD
- Go to Google Cloud Console
- Create a new project
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
http://localhost:5000/api/auth/google/callbackhttp://localhost:5173/auth/callback
- Copy Client ID and Secret to
.env
cd backend
npm run devThe backend will run on http://localhost:5000
cd frontend
npm run devThe frontend will run on http://localhost:5173
cd frontend
npm run buildcd backend
npm startEmail: admin@example.com
Password: admin123
Role: Admin
Email: agent@example.com
Password: agent123
Role: Agent
Email: user@example.com
Password: user123
Role: User
Note: Create these accounts after running the application for the first time, or use the seed script.
To populate the database with sample data:
cd backend
npm run seedTo seed ticket templates:
cd backend
npm run seed:templateshttp://localhost:5000/api
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /auth/register |
Register new user | No |
| POST | /auth/login |
Login user | No |
| GET | /auth/me |
Get current user | Yes |
| GET | /auth/google |
Google OAuth login | No |
| GET | /auth/google/callback |
Google OAuth callback | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /tickets |
Get all tickets | Yes |
| GET | /tickets/:id |
Get single ticket | Yes |
| POST | /tickets |
Create ticket | Yes |
| PUT | /tickets/:id |
Update ticket | Yes |
| DELETE | /tickets/:id |
Delete ticket | Yes (Admin) |
| POST | /tickets/:id/reply |
Add reply | Yes |
| PUT | /tickets/:id/status |
Change status | Yes |
| PUT | /tickets/:id/assign |
Assign ticket | Yes |
| POST | /tickets/:id/merge |
Merge tickets | Yes |
| POST | /tickets/:id/dependency |
Add dependency | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /departments |
Get all departments | Yes |
| POST | /departments |
Create department | Yes (Admin) |
| PUT | /departments/:id |
Update department | Yes (Admin) |
| DELETE | /departments/:id |
Delete department | Yes (Admin) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /statuses |
Get all statuses | Yes |
| POST | /statuses |
Create status | Yes (Admin) |
| PUT | /statuses/:id |
Update status | Yes (Admin) |
| DELETE | /statuses/:id |
Delete status | Yes (Admin) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /escalations |
Get all rules | Yes (Admin) |
| POST | /escalations |
Create rule | Yes (Admin) |
| PUT | /escalations/:id |
Update rule | Yes (Admin) |
| DELETE | /escalations/:id |
Delete rule | Yes (Admin) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /analytics/overview |
Get overview stats | Yes |
| GET | /analytics/tickets |
Get ticket analytics | Yes |
| GET | /analytics/agents |
Get agent performance | Yes |
| POST | /analytics/pdf |
Generate PDF report | Yes |
| POST | /analytics/schedule |
Schedule email report | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /attachments/upload |
Upload files | Yes |
| GET | /attachments/ticket/:id |
Get ticket attachments | Yes |
| GET | /attachments/:id/download |
Download file | Yes |
| GET | /attachments/:id/view |
View file inline | Yes |
| DELETE | /attachments/:id |
Delete attachment | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /saved-replies |
Get all replies | Yes |
| POST | /saved-replies |
Create reply | Yes |
| PUT | /saved-replies/:id |
Update reply | Yes |
| DELETE | /saved-replies/:id |
Delete reply | Yes |
| POST | /saved-replies/:id/usage |
Record usage | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /ticket-templates |
Get all templates | Yes |
| POST | /ticket-templates |
Create template | Yes |
| PUT | /ticket-templates/:id |
Update template | Yes |
| DELETE | /ticket-templates/:id |
Delete template | Yes |
| POST | /ticket-templates/:id/duplicate |
Duplicate template | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /surveys |
Get all surveys | Yes |
| POST | /surveys |
Create survey | Yes |
| GET | /surveys/analytics |
Get survey analytics | Yes |
| GET | /surveys/public/:token |
Get survey by token | No |
| POST | /surveys/public/:token/submit |
Submit survey | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /ticket-locks/:id/acquire |
Acquire lock | Yes |
| POST | /ticket-locks/:id/release |
Release lock | Yes |
| POST | /ticket-locks/:id/refresh |
Refresh lock | Yes |
| GET | /ticket-locks/:id/check |
Check lock status | Yes |
support-ticket-system/
βββ backend/
β βββ src/
β β βββ config/
β β β βββ database.js
β β β βββ socket.js
β β β βββ upload.js
β β βββ controllers/
β β β βββ analyticsController.js
β β β βββ attachmentController.js
β β β βββ authController.js
β β β βββ departmentController.js
β β β βββ escalationController.js
β β β βββ googleAuthController.js
β β β βββ savedReplyController.js
β β β βββ statusController.js
β β β βββ surveyController.js
β β β βββ ticketController.js
β β β βββ ticketLockController.js
β β β βββ ticketTemplateController.js
β β βββ middleware/
β β β βββ auth.js
β β β βββ errorHandler.js
β β βββ models/
β β β βββ Attachment.js
β β β βββ AuditLog.js
β β β βββ Department.js
β β β βββ EscalationRule.js
β β β βββ SavedReply.js
β β β βββ Status.js
β β β βββ Survey.js
β β β βββ Ticket.js
β β β βββ TicketLock.js
β β β βββ TicketTemplate.js
β β β βββ User.js
β β βββ routes/
β β β βββ analyticsRoutes.js
β β β βββ attachmentRoutes.js
β β β βββ authRoutes.js
β β β βββ departmentRoutes.js
β β β βββ escalationRoutes.js
β β β βββ savedReplyRoutes.js
β β β βββ statusRoutes.js
β β β βββ surveyRoutes.js
β β β βββ ticketLockRoutes.js
β β β βββ ticketRoutes.js
β β β βββ ticketTemplateRoutes.js
β β βββ scripts/
β β β βββ seed.js
β β β βββ seedTicketTemplates.js
β β βββ services/
β β β βββ emailScheduler.js
β β β βββ escalationService.js
β β β βββ mlPredictions.js
β β β βββ pdfService.js
β β βββ utils/
β β β βββ auditLogger.js
β β β βββ ticketNumber.js
β β βββ server.js
β βββ uploads/
β βββ .env
β βββ .gitignore
β βββ package.json
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ AttachmentList.jsx
β β β βββ FileUpload.jsx
β β β βββ Layout.jsx
β β β βββ ProtectedRoute.jsx
β β β βββ SavedReplyPicker.jsx
β β β βββ TicketTemplatePicker.jsx
β β βββ context/
β β β βββ AuthContext.jsx
β β βββ hooks/
β β β βββ useTicketLock.js
β β βββ pages/
β β β βββ AdvancedAnalytics.jsx
β β β βββ Analytics.jsx
β β β βββ AuthCallback.jsx
β β β βββ CreateTicket.jsx
β β β βββ CustomDashboard.jsx
β β β βββ Dashboard.jsx
β β β βββ Departments.jsx
β β β βββ EscalationRules.jsx
β β β βββ Login.jsx
β β β βββ Register.jsx
β β β βββ SavedReplies.jsx
β β β βββ Statuses.jsx
β β β βββ Surveys.jsx
β β β βββ SurveySubmit.jsx
β β β βββ TicketDetail.jsx
β β β βββ TicketList.jsx
β β β βββ TicketTemplates.jsx
β β β βββ Users.jsx
β β βββ services/
β β β βββ api.js
β β β βββ notificationService.js
β β β βββ ticketService.js
β β βββ App.jsx
β β βββ index.css
β β βββ main.jsx
β βββ .env
β βββ .gitignore
β βββ index.html
β βββ package.json
β βββ vite.config.js
βββ .gitignore
βββ README.md
βββ package.json
Create Ticket
- Navigate to "Create Ticket"
- Fill in title, description, priority
- Select department
- Add tags
- Upload attachments
- Submit
View Tickets
- Navigate to "Tickets"
- Filter by status, priority, department
- Search by ticket number or title
- Click to view details
Update Ticket
- Open ticket detail page
- Change status, priority, or assignment
- Add replies and internal notes
- Upload additional files
Upload Files
- Drag and drop files
- Or click to browse
- Supports: Images, PDFs, Documents
- Max 5 files, 10MB each
- Preview images inline
- Download any file
Create Saved Reply
- Navigate to "Saved Replies"
- Click "New Reply"
- Add title and content
- Use variables:
{customer_name},{ticket_id},{agent_name} - Set visibility (Private, Department, Global)
- Add shortcut (e.g.,
/welcome)
Use Saved Reply
- Open ticket detail
- Click "Saved Replies" button
- Search or browse
- Click to insert
- Variables auto-replace
Create Template
- Navigate to "Ticket Templates"
- Click "New Template"
- Fill in default values
- Choose icon and color
- Set visibility
- Save
Use Template
- Click "Use Template" when creating ticket
- Select template
- Form pre-fills
- Modify as needed
- Submit
Send Survey
- Close/resolve a ticket
- Click "Send Survey" button
- Copy survey link
- Share with customer
Customer Completes Survey
- Click survey link
- Rate experience (1-5 stars)
- Provide NPS score (0-10)
- Write feedback
- Submit
View Results
- Navigate to "Surveys"
- View analytics dashboard
- See individual responses
- Track agent performance
How It Works
- Agent A opens ticket
- Agent B opens same ticket
- Agent B sees warning banner
- Agent B's fields are disabled
- Agent A closes ticket
- Agent B can now edit
Visual Indicators
- Yellow warning banner
- Disabled form fields
- Real-time updates
Dashboard
- Overview statistics
- Recent tickets
- Agent performance
- Department metrics
Advanced Analytics
- Detailed charts
- Custom date ranges
- Export to PDF
- Schedule email reports
Custom Dashboard
- Drag and drop widgets
- Customize layout
- Save preferences
Create Rule
- Navigate to "Escalation Rules"
- Set conditions (priority, time, status)
- Define actions (assign, notify, change priority)
- Save rule
Automatic Escalation
- Runs every 5 minutes
- Checks all rules
- Applies actions
- Sends notifications
- JWT Authentication - Secure token-based auth
- Password Hashing - Bcrypt encryption
- Role-Based Access Control - Admin, Agent, User roles
- Input Validation - Sanitize all inputs
- File Upload Security - Type and size validation
- XSS Protection - Prevent cross-site scripting
- CORS Configuration - Controlled cross-origin requests
- Audit Logging - Track all user actions
- Rate Limiting - Prevent abuse (recommended for production)
- Create Heroku app
- Add MongoDB Atlas add-on
- Set environment variables
- Deploy backend
- Build and deploy frontend
- Connect GitHub repository
- Set environment variables
- Deploy
- Connect GitHub repository
- Add MongoDB database
- Set environment variables
- Deploy
cd backend
npm testcd frontend
npm testContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Hemal Katariya - MERN Stack Developer - GitHub
- React team for the amazing framework
- MongoDB team for the database
- All contributors who helped with this project
For support, email connect.hemal@gmail.com or join our Slack channel.
- Mobile app (React Native)
- Multi-language support
- Advanced reporting
- Integration with Slack/Teams
- AI-powered ticket routing
- Customer portal
- Knowledge base
- Live chat integration
- Average response time: < 200ms
- Supports 1000+ concurrent users
- Real-time updates via WebSocket
- Optimized database queries
- Efficient file handling
If you find this project useful, please consider giving it a star on GitHub!
Made with β€οΈ by Hemal Katariya