Support Ticket System
Vibe44 includes a built-in & robust support ticket system that allows users to communicate with support staff directly from their dashboard.
️ Architecture
The system is built with a clear separation between the user-facing dashboard and the administrative management panel.
️ Database Schema (lib/db/schema/support.ts)
supportTickets: Stores the main ticket metadata.id,userId,subject,priority,status,assignedTosubject,status(open,in_progress,resolved,closed,archived)priority(low,medium,high,urgent)category(technical,billing,feature_request,other)lastRepliedAt,createdAt,updatedAt
ticketReplies: Stores the conversation thread.id,ticketId,userId(sender)content(Markdown supported)isAdmin(boolean, to distinguish support staff replies)attachments(JSON array of storage URLs)
Server Actions (app/actions/support-tickets.ts)
createTicketAction: Initialize a new ticket with initial message.replyToTicketAction: Add a new reply to an existing ticket.updateTicketStatusAction: Transition ticket state.updateTicketPriorityAction: Adjust urgency level.getTicketThreadAction: Fetch all replies for a ticket with sender profiles.archiveTicketAction: Move resolved/closed tickets to archival storage.unarchiveTicketAction: Restore archived tickets to active queue.permanentDeleteTicketAction: Defensively delete archived records (requires archival).
Every ticket mutation validates the ticket ID with Zod, verifies ownership or super-admin access, mutates through Drizzle, then revalidates the ticket list/detail paths and support cache tags.
AI Conversation Ownership
Public chat supports guests and authenticated users. Guest conversations remain
browser-local until the first server-side message creates a record. Authenticated
requests treat any conversationId supplied by the client as untrusted:
- Resolve the effective user via
getEffectiveUserId(). - Call
getConversationForUser(conversationId, effectiveUserId). - Proceed only when the conversation belongs to that user; otherwise start a new safe conversation.
This owner check applies before history reads, message inserts, conversation status updates, realtime broadcasts, offline ticket creation, and escalation ticket creation.
API Routes (app/api/super-admin/support-tickets/)
GET /api/super-admin/support-tickets: List all tickets with advanced filtering for staff.PATCH /api/super-admin/support-tickets/[id]: Super-Admin-only updates (assignment, status).
User Experience
Ticket Creation
Users can create tickets from the Support section of their dashboard. They select a category and priority, which helps route the ticket to the correct staff member.
Conversations
The ticket view features a real-time-like chat interface with:
- Markdown Support: Rich text for better problem description.
- Attachments: Secure file uploads via Supabase Storage.
- Status Tracking: Visual indicators of whether the ticket is seen or replied to.
️ Administrative Management
Super-admins manage tickets through the 17-module super-admin panel under the "Support Tickets" module.
Features
- Consolidated Queue Management: Integrated filtering directly within the
TicketListcomponent, utilizing URL state management and debounced search for high-performance navigation. - Search & Export: Unified administrative headers across Support and Contact modules featuring debounced global search and CSV data extraction.
- Identity Awareness: Automated registered user identification in contact submissions, pulling profile data (avatars/names) from Supabase.
- User Impersonation: Admins can impersonate users to see exactly what they see in the ticket.
- Internal Notes: Private notes on tickets and contact submissions only visible to staff, featuring theme-aware Glassmorphism 2.0 controls.
Workflows
- Triage: New tickets arrive with
openstatus. - Assignment: A staff member sets the status to
in_progress. - Resolution: Once solved, the ticket is moved to
resolved. - Archive: Resolved/closed tickets are moved to
archivedto declutter queues. - Unarchive: Archived tickets can be restored if the user follows up.
- Permanent Delete: Admins can defensively delete
archivedtickets; archival is a strict prerequisite for deletion.
Security & RLS
- Users: Can only see tickets they created.
- Admins: Have full read/write access to all tickets and replies.
- Rate Limiting: Ticket creation is rate-limited to prevent spam (defined in
lib/config/pricing.ts).
Copyright © 2026 Vibe44. Built with ❤️ by Scale with Alap.