How dhairya-code/ai-customer-support-ticketing-system works
ResolveAI is an AI-first customer-support application. Customers authenticate, ask questions in chat, receive knowledge-base answers or Gemini responses, and can be escalated into persistent tickets. Customers then track and reply to their tickets; staff authenticate separately, triage the queue, manage ticket status and metadata, and send public replies or internal notes. The graph preserves these documented capabilities; some subsystem links rely on README descriptions because their implementation files were not sampled.
Main entry points: route.ts Chat endpoint · tickets.ts Ticket and customer thread service · staff-tickets.ts Triage and staff thread service · index.ts Database client
Components 24
Identity and access
- Customer sign-in
src/components/auth/login-form.tsx - Staff sign-in
src/components/auth/staff-login-form.tsx - Auth service
src/lib/auth.ts - Session and role guards
src/lib/session.ts
Customer support
- AI support chat
src/components/chat/customer-chat.tsx - Chat endpoint
src/app/api/chat/route.ts - Chat validation
src/lib/chat.ts - Knowledge base
src/lib/knowledge-base.ts - Gemini assistant
src/lib/gemini.ts - Ticket and customer thread service
src/lib/tickets.ts - Customer ticket pages
src/app/(customer)/tickets/[id]/page.tsx - Customer reply actions
src/app/(customer)/tickets/[id]/actions.ts
Staff operations
- Staff queue and metrics
src/app/admin/page.tsx - Staff ticket detail
src/app/admin/tickets/[id]/page.tsx - Staff ticket actions
src/app/admin/tickets/[id]/actions.ts - Triage and staff thread service
src/lib/staff-tickets.ts
Data and integrations
- Ticket email notifications
src/lib/email.ts - Database client
src/db/index.ts - Users tickets messages
src/db/schema.ts
Other components
- Customer
- Support staff
- Neon PostgreSQL
- Google Gemini
- Resend email
Connections 37
- Customer → Customer sign-in: signs in
README.md - Customer sign-in → Auth service: authenticates
src/components/auth/login-form.tsx - Support staff → Staff sign-in: signs in
README.md - Staff sign-in → Auth service: authenticates
src/components/auth/staff-login-form.tsx - Staff sign-in → Session and role guards: checks staff role
src/app/admin/login/page.tsx - Customer → AI support chat: asks question
README.md - AI support chat → Chat endpoint: sends chat
src/app/api/chat/route.ts - Chat endpoint → Session and role guards: checks session
src/app/api/chat/route.ts - Chat endpoint → Chat validation: validates input
src/app/api/chat/route.ts - Chat endpoint → Knowledge base: consults
src/app/api/chat/route.ts - Chat endpoint → Gemini assistant: requests response
src/app/api/chat/route.ts - Gemini assistant → Google Gemini: calls model
README.md - Chat endpoint → Ticket and customer thread service: creates escalation ticket
README.md - Ticket and customer thread service → Users tickets messages: writes ticket and transcript
src/lib/tickets.ts - Chat endpoint → Ticket email notifications: sends escalation notices
src/app/api/chat/route.ts - Ticket email notifications → Resend email: sends email
README.md - Customer → Customer ticket pages: tracks ticket
README.md - Customer ticket pages → Session and role guards: requires customer
src/app/(customer)/tickets/[id]/page.tsx - Customer ticket pages → Ticket and customer thread service: loads thread
src/app/(customer)/tickets/[id]/page.tsx - Customer ticket pages → Customer reply actions: submits reply
src/app/(customer)/tickets/[id]/page.tsx - Customer reply actions → Ticket and customer thread service: adds reply
- Support staff → Staff queue and metrics: triages queue
README.md - Staff queue and metrics → Session and role guards: requires staff
src/app/admin/page.tsx - Staff queue and metrics → Triage and staff thread service: loads queue metrics
src/app/admin/page.tsx - Support staff → Staff ticket detail: manages ticket
README.md - Staff ticket detail → Session and role guards: requires staff
src/app/admin/tickets/[id]/page.tsx - Staff ticket detail → Triage and staff thread service: loads ticket thread
src/app/admin/tickets/[id]/page.tsx - Staff ticket detail → Staff ticket actions: submits changes
src/app/admin/tickets/[id]/page.tsx - Staff ticket actions → Triage and staff thread service: updates ticket
- Triage and staff thread service → Users tickets messages: reads and writes
src/lib/staff-tickets.ts - Staff ticket actions → Ticket email notifications: notifies on reply
- Ticket email notifications → Users tickets messages: reads recipient
src/lib/email.ts - Database client → Neon PostgreSQL: connects
src/db/index.ts - Ticket and customer thread service → Database client: queries
src/lib/tickets.ts - Triage and staff thread service → Database client: queries
src/lib/staff-tickets.ts - Auth service → Database client: persists auth data
src/lib/auth.ts - Database client → Users tickets messages: uses schema
src/db/index.ts