Overview
Voxora is built as a modern, scalable monorepo application with separate frontend and backend services that communicate via REST APIs and WebSocket connections.System Architecture
Core Components
1. Web Application (apps/web)
Technology Stack
- Framework: Next.js 15 (App Router)
- UI Library: React 19
- Styling: Tailwind CSS
- State Management: React Hooks + Context
- Build Tool: Turbopack
- Agent dashboard and admin interface
- Real-time conversation management
- Team and department management
- Analytics and reporting
- User authentication
- Server-side rendering (SSR)
- Static site generation (SSG) where applicable
- Real-time updates via Socket.IO
- Responsive design with Tailwind CSS
2. API Server (apps/api)
Technology Stack
- Framework: Express 5
- Real-time: Socket.IO
- Database ORM: Mongoose
- Caching: Redis
- Authentication: JWT
- RESTful API endpoints
- WebSocket connections for real-time chat
- User authentication and authorization
- Business logic and data validation
- Database operations
- Email notifications
3. Chat Widget
Technology Stack
- Format: Vanilla JavaScript
- Styling: Inline CSS + customizable themes
- Size: Lightweight (~50KB minified)
- Integration: Single script tag
- Embeddable in any website
- Customizable appearance
- Real-time messaging
- Typing indicators
- File uploads
- Notification sounds
Data Layer
MongoDB
Primary database for persistent data storage. Collections:users- User accounts (agents, admins)customers- Customer informationconversations- Chat sessionsmessages- Individual messagesdepartments- Team organizationsettings- Application configuration
- User email (unique)
- Conversation timestamps
- Message conversation ID
- Full-text search on messages
Redis
In-memory data store for caching and session management. Use Cases:- Session storage
- Real-time user presence
- Rate limiting
- Caching frequently accessed data
- Pub/Sub for distributed events
Communication Patterns
REST API
Used for:- CRUD operations
- Authentication
- File uploads
- Configuration management
WebSocket (Socket.IO)
Used for:- Real-time messaging
- Typing indicators
- User presence
- Live notifications
- Connection status
Authentication & Authorization
JWT-based Authentication
Role-Based Access Control (RBAC)
Roles:- Admin: Full system access
- Agent: Access to assigned conversations
- Customer: Access to own conversations
Scalability Considerations
Horizontal Scaling
- API Servers: Stateless design allows multiple instances
- Socket.IO: Redis adapter for multi-server support
- Database: MongoDB replica sets for read scaling
Caching Strategy
Load Balancing
Recommended setup for production:Security Architecture
Authentication
JWT tokens with short expiry times
Authorization
Role-based access control (RBAC)
Data Encryption
HTTPS/TLS for data in transit
Input Validation
Request validation and sanitization
Monitoring & Logging
Application Logging
- Request/response logging
- Error tracking
- Performance metrics
- Audit trails
Health Checks
Next Steps
Monorepo Structure
Explore the codebase organization
Real-time Chat
Learn about the chat system
Development Setup
Set up your development environment
API Reference
Browse API endpoints