0%
Vibe44 Logo

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, assignedTo
    • subject, 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:

  1. Resolve the effective user via getEffectiveUserId().
  2. Call getConversationForUser(conversationId, effectiveUserId).
  3. 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 TicketList component, 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

  1. Triage: New tickets arrive with open status.
  2. Assignment: A staff member sets the status to in_progress.
  3. Resolution: Once solved, the ticket is moved to resolved.
  4. Archive: Resolved/closed tickets are moved to archived to declutter queues.
  5. Unarchive: Archived tickets can be restored if the user follows up.
  6. Permanent Delete: Admins can defensively delete archived tickets; 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.