DEV Community

Gaurav Guha
Gaurav Guha

Posted on Originally published at thefrontkit.com

How to build a Next.js help desk from scratch

Building a help desk in Next.js is deceptively complex. Beyond the basic email-ticket loop, you need assignment rules, SLA tracking, canned responses, and more. Here's what you need to handle.

Core Features

Unified Ticket Inbox

The agent's home screen must show:

  • All open tickets with status, priority, assignee, and last update
  • Filters for status, priority, assignee, tags
  • Search across tickets and messages
  • Bulk actions like assign, tag, or close

Ticket Detail View

Where agents work:

  • Customer info and history
  • Conversation thread with internal notes
  • Rich-text reply box with canned responses
  • Side panel for ticket metadata
  • Activity log and linked tickets

Email Integration

Most tickets start as emails. You need:

  • Inbound email parsing (e.g., Postmark webhooks)
  • Reply parsing and threading
  • Attachment handling
  • Forwarding rules for specific queues

Assignment and Routing

Get tickets to the right agents:

  • Manual and round-robin assignment
  • Rule-based routing (e.g., "billing" tag goes to the billing team)
  • Workload balancing to avoid overloading agents

SLA Tracking

Service-level agreements drive prioritization:

  • First response and resolution SLAs
  • Different SLAs per priority or customer tier
  • Visual indicators for tickets nearing breach
  • Auto-escalation when SLAs are breached

Knowledge Base

A self-service system to reduce ticket volume:

  • Articles with categories and tags
  • Public reader with search
  • Suggested articles in tickets and replies
  • Article view tracking and feedback

Customer Portal

Let customers:

  • Submit and reply to tickets
  • View ticket status and history
  • Search the knowledge base

Reporting

Standard reports for managers:

  • Ticket volume and resolution times
  • Agent performance and CSAT scores
  • Category breakdown and SLA compliance

CSAT Surveys

Collect customer satisfaction:

  • Post-resolution email surveys
  • Rating and optional comments
  • Trends per agent for performance reviews

Tech Stack Decisions

  • Email parsing: Use Postmark or Mailgun, not custom SMTP parsing.
  • Search: Start with Postgres tsvector, scale to Algolia or Typesense later.
  • Real-time updates: Use Pusher, Ably, or Liveblocks for live ticket updates.
  • File storage: Use R2 or Supabase Storage for ticket attachments.
  • Background jobs: Use Inngest for SLA timers and scheduled emails.
  • Charts: Recharts works well for the reporting dashboard.

Build Path: From Scratch (10-14 Weeks)

Week 1-2: Set up Next.js, auth, and database schema for tickets, messages, agents, and customers.
Week 3-4: Build the ticket inbox and detail view.
Week 5-6: Integrate email parsing and threading.
Week 7-8: Add assignment rules, routing, and SLA tracking.
Week 9-10: Develop the knowledge base.
Week 11-12: Build the customer portal.
Week 13: Create standard reports.
Week 14: Polish with CSAT surveys, dark mode, and performance tweaks.

Common Pitfalls

  • Custom email parsing: Use Postmark or Mailgun instead.
  • Missing reply threading: Every customer reply should land on the same ticket.
  • No internal notes: Agents need a way to communicate privately.
  • Skipping SLA tracking: Urgent tickets get lost without it.
  • No canned responses: Agents waste time typing the same replies.
  • Underbuilding the knowledge base: It cuts ticket volume significantly.

Email integration alone often takes 3 weeks. For most teams, this project stretches to 14-20 weeks.


This is a shorter version of a guide I wrote at Frontkit Studio. The full post has the complete walkthrough.

Top comments (0)