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