Support has two entry points: the public contact page and the AI assistant support tools. Both routes lead to the same operational goal, helping the user reach the product owner without creating noisy or duplicate support work.
Contact Page
The public contact page lives at /contact.
The page UI lives in:
src/features/contact/components/contact-page-content.tsxsrc/features/contact/components/contact-form.tsx
The server action is src/features/contact/actions/submit-contact-form.action.ts, and validation lives in src/features/contact/schemas/contact-submission.schema.ts.
Contact form submissions are sent through the shared email layer to SUPPORT_EMAIL.
SUPPORT_EMAIL="support@yourdomain.com"Email Layer
Support email delivery uses the same Resend and React Email infrastructure as auth and onboarding emails.
Important files:
src/features/emails/lib/emails.actions.tssrc/features/emails/templates/contact-submission.template.tsxsrc/features/contact/actions/submit-contact-form.action.ts
Keep provider specific email behavior inside the email feature. Contact and AI support flows should call the shared email actions instead of talking to Resend directly.
AI Support Tools
AI support tools live in src/features/ai/chat/tools/chat-support-tools.server.ts.
The included tools can:
- Fetch the current user's five most recent support tickets.
- Create a support ticket for the current authenticated user.
- Read notification preferences.
- Update notification preferences.
The database and quota logic lives in src/features/ai/chat/repositories/chat-tools.repository.ts.
Escalation Guardrails
The assistant should answer from available policy and product context first. It should only create a support ticket when the user explicitly asks for escalation or insists after the assistant tries to help.
Ticket creation is hard limited to two tickets per user per day. The quota is enforced in a serializable database transaction so concurrent requests cannot easily bypass it.
Support ticket records are stored in SupportTicket in prisma/schema/user.prisma.
Admin And Operator Context
The admin area focuses on users, roles, account state, activity, purchase status, magic links, and impersonation. Support tickets are currently created and emailed, while recent ticket history is available to the AI support tool.
If you add an operator support inbox later, keep it as a feature owned admin surface and reuse the existing SupportTicket model rather than creating a second ticket store.
Where To Customize
src/features/contactfor the public contact form.src/features/emailsfor email delivery and templates.src/features/ai/chat/tools/chat-support-tools.server.tsfor available AI support tools.src/features/ai/chat/repositories/chat-tools.repository.tsfor ticket creation, quota, and recent ticket lookup.prisma/schema/user.prismafor support ticket persistence.src/lib/env.server.tsand.env.examplefor support email configuration.
When adding new support paths, keep escalation intentional and make sure server side failures are logged with user, ticket, provider, or route context.