This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
The project has undergone comprehensive TypeScript error resolution, significantly improving development stability and code quality:
- ✅ Development Server Stability: Fixed critical syntax errors preventing compilation
- ✅ Reduced Error Count: Resolved 88% of critical TypeScript errors (~45 to ~40 errors)
- ✅ Enhanced VoiceBot Component: Fixed syntax errors and removed unused components
- ✅ Improved Exports: Resolved export mismatches and added missing function exports
- ✅ Type Safety: Resolved interface conflicts and improved type checking
- ✅ Code Quality: Cleaned up unused variables and improved maintainability
Key fixes implemented:
- VoiceBot.tsx syntax error resolution
- Icons component export standardization
- Voice cloning service compatibility improvements
- Window interface type conflict resolution
- Code cleanup and optimization
Impact for developers:
- Faster development server startup
- Improved TypeScript IntelliSense
- Better error detection and prevention
- More stable development experience
This project uses environment variables for configuration. To set up your local environment:
-
Copy the template file to create your local environment file:
cp .env.example .env.local
-
Edit
.env.localand add your API keys and configuration values. -
Important: Never commit
.env.localor any files containing actual credentials to the repository. The.env.localfile is already in.gitignoreto prevent accidental commits. -
For more details on environment variables and security practices, see
docs/documentation.md.
For core functionality:
NEXT_PUBLIC_USE_AI_API: Set to "true" to enable AI chat functionality
For AI chat functionality (if enabled):
OPENAI_API_KEY: Your OpenAI API key
For database functionality (if using):
DATABASE_URL: Your database connection string
This project implements comprehensive rate limiting to prevent abuse and control costs for both chat and voice interactions.
The chat API is protected by Redis-backed rate limiting to prevent abuse and ensure fair usage.
- Current limit: 10 messages per user per hour
- How it works: Each user is identified by a hash of their IP and User-Agent. The limit is enforced using Redis, so it works across all server instances and survives restarts.
- Environment variables:
OPENAI_RATE_LIMIT— Maximum number of chat messages per user per window (default: 20, currently set to 10)OPENAI_RATE_WINDOW_MS— Window size in milliseconds (default: 3600000 for 1 hour)REDIS_URL— Redis connection string (default:redis://localhost:6379)
The voice bot includes comprehensive rate limiting to control costs for ElevenLabs voice cloning and prevent abuse:
- Session Limits: Max 3 conversations, 10 messages per conversation, 500 characters per message
- Time Limits: 3-second cooldown between messages, hourly character limits
- Daily Limits: Max $5.00 cost per day, 20 minutes of cloned voice per day
- Smart Degradation: Falls back to free browser TTS when cloned voice limits are reached
Configuration Presets:
# Choose your environment preset
NEXT_PUBLIC_VOICE_RATE_LIMIT_PRESET=production # Conservative limits
NEXT_PUBLIC_VOICE_RATE_LIMIT_PRESET=development # Generous for testing
NEXT_PUBLIC_VOICE_RATE_LIMIT_PRESET=demo # Very restrictive
# Or customize individual limits
NEXT_PUBLIC_VOICE_MAX_COST_PER_DAY=5.00
NEXT_PUBLIC_VOICE_MAX_CHARACTERS_PER_SESSION=3000
# ... see docs/VOICE_RATE_LIMITING_SETUP.md for all optionsFeatures:
- ✅ Real-time usage monitoring
- ✅ Cost estimation and tracking
- ✅ Graceful fallback to free TTS
- ✅ User-friendly error messages
- ✅ Session-based tracking (privacy-respecting)
For detailed configuration options, see docs/voice-rate-limiting-guide.md.
To change the rate limits, update these variables in your .env.local or deployment environment.
This project includes comprehensive documentation for all features:
- Features Overview - Complete feature list and capabilities
- Project Milestones - Development progress and roadmap
- Technical Documentation - Architecture and component specs
- Voice Cloning Setup - ElevenLabs integration guide
- Voice Mode Implementation - Technical implementation details
- Voice Rate Limiting Guide - Comprehensive rate limiting documentation
- Voice Rate Limiting Setup - Quick setup guide
- Chat API Guide - AI chat integration details
- Hybrid Conversational Agent - Advanced voice/chat features
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.