Voice-enabled AI assistant management platform. This admin console provides a comprehensive dashboard for managing AI agents, monitoring live calls, viewing analytics, and tracking usage for the HeyAI voice API platform.
HeyAI Admin Console is a Next.js-based web application that serves as the control center for managing voice-enabled AI agents. Users can create agents, monitor active calls in real-time, view detailed analytics, and manage billing through an intuitive interface.
The system integrates multiple components to provide a complete voice AI management solution:
- User Management: Admin creates and configures AI agents through the web interface
- Call Routing: Twilio routes incoming calls to the appropriate agent based on phone number
- Backend Processing: Go server handles call orchestration, speech processing, and AI inference
- Real-time Monitoring: Dashboard displays live call metrics and agent status
- Data Storage: BigQuery stores call logs, agent configurations, and analytics data
- Analytics: Dashboard aggregates and visualizes usage patterns and performance metrics
Admin Console (Next.js) ↔ BigQuery ↔ Dashboard Backend
↓
Analytics & Logs
↓
HeyAI Backend (Go) ↔ External AI Agents
↓
Twilio Voice API
↓
End Users
- Next.js 15: React framework with App Router for server-side rendering and API routes
- TypeScript: Type-safe development with full IDE support
- Tailwind CSS v4: Utility-first CSS framework for responsive design
- React 19: Latest React features including Server Components
- Radix UI: Accessible, unstyled component primitives
- Lucide Icons: Modern icon library
- Recharts: Composable charting library for analytics visualization
- Three.js + React Three Fiber: 3D graphics for landing page animations
- Next.js API Routes: Serverless API endpoints
- Google BigQuery: Scalable data warehouse for analytics
- Google Cloud SDK: BigQuery client library
- Server-Sent Events: Real-time updates for live monitoring
- ESLint: Code linting and quality checks
- TypeScript: Static type checking
- PostCSS: CSS processing and optimization
- Agent management (create, update, delete, activate/deactivate)
- Real-time live user tracking per agent
- Dashboard with key metrics and analytics
- Call history and usage tracking
- Payment and billing overview
- Responsive design for all screen sizes
- Dark theme UI with modern aesthetics
- BigQuery integration for data persistence
- Live call monitoring with 5-second polling
- Per-agent active user counts
- 3D particle system landing page
- Siri-like voice animation
- WebSocket integration for instant updates
- Advanced filtering and search in call history
- Export functionality for reports
- Multi-user authentication and roles
- Custom agent voice selection
- Call recording playback
- Real-time transcription display
- Cost optimization recommendations
Required environment variables for production:
# BigQuery Configuration
BIGQUERY_PROJECT_ID=heyai-backend
BIGQUERY_DATASET=agent_data
BIGQUERY_CREDENTIALS={"type":"service_account",...}
# Backend Integration
BACKEND_URL=https://heyai-backend-127756525541.us-central1.run.app
# API Security (optional)
API_SECRET_KEY=your-secret-key-
Create Google Cloud Project:
- Project ID: heyai-backend
- Enable BigQuery API
-
Create Service Account:
- Role: BigQuery Admin
- Download JSON key file
-
Create Dataset:
- Dataset name: agent_data
- Location: us-central1
-
Create Tables: Run the SQL schema from
bigquery_schema.sql:agents- Agent configurationscalls- Call records and transcriptslive_calls- Active call monitoringusage_history- Daily usage aggregates
Format the service account JSON as a single-line string for the BIGQUERY_CREDENTIALS environment variable. Use the provided format-credentials.js script:
node format-credentials.js service-account-key.jsonCopy the output and set it as the environment variable value in your deployment platform.
-
Connect Repository:
- Import project from GitHub
- Select the HeyAI-admin-console directory
-
Configure Environment Variables:
- Add all required variables in Vercel dashboard
- Ensure
BIGQUERY_CREDENTIALSis properly formatted - Select all environments (Production, Preview, Development)
-
Deploy:
- Vercel automatically builds and deploys
- Access via provided URL
{
"buildCommand": "npm run build",
"outputDirectory": ".next",
"installCommand": "npm install",
"framework": "nextjs"
}GET /api/agents
- Retrieves all agents from BigQuery
- Returns agent configurations and metadata
POST /api/agents/upsert
- Creates or updates an agent
- Accepts agent configuration in request body
DELETE /api/agents?agent_id={id}
- Removes an agent from the system
- Note: May fail if agent has recent calls (streaming buffer)
GET /api/live-users
- Returns total live users and per-agent breakdown
- Polls backend every 5 seconds for updates
- Response format:
{liveUsers: number, byAgent: Record<string, number>}
GET /api/dashboard/stats
- Total calls, active agents, total minutes, revenue
GET /api/dashboard/quick-stats
- Success rate, average duration, agent utilization
GET /api/dashboard/recent-activity
- Last 10 calls with details
GET /api/calls/history
- Paginated call history
- Query params: limit, offset
GET /api/calls/live
- Currently active calls
-
Install Dependencies:
npm install
-
Create Environment File:
cp .env.local.example .env.local
-
Configure Variables: Edit
.env.localwith your credentials -
Start Development Server:
npm run dev
-
Access Application: Open http://localhost:3000
HeyAI-admin-console/
├── app/
│ ├── page.tsx # Landing page
│ ├── layout.tsx # Root layout
│ ├── admin/
│ │ ├── dashboard/ # Analytics dashboard
│ │ ├── add-agent/ # Agent creation
│ │ ├── existing-agents/ # Agent management
│ │ ├── payment/ # Billing overview
│ │ └── layout.tsx # Admin layout with sidebar
│ └── api/
│ ├── agents/ # Agent CRUD operations
│ ├── live-users/ # Live user tracking
│ └── dashboard/ # Analytics endpoints
├── components/
│ ├── admin-sidebar.tsx # Navigation sidebar
│ ├── siri-animation.tsx # Voice visualization
│ ├── gl/ # 3D graphics components
│ └── ui/ # Reusable UI components
├── lib/
│ └── bigquery.ts # BigQuery client initialization
├── types/
│ └── dashboard.ts # TypeScript type definitions
└── public/
└── architecture.png # System architecture diagram
- AdminSidebar: Navigation component with workspace and management sections
- Dashboard: Analytics overview with charts and metrics
- ExistingAgents: Agent list with live user counts and management actions
- AddAgent: Form for creating new agents
- SiriAnimation: Real-time audio waveform visualization
The admin console communicates with the HeyAI Go backend for live user tracking:
- Endpoint:
/api/live-users - Method: GET
- Response:
{liveUsers: number, byAgent: {[agentId]: count}} - Polling: Every 5 seconds
All persistent data is stored in BigQuery:
- Agent configurations
- Call records and transcripts
- Usage metrics and analytics
- Billing information
The getBigQueryClient() function in lib/bigquery.ts handles connection management and credential parsing.
- Server-side rendering for fast initial page loads
- Client-side navigation for instant page transitions
- Optimized BigQuery queries with proper indexing
- Lazy loading for 3D graphics components
- Efficient polling with 5-second intervals
- Caching strategies for static assets
- Service account credentials stored in environment variables
- API routes protected with proper error handling
- Input validation on all forms
- Secure BigQuery connections with service account authentication
- CORS configuration for API endpoints
- No sensitive data exposed in client-side code
If you see "Failed to initialize BigQuery client" errors:
- Verify
BIGQUERY_CREDENTIALSis valid JSON - Check service account has BigQuery Admin role
- Ensure dataset and tables exist
- Run validation script:
node validate-env.js
When deleting recently added agents:
- Error: "Cannot delete recently added agent"
- Cause: BigQuery streaming buffer (90-minute window)
- Solution: Wait a few minutes and retry
If live user counts aren't updating:
- Check backend is running and accessible
- Verify
BACKEND_URLenvironment variable - Check browser console for API errors
- Ensure backend
/api/live-usersendpoint is working
MIT License
For issues and questions, please open an issue in the repository or contact the development team.
