MSP Ticketing
Private-label MSP helpdesk software built with Next.js, Prisma, PostgreSQL, NextAuth, Tailwind, and Microsoft Graph foundations. The project is structured as a Zoho Desk / Freshdesk style support workspace with multi-client ticketing, agent dashboards, reporting, portal views, SLA policies, automations, knowledge base, and admin controls.
What’s in this repo
- Multi-tenant account model with clients, contacts, locations, departments, teams, SLAs, mailboxes, reports, macros, announcements, audit logs, API keys, and webhooks.
- Ticket workspace with list filters, saved views, ticket creation, ticket detail, replies, internal notes, SLA state, tags, and audit history.
- Agent/admin UI pages for dashboard, clients, contacts, KB, reports, EOD reports, automations, portal preview, settings, mailboxes, SLA, users, teams, and audit logs.
- API routes for tickets, replies, notes, dashboard metrics, reports, settings, mailboxes, clients, contacts, users, departments, teams, automations, KB articles, and audit logs.
- Microsoft Graph email helper layer for mailbox auth and outbound send foundations.
- Seed data for a realistic MSP workspace with multiple clients and sample tickets.
Stack
- Next.js 14
- React 18
- Prisma ORM
- PostgreSQL
- NextAuth
- Tailwind CSS
- Axios
- Microsoft Graph client
Quick start
- Install dependencies:
- Create
.env.local from .env.example and set at minimum:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/msp_ticketing?schema=public"
NEXTAUTH_SECRET="replace-with-a-long-random-secret"
NEXTAUTH_URL="http://localhost:3000"
- Generate the Prisma client and sync the schema:
npx prisma generate
npm run db:push
- Seed the workspace:
- Start the app:
- Open
http://localhost:3000
Demo credentials:
admin@msp.local / AdminPassword123!
agent1@msp.local / AgentPassword123!
Environment
Key environment variables:
DATABASE_URL: PostgreSQL connection string.
NEXTAUTH_SECRET: required for session signing.
NEXTAUTH_URL: local or production app URL.
AZURE_AD_CLIENT_ID
AZURE_AD_TENANT_ID
AZURE_AD_CLIENT_SECRET
MICROSOFT_GRAPH_CLIENT_ID
MICROSOFT_GRAPH_CLIENT_SECRET
MICROSOFT_GRAPH_TENANT_ID
Microsoft Graph setup
Create one Microsoft Entra app registration and grant delegated or application permissions as needed for your rollout:
Mail.Read
Mail.ReadWrite
Mail.Send
User.Read
Local auth callback:
http://localhost:3000/api/auth/callback/azure-ad
Recommended mailbox rollout flow:
- Register the app in Entra.
- Add the redirect URI above.
- Generate a client secret.
- Grant Graph permissions and admin consent.
- Populate the Azure AD and Graph values in
.env.local.
- Add mailbox records through the admin UI or seed/update data directly.
Important routes
Workspace pages:
/dashboard
/tickets
/tickets/new
/clients
/contacts
/kb
/reports
/eod-report
/automations
/portal
/admin
/settings
Core API routes:
GET/POST /api/v1/tickets
GET/PATCH /api/v1/tickets/[id]
GET/POST /api/v1/tickets/[id]/replies
GET/POST /api/v1/tickets/[id]/notes
GET /api/v1/dashboard
GET /api/v1/reports
GET /api/v1/settings
Seeded sample data
The seed script creates:
- 1 MSP account
- admin, manager, agent, and company-admin users
- 3 client companies
- departments and teams
- business hours and a holiday
- SLA policies
- knowledge base content
- macros and automation rules
- connected mailbox records
- notifications, audit logs, work items, CSAT, API key, and webhook examples
- 6 sample tickets spanning multiple statuses and priorities
Notes
- The schema is Prisma-first and currently targets PostgreSQL for a clean local and production workflow.
- The Graph integration in this repo is a working foundation layer, not a finished mailbox sync daemon.
- File attachment storage is modeled in the schema, but production object storage wiring is still intended as the next expansion step.
npm run build has been verified successfully in this workspace.
Useful commands
npx prisma generate
npm run db:push
npm run db:seed
npm run dev
npm run build