Skip to content

Repository files navigation

🎀 Business Voice Agent - Production-Ready System

AI voice assistant for workers with real-time analytics, mobile-friendly web UI, and Docker deployment

🎯 What This Is

A complete production system that lets you deploy an AI voice assistant for your team that:

  • πŸ’¬ Talks naturally with workers (hands-free, voice-first)
  • πŸ“Š Tracks everything automatically (tasks, issues, supplies, sentiment)
  • πŸ“± Works on mobile (responsive web interface)
  • 🌐 Deploy anywhere (Docker, cloud platforms, VPS)
  • βš™οΈ Configure via web UI (no code editing needed!)

Perfect for: Warehouses, field teams, delivery drivers, construction sites, restaurants, retail - any mobile workforce!


⚑ Quick Start (3 Options)

Option 1: Local Testing (Fastest)

cd tribes/business-voice
npm install
npm run server

# Open in browser:
# http://localhost:3000

Option 2: Docker (Recommended)

cd tribes/business-voice

# Create .env file
cp .env.example .env
# Edit .env and add OPENAI_API_KEY

# Start with Docker
docker-compose up -d

# Access at:
# http://localhost:3000

Option 3: Cloud Deploy (Production)

See DEPLOYMENT.md for:

  • Railway.app (1-click deploy)
  • DigitalOcean App Platform
  • Fly.io
  • Self-hosted VPS

🎨 Features

βœ… Complete Web Interface

Home Page (/)

  • System overview
  • Quick actions
  • Real-time status

Setup Page (/setup)

  • Configure agent personality
  • Set tracking keywords
  • Manage workers
  • Test OpenAI API key

Dashboard (/dashboard)

  • Live analytics
  • Activity feed (updates every 3 seconds)
  • Worker performance metrics
  • Real-time notifications

Voice Interface (/voice)

  • Start voice conversations
  • Real-time transcription
  • Automatic tracking

🎯 What It Tracks Automatically

From natural conversations, it detects and logs:

Worker Says System Detects Action Taken
"Finished loading truck 5" Task completion βœ… Logs task, updates count
"The forklift is broken" Issue report 🎫 Creates ticket, alerts manager
"We need more boxes" Supply request πŸ“¦ Adds to order list
"How many left today?" Help request πŸ“Š Tracks support needs

πŸ“± Mobile-First Design

  • Responsive layout (works on any device)
  • Touch-optimized interface
  • Works offline (PWA ready)
  • Add to home screen capability
  • Fast loading (< 1 second)

🐳 Production-Ready

  • Docker: One-command deployment
  • Docker Compose: Multi-container setup
  • Nginx: Reverse proxy with rate limiting
  • Health checks: Built-in monitoring
  • Logging: Structured logs
  • Security: CORS, rate limiting, input validation

πŸ“ Project Structure

business-voice/
β”œβ”€β”€ 🌐 public/                     # Web interface
β”‚   β”œβ”€β”€ index.html                 # Home page
β”‚   β”œβ”€β”€ setup.html                 # Configuration UI
β”‚   β”œβ”€β”€ dashboard.html             # Analytics dashboard
β”‚   β”œβ”€β”€ css/style.css              # Mobile-first styles
β”‚   └── js/
β”‚       β”œβ”€β”€ app.js                 # Core functionality
β”‚       β”œβ”€β”€ setup.js               # Setup page logic
β”‚       └── dashboard.js           # Dashboard updates
β”‚
β”œβ”€β”€ πŸ€– src/                        # Backend
β”‚   β”œβ”€β”€ server.js                  # Main Express server
β”‚   β”œβ”€β”€ voice-agent.js             # AI agent logic
β”‚   β”œβ”€β”€ demo.js                    # Text-based demo
β”‚   └── dashboard.js               # Old dashboard (legacy)
β”‚
β”œβ”€β”€ βš™οΈ  config/
β”‚   └── agent-config.js            # Agent configuration
β”‚
β”œβ”€β”€ 🐳 Docker setup
β”‚   β”œβ”€β”€ Dockerfile                 # Container image
β”‚   β”œβ”€β”€ docker-compose.yml         # Multi-container config
β”‚   └── nginx/
β”‚       └── nginx.conf             # Reverse proxy config
β”‚
β”œβ”€β”€ πŸ“š Documentation
β”‚   β”œβ”€β”€ README.md                  # This file
β”‚   β”œβ”€β”€ DEPLOYMENT.md              # Deploy anywhere guide
β”‚   └── .env.example               # Environment template
β”‚
└── πŸ“¦ Configuration
    β”œβ”€β”€ package.json               # Dependencies & scripts
    β”œβ”€β”€ .gitignore                 # Git exclusions
    └── .dockerignore              # Docker exclusions

πŸš€ Usage

1. Setup (One-Time)

Visit: http://localhost:3000/setup

  • Add your OpenAI API key
  • Configure agent name and voice
  • Set tracking keywords
  • Add your workers

Everything is saved automatically!

2. View Analytics

Visit: http://localhost:3000/dashboard

See real-time:

  • Active workers
  • Tasks completed
  • Issues reported
  • Supply requests
  • Live activity feed

3. Start Voice Session

Visit: http://localhost:3000/voice

  • Select worker
  • Start conversation
  • Talk naturally
  • Everything tracked automatically

πŸŽ›οΈ Configuration

Via Web UI (Recommended)

Go to /setup and configure everything visually!

Via Config File (Advanced)

Edit config/agent-config.js:

module.exports = {
  agent: {
    name: "WorkMate",           // Agent name
    voice: "alloy",             // Voice style
    systemPrompt: "You are..." // Personality
  },

  analytics: {
    taskCompletion: {
      keywords: ["finished", "completed", "done"],
      action: "log_completion"
    },
    // Add your own tracking...
  },

  workers: {
    "W001": { name: "John", role: "Warehouse", shift: "morning" }
  }
}

πŸ“Š API Reference

Configuration API

# Get current config
GET /api/config

# Update agent settings
POST /api/config/agent
{
  "name": "WorkMate",
  "voice": "alloy",
  "systemPrompt": "You are..."
}

# Update keywords
POST /api/config/analytics
{
  "taskCompletion": {
    "keywords": ["done", "finished"],
    "action": "log_completion"
  }
}

# Add worker
POST /api/config/workers
{
  "workerId": "W001",
  "name": "John",
  "role": "Warehouse",
  "shift": "morning"
}

# Delete worker
DELETE /api/config/workers/:workerId

Analytics API

# Get analytics
GET /api/analytics

# Log activity
POST /api/activity
{
  "workerId": "W001",
  "type": "task_completion",
  "text": "Finished loading truck 5"
}

# Start voice session
POST /api/voice/start
{
  "workerId": "W001"
}

System API

# Health check
GET /health

# Test API key
POST /api/test/openai
{
  "apiKey": "sk-..."
}

# List voices
GET /api/voices

🌐 Deployment Options

Quick Deploy (5 minutes)

Using ngrok (for mobile testing):

# Terminal 1: Start server
npm run server

# Terminal 2: Expose publicly
ngrok http 3000

# Share URL with anyone!
# https://abc123.ngrok.io

Using Railway.app:

npm install -g @railway/cli
railway login
railway init
railway up

# Live at: https://your-app.railway.app

Production Deploy

See DEPLOYMENT.md for complete guides:

  • ☁️ Cloud platforms (Railway, Fly.io, DigitalOcean)
  • πŸ–₯️ Self-hosted VPS
  • πŸ”’ SSL certificate setup
  • πŸ“± Mobile testing
  • 🐳 Docker deployment

πŸ“± Mobile Access

Same WiFi (Instant)

# 1. Find your local IP
ifconfig | grep "inet "  # Mac/Linux
ipconfig                 # Windows

# 2. Start server
npm run server

# 3. On phone, visit:
http://192.168.1.XXX:3000

Over Internet (ngrok)

# 1. Start server
npm run server

# 2. Expose with ngrok
ngrok http 3000

# 3. Visit the https URL on any device!

PWA (Add to Home Screen)

On mobile browser:

  1. Visit your deployed site
  2. Tap "Share" β†’ "Add to Home Screen"
  3. App icon appears!

πŸ› οΈ Development

Run Locally

# Install
npm install

# Development (auto-reload)
npm run dev

# Production
npm run server

# Demo (no API key needed)
npm run demo

Docker Commands

# Build
npm run docker:build

# Start
npm run docker:up

# Stop
npm run docker:down

# Logs
npm run docker:logs

Environment Variables

Create .env:

# Required
OPENAI_API_KEY=sk-proj-your-key-here

# Optional
WORKER_ID=W001
PORT=3000
NODE_ENV=production

🎯 Use Cases

Warehouse Operations

Worker: "Finished packing order 1234"
Agent: "Great! That's your 15th order. Next is 1235."
πŸ“Š Tracks: productivity, completion time, order count

Field Technicians

Worker: "At the Johnson site, AC unit needs part AC-2847"
Agent: "Got it. I'll have it shipped to your next location."
πŸ“Š Tracks: job progress, parts needed, location

Delivery Drivers

Worker: "Delivered to 123 Main St"
Agent: "Perfect! 12 done. Next stop: 456 Oak Ave."
πŸ“Š Tracks: deliveries, routes, timing

Restaurant Staff

Worker: "Running low on tomatoes"
Agent: "Added to order. ETA 2pm. Need anything else?"
πŸ“Š Tracks: inventory, supply usage

πŸ”’ Security

Built-in security features:

  • βœ… API key validation
  • βœ… Rate limiting (nginx)
  • βœ… CORS configuration
  • βœ… Input sanitization
  • βœ… Environment variables (no hardcoded secrets)
  • βœ… HTTPS support (production)
  • βœ… Health checks
  • βœ… Graceful shutdowns

Before sharing externally:

  1. Add your .env file (never commit!)
  2. Enable HTTPS (Let's Encrypt)
  3. Configure rate limits
  4. Review CORS settings
  5. Set up monitoring

πŸ“ˆ Performance

Optimizations:

  • Gzip compression (nginx)
  • Static file caching
  • Real-time updates (3s intervals)
  • Lazy loading
  • Mobile-first design
  • < 1s load time

Scaling:

  • Docker Compose (multi-container)
  • Horizontal scaling ready
  • Database-agnostic design
  • Stateless architecture

πŸ› Troubleshooting

Can't access dashboard?

# Check if server is running
curl http://localhost:3000/health

# Check Docker logs
docker-compose logs -f

# Restart
npm run server

Mobile can't connect?

  1. Same WiFi network?
  2. Firewall blocking port?
  3. Use local IP, not localhost

API key issues?

  1. Get fresh key: https://platform.openai.com/api-keys
  2. Check .env file
  3. Test via /setup page
  4. Restart server

Docker issues?

# Rebuild from scratch
docker-compose down
docker-compose build --no-cache
docker-compose up

πŸ“š Documentation


🀝 Contributing

This is part of Agentic Tribe. Contributions welcome!

  1. Fork the repo
  2. Create your feature branch
  3. Test thoroughly
  4. Submit pull request

πŸ“„ License

MIT License - Use freely!


πŸŽ‰ What's New

v1.0.0 - Production Release

🎨 New Features:

  • βœ… Complete web UI (setup, dashboard, voice)
  • βœ… Mobile-responsive design
  • βœ… Docker deployment
  • βœ… Real-time analytics dashboard
  • βœ… Configuration via web interface
  • βœ… Worker management system
  • βœ… API key validation
  • βœ… Nginx reverse proxy
  • βœ… Health monitoring
  • βœ… Comprehensive deployment guide

πŸ“± Mobile Experience:

  • Touch-optimized interface
  • Add to home screen (PWA)
  • Works offline
  • Fast loading
  • Responsive design

🐳 DevOps:

  • Docker containerization
  • Docker Compose setup
  • Health checks
  • Graceful shutdown
  • Structured logging
  • Rate limiting

πŸš€ Quick Links


Built with:

  • OpenAI Realtime API
  • Node.js + Express
  • Docker + Docker Compose
  • Nginx
  • Vanilla JavaScript (no frameworks!)

Part of Agentic Tribe - Find Your Tribe. Build Together.

🌐 https://ruv.io/tribe

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages