Skip to content

rishishanbhag/Ticket-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎫 Ticket AI - Intelligent Support Ticket Management System

A modern, full-stack ticket management system powered by AI for intelligent ticket triage, automated assignment, and streamlined workflow management.

✨ Features

πŸ€– AI-Powered Ticket Analysis

  • Automatic Priority Detection: AI analyzes tickets and assigns priority levels (Low, Medium, High)
  • Smart Skill Matching: Identifies required technical skills for each ticket
  • Intelligent Assignment: Automatically assigns tickets to moderators with matching skills
  • Helpful Notes Generation: Provides detailed analysis and helpful resources for resolution

πŸ‘₯ User Management & Roles

  • Multi-Role System: User, Moderator, and Admin roles with different permissions
  • Skill-Based Matching: Users can have skills for intelligent ticket assignment
  • Admin Panel: Comprehensive user management with role and skill editing

πŸ“§ Automated Notifications

  • Welcome Emails: Automated welcome messages for new users
  • Assignment Notifications: Email alerts when tickets are assigned to moderators
  • Background Processing: Uses Inngest for reliable background job processing

🎨 Modern UI/UX

  • Responsive Design: Works seamlessly on desktop and mobile
  • Real-time Updates: Dynamic ticket status updates
  • Markdown Support: Rich text formatting in ticket notes
  • Intuitive Navigation: Clean, modern interface built with React and Tailwind CSS

πŸ—οΈ Architecture

Frontend

  • React 19 with modern hooks and components
  • Tailwind CSS 4 for responsive styling
  • DaisyUI for consistent UI components
  • React Router for client-side routing
  • React Markdown for rich text rendering

Backend

  • Node.js with Express.js framework
  • MongoDB with Mongoose ODM
  • JWT Authentication for secure user sessions
  • bcrypt for password hashing
  • CORS enabled for cross-origin requests

AI & Automation

  • Google Gemini AI for intelligent ticket analysis
  • Inngest for background job processing
  • Nodemailer for email notifications
  • Mailtrap for email testing

πŸš€ Quick Start

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB Atlas account or local MongoDB instance
  • Google AI API key (Gemini)
  • Mailtrap account for email testing

Installation

  1. Clone the repository

    git clone <repository-url>
    cd Ai_agent
  2. Install dependencies

    # Install server dependencies
    cd server
    npm install
    
    # Install client dependencies
    cd ../client
    npm install
  3. Environment Setup

    Server (.env)

    PORT=3000
    MONGO_URI=your_mongodb_connection_string
    GEMINI_API_KEY=your_google_ai_api_key
    JWT_SECRET=your_jwt_secret_key
    
    # Mailtrap SMTP Configuration
    MAILTRAP_SMTP_HOST=sandbox.smtp.mailtrap.io
    MAILTRAP_SMTP_PORT=2525
    MAILTRAP_SMTP_USER=your_mailtrap_user
    MAILTRAP_SMTP_PASS=your_mailtrap_password

    Client (.env)

    VITE_SERVER_URL=http://localhost:3000
  4. Start the application

    Terminal 1 - Start the server:

    cd server
    npm run dev

    Terminal 2 - Start the client:

    cd client
    npm run dev

    Terminal 3 - Start Inngest (for background jobs):

    cd server
    npm run inngest-dev
  5. Access the application

πŸ“ Project Structure

Ai_agent/
β”œβ”€β”€ client/                 # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable React components
β”‚   β”‚   β”‚   β”œβ”€β”€ check-auth.jsx
β”‚   β”‚   β”‚   └── navbar.jsx
β”‚   β”‚   β”œβ”€β”€ page/          # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ admin.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ login.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ signup.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ticket.jsx
β”‚   β”‚   β”‚   └── tickets.jsx
β”‚   β”‚   β”œβ”€β”€ assets/        # Static assets
β”‚   β”‚   β”œβ”€β”€ index.css      # Global styles
β”‚   β”‚   └── main.jsx       # App entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”œβ”€β”€ server/                # Node.js backend application
β”‚   β”œβ”€β”€ controllers/       # Route handlers
β”‚   β”‚   β”œβ”€β”€ ticket.controller.js
β”‚   β”‚   └── user.controller.js
β”‚   β”œβ”€β”€ middleware/        # Custom middleware
β”‚   β”‚   └── auth.js
β”‚   β”œβ”€β”€ models/           # Database models
β”‚   β”‚   β”œβ”€β”€ ticket.model.js
β”‚   β”‚   └── user.models.js
β”‚   β”œβ”€β”€ routes/           # API routes
β”‚   β”‚   β”œβ”€β”€ ticket.routes.js
β”‚   β”‚   └── user.routes.js
β”‚   β”œβ”€β”€ inngest/          # Background job functions
β”‚   β”‚   β”œβ”€β”€ client.js
β”‚   β”‚   └── functions/
β”‚   β”‚       β”œβ”€β”€ on-ticket-create.js
β”‚   β”‚       └── OnSignup.js
β”‚   β”œβ”€β”€ utils/            # Utility functions
β”‚   β”‚   β”œβ”€β”€ api.js        # AI integration
β”‚   β”‚   └── mailer.js     # Email utilities
β”‚   β”œβ”€β”€ index.js          # Server entry point
β”‚   └── package.json
└── README.md

πŸ”§ API Endpoints

Authentication

  • POST /api/users/signup - User registration
  • POST /api/users/login - User login
  • POST /api/users/logout - User logout

User Management

  • GET /api/users/user - Get current user info
  • POST /api/users/update-user - Update user (Admin only)

Tickets

  • GET /api/tickets - Get all tickets (filtered by role)
  • GET /api/tickets/:id - Get specific ticket
  • POST /api/tickets - Create new ticket

Background Jobs

  • POST /api/inngest - Inngest webhook endpoint

πŸ” User Roles & Permissions

User

  • Create and view their own tickets
  • Update personal profile

Moderator

  • View all tickets
  • Access detailed ticket information including AI analysis
  • Receive ticket assignments based on skills

Admin

  • Full system access
  • User management capabilities
  • Role and skill assignment
  • View all tickets and users

πŸ€– AI Integration

The system uses Google's Gemini AI to automatically analyze tickets and provide:

  • Priority Assessment: Automatically categorizes tickets as Low, Medium, or High priority
  • Skill Identification: Determines required technical skills for resolution
  • Solution Guidance: Provides helpful notes and potential solutions
  • Resource Links: Suggests relevant documentation and resources

πŸ“§ Email Automation

Automated email notifications for:

  • Welcome emails for new user registrations
  • Assignment notifications when tickets are assigned to moderators
  • Status updates for ticket progress (configurable)

πŸ› οΈ Development

Available Scripts

Server:

  • npm run dev - Start development server with nodemon
  • npm run inngest-dev - Start Inngest development server

Client:

  • npm run dev - Start Vite development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

Database Schema

User Model:

{
  email: String (required, unique),
  password: String (required, hashed),
  role: String (enum: ["user", "moderator", "admin"]),
  skills: [String],
  createdAt: Date
}

Ticket Model:

{
  title: String,
  description: String,
  status: String (default: "TODO"),
  createdBy: ObjectId (ref: User),
  assignedTo: ObjectId (ref: User),
  priority: String,
  deadline: Date,
  helpfulNotes: String,
  relatedSkills: [String],
  createdAt: Date
}

πŸš€ Deployment

Production Environment Setup

  1. Environment Variables: Update production URLs and API keys
  2. Database: Configure production MongoDB instance
  3. Email Service: Set up production email service (replace Mailtrap)
  4. Build: Run npm run build in client directory
  5. Server: Deploy server with PM2 or similar process manager

Recommended Hosting

  • Frontend: Vercel, Netlify, or similar static hosting
  • Backend: Railway, Render, or AWS EC2
  • Database: MongoDB Atlas
  • Email: SendGrid, AWS SES, or similar production email service

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the ISC License.

πŸ‘¨β€πŸ’» Author

Created by Rishi Shanbhag


πŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues section
  2. Create a new issue with detailed information
  3. Contact the maintainer

⭐ Star this repository if you find it helpful!

About

AI-powered support ticket management system with intelligent triage, automated assignment, and skill-based routing using Google Gemini AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages