A modern, AI-powered customer support platform that integrates with Gmail to manage support tickets, generate intelligent responses, and streamline customer service operations with advanced features like Shopify integration, real-time collaboration, and analytics.
- Gmail Integration: Seamless OAuth2 authentication and email synchronization
- Smart Ticketing System: Convert emails into actionable support tickets
- AI-Powered Drafts: Generate contextual email responses using Groq AI that match your writing style
- Real-time Collaboration: Live updates, typing indicators, and @mentions
- Multi-user Support: Role-based access control (Admin, Manager, Agent)
- Quick Replies: Pre-written response templates organized by category
- Knowledge Base: Semantic search across your documentation with vector embeddings
- Shopify Integration: View customer orders, products, and history inline
- Analytics Dashboard: Track response times, ticket volume, and team performance
- Conversation Summaries: AI-generated summaries of long email threads
- Guardrails: Content validation and tone enforcement for outgoing messages
- Bulk Operations: Update multiple tickets simultaneously
- Smart Filters: Advanced filtering by status, priority, assignee, tags, date
- Keyboard Shortcuts: Gmail-style navigation (j/k, r, a, c, s)
- Resizable Panels: Customizable workspace layout with persistent preferences
- Auto-save Drafts: Never lose your work with automatic draft saving
- Optimistic Updates: Instant UI feedback with automatic rollback on errors
- User Management: Invite and manage team members with role assignments
- Ticket Assignment: Assign tickets to specific agents or teams
- Priority Levels: Low, Medium, High, Urgent
- Tags System: Organize tickets with custom tags
- Notes & Mentions: Internal collaboration with @mentions and notifications
- Ticket Views: Personalized views tracking last-viewed timestamps
- Framework: Next.js 16 (App Router)
- UI: React 19.2 with TypeScript
- Styling: Tailwind CSS 4
- Components: Radix UI primitives
- Icons: Lucide React
- Forms: React Hook Form + Zod validation
- Charts: Recharts
- Database: Supabase (PostgreSQL)
- Realtime: Supabase Realtime subscriptions
- Authentication: Gmail OAuth2 via Google APIs
- AI: Groq API (llama-3.3-70b-versatile)
- Embeddings: Local transformers.js (all-MiniLM-L6-v2) or OpenAI/HuggingFace
- E-commerce: Shopify Admin API
- Email API: Gmail API (googleapis)
- State Management: React hooks with optimistic updates
- Storage: LocalStorage for preferences, Supabase for data
- Real-time: WebSocket channels for live collaboration
Before you begin, ensure you have:
- Node.js 18+ installed
- A Google Cloud project with Gmail API enabled
- A Supabase account and project
- A Groq API key
- (Optional) Shopify store for e-commerce integration
git clone <your-repo-url>
cd email-support-platformnpm install
# or
pnpm installCopy the environment template and fill in your credentials:
cp env-template.txt .env.localRequired environment variables:
# Gmail OAuth2 (from Google Cloud Console)
GMAIL_CLIENT_ID=your_client_id
GMAIL_CLIENT_SECRET=your_client_secret
GMAIL_REDIRECT_URI=http://localhost:3000/api/auth/gmail/callback
# Groq AI
GROQ_API_KEY=your_groq_api_key
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
# Embeddings (Optional - defaults to local)
EMBEDDING_PROVIDER=local
EMBEDDING_API_KEY=
# App URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Shopify (Optional)
SHOPIFY_STORE_URL=your-store.myshopify.com
SHOPIFY_ACCESS_TOKEN=your_admin_api_tokenRun the Supabase schema files to set up your database:
-- Core schemas (run in order)
supabase_schema_updates.sql
supabase_roles_schema.sql
supabase_user_scoping.sql
supabase_ticket_notes_schema.sql
supabase_quick_replies_schema.sql
supabase_guardrails_schema.sql
supabase_analytics_schema.sql
supabase_shopify_schema.sqlOr use the Supabase Dashboard to execute these migrations.
npm run dev
# or
pnpm devOpen http://localhost:3000 in your browser.
- Connect Gmail: Click "Connect Gmail" and authorize the application
- Set Up User: Create your admin user account
- Sync Emails: Initial sync will fetch recent emails and create tickets
- Configure Settings: Set up guardrails, quick replies, and knowledge base
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Gmail API
- Create OAuth 2.0 credentials (Web application)
- Add authorized redirect URI:
http://localhost:3000/api/auth/gmail/callback - Copy Client ID and Secret to
.env.local
- Visit Groq Console
- Sign up or log in
- Generate API key
- Copy to
.env.local
- Create account at Supabase
- Create new project
- Copy Project URL and Anon Key from Settings β API
- Run database migrations from
/supabase_*.sqlfiles
- In Shopify Admin, go to Apps β Develop apps
- Create custom app with Admin API access
- Grant permissions:
read_orders,read_products,read_customers - Copy Admin API access token to
.env.local
- View Tickets: Navigate to Tickets in the sidebar
- Filter: Use collapsible filters for status, priority, assignee, tags, date
- Search: Full-text search across subject and customer info
- Assign: Click ticket β Assign dropdown (Admins/Managers can assign to anyone)
- Update Status: Open, Pending, On Hold, Closed
- Bulk Actions: Select mode β Check multiple tickets β Bulk assign/close
| Shortcut | Action |
|---|---|
j / k |
Navigate tickets (down/up) |
r |
Reply to ticket |
a |
Assign ticket |
c |
Close ticket |
s |
Focus search |
Ctrl+K |
Toggle select mode |
Ctrl+A |
Select all (in select mode) |
Esc |
Exit select/close dialogs |
? |
Show shortcuts help |
- Open a ticket
- Click "Generate Draft" (Sparkles icon)
- AI analyzes conversation and your past emails
- Review and edit generated draft
- Send or save for later
- Create templates in Quick Replies view
- Organize by categories and tags
- Insert into tickets with one click
- Search across all templates
- Available to all user roles
- Add articles/docs in Knowledge Base view
- Content is automatically embedded for semantic search
- AI references relevant articles when generating drafts
- Search by keywords or semantic similarity
- View ticket volume trends
- Monitor average response times
- Track team performance metrics
- Filter by date range and team member
- Export data for reporting
βββ app/ # Next.js app router
β βββ api/ # API routes
β β βββ ai/ # AI draft generation
β β βββ analytics/ # Analytics endpoints
β β βββ auth/ # Gmail OAuth
β β βββ emails/ # Email sync
β β βββ tickets/ # Ticket CRUD
β β βββ shopify/ # Shopify integration
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Main app page
βββ components/ # React components
β βββ ui/ # Reusable UI components
β βββ tickets-view.tsx # Main tickets interface
β βββ email-detail.tsx # Email thread viewer
β βββ ...
βββ lib/ # Utilities and helpers
β βββ gmail.ts # Gmail API client
β βββ ai-draft.ts # AI generation logic
β βββ embeddings.ts # Vector embeddings
β βββ supabase-client.ts # Supabase client
β βββ ...
βββ public/ # Static assets
tickets-view.tsx: Main ticketing interface with filters, bulk actions, real-time updatesemail-detail.tsx: Email thread display with reply composer and AI draftstop-nav.tsx: Global navigation with notifications and user menusidebar.tsx: Main navigation sidebaranalytics-dashboard.tsx: Metrics and reporting
- Email Sync: Gmail API β
/api/emailsβ Supabase tickets table - AI Drafts: Ticket context β Embeddings search β Groq API β Draft generation
- Real-time: Supabase triggers β WebSocket β Component updates
- Shopify: Ticket email β Shopify API β Customer/order data
- OAuth2: Secure Gmail authentication with token refresh
- RLS: Row-level security in Supabase for multi-tenant data
- Role-based Access: Admins, Managers, and Agents with different permissions
- Input Validation: Zod schemas for all API inputs
- Content Guardrails: AI-powered content validation before sending
- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
npm run build
npm run startUpdate redirect URIs and app URLs for production:
GMAIL_REDIRECT_URI=https://your-domain.com/api/auth/gmail/callback
NEXT_PUBLIC_APP_URL=https://your-domain.com- Optimistic UI: Instant feedback for all actions
- Batch Processing: Efficient bulk operations
- Local Embeddings: Fast, free vector search without API calls
- Debounced Search: Reduced API calls during typing
- Lazy Loading: Components loaded on demand
- Cached Data: LocalStorage for preferences and frequently accessed data
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is private and proprietary.
Gmail connection fails
- Verify OAuth credentials in Google Cloud Console
- Check redirect URI matches exactly
- Ensure Gmail API is enabled
AI drafts not generating
- Confirm Groq API key is valid
- Check console for API errors
- Verify embeddings are generated for sent emails
Supabase errors
- Run all schema migrations in order
- Check RLS policies are configured
- Verify environment variables
Shopify integration not working
- Confirm Admin API token has correct permissions
- Check store URL format (no https://)
- Verify customer email matches
Enable detailed logging:
// In browser console
localStorage.setItem('debug', 'true')For issues and questions:
- Check existing documentation files (README_BACKEND.md, FEATURE_CHECKLIST.md)
- Review API endpoint documentation
- Check browser console for errors
- Email templates with variables
- Scheduled sends
- SLA tracking and alerts
- Mobile responsive improvements
- Multi-language support
- Slack/Discord integrations
- Custom reporting dashboards
- Automated ticket routing
Built with β€οΈ using Next.js, React, and Supabase