Go to file
2026-03-05 09:41:28 -08:00
.agents/skills Polish the UI 2026-03-03 11:24:08 -08:00
.claude Polish the UI 2026-03-03 11:24:08 -08:00
.github/workflows "Claude PR Assistant workflow" 2026-03-05 09:41:28 -08:00
client Fix vite config issue 2026-03-04 08:56:15 -08:00
core Add stats to dashboard 2026-03-02 08:48:06 -08:00
e2e Add the ability to respond to tickets 2026-02-24 12:15:51 -08:00
server Prepare the app for production 2026-03-03 14:18:20 -08:00
.dockerignore Prepare the app for production 2026-03-03 14:18:20 -08:00
.gitignore Write automated tests for authentication 2026-02-13 10:18:44 -08:00
bun.lock Add error logging with sentry 2026-03-03 09:16:47 -08:00
CLAUDE.md Process background jobs with pg-boss 2026-02-26 11:30:42 -08:00
Dockerfile Prepare the app for production 2026-03-03 14:18:20 -08:00
implementation-plan.md Initial commit 2026-02-09 09:55:29 -08:00
package.json Add the ability to create users 2026-02-17 09:45:46 -08:00
playwright.config.ts Write automated tests for authentication 2026-02-13 10:18:44 -08:00
project-scope.md Initial commit 2026-02-09 09:55:29 -08:00
railway.toml Prepare the app for production 2026-03-03 14:18:20 -08:00
README.md Add README.md 2026-03-04 08:05:27 -08:00
skills-lock.json Polish the UI 2026-03-03 11:24:08 -08:00
tech-stack.md Initial commit 2026-02-09 09:55:29 -08:00
tsconfig.json Set up Playwright 2026-02-13 08:46:19 -08:00

Helpdesk

An AI-powered ticket management system that automatically classifies, responds to, and routes support tickets.

Features

  • Receive support emails and create tickets via SendGrid inbound parse
  • AI-powered ticket classification (General Question, Technical Question, Refund Request)
  • AI-suggested replies and summaries
  • Ticket list with filtering and sorting
  • Ticket detail view with reply thread
  • User management (admin only)
  • Dashboard with stats

Tech Stack

  • Frontend: React, TypeScript, Vite, shadcn/ui, TanStack Query
  • Backend: Express 5, TypeScript, Bun
  • Database: PostgreSQL, Prisma ORM
  • AI: OpenAI GPT via Vercel AI SDK
  • Auth: Better Auth (email/password, database sessions)
  • Job Queue: pg-boss
  • Error Tracking: Sentry
  • Email: SendGrid (inbound + outbound)

Project Structure

client/   - React frontend (Vite)
server/   - Express backend
core/     - Shared code (Zod schemas, types, constants)
e2e/      - Playwright E2E tests

Prerequisites

  • Bun (runtime and package manager)
  • PostgreSQL

Getting Started

  1. Install dependencies

    bun install
    
  2. Set up environment variables

    cp server/.env.example server/.env
    cp client/.env.example client/.env
    

    Edit server/.env and fill in the required values. At minimum:

    • DATABASE_URL - PostgreSQL connection string
    • BETTER_AUTH_SECRET - generate with openssl rand -base64 32
    • OPENAI_API_KEY - for AI features
  3. Set up the database

    cd server
    bunx prisma migrate dev
    bunx prisma db seed
    
  4. Start the dev servers

    # Terminal 1 - backend
    cd server && bun run dev
    
    # Terminal 2 - frontend
    cd client && bun run dev
    

    The client runs on http://localhost:5173 and proxies API requests to the server on port 3000.

Testing

# Component tests
cd client && bun run test

# E2E tests (requires both servers running)
bun run test:e2e

Deployment (Railway)

The app is configured for single-service deployment on Railway. The Express server serves the built React client as static files in production.

  1. Build the Docker image

    docker build -t helpdesk .
    
  2. Run locally with Docker

    docker run -p 3000:3000 --env-file server/.env -e NODE_ENV=production helpdesk
    
  3. Deploy to Railway

    • Create a new project and link this repo
    • Add a PostgreSQL database
    • Set the required environment variables (see server/.env.example)
    • After the first deploy, seed the database:
      railway run -- bun run --cwd server prisma db seed
      

Required Environment Variables (Production)

Variable Description
DATABASE_URL PostgreSQL connection string (auto-provided by Railway)
BETTER_AUTH_SECRET Auth secret key
BETTER_AUTH_URL App URL (e.g. https://yourapp.up.railway.app)
TRUSTED_ORIGINS Same as BETTER_AUTH_URL
WEBHOOK_SECRET For inbound email webhook verification
OPENAI_API_KEY OpenAI API key for AI features
SENDGRID_API_KEY SendGrid API key for outbound email
SENDGRID_FROM_EMAIL Verified sender email address
SEED_ADMIN_EMAIL Initial admin user email
SEED_ADMIN_PASSWORD Initial admin user password

Optional: SENTRY_DSN, SENTRY_ENVIRONMENT