Technical Overview

Novitrac is built on a modern, scalable technology stack designed for enterprise-grade performance and reliability.

🛠️ Technology Stack

Frontend

Technology Version Purpose
React 18.3.1 UI framework with hooks and modern patterns
TypeScript 5.6.3 Type safety and developer experience
Tailwind CSS 3.4.17 Utility-first CSS framework
Radix UI Latest Accessible UI component library (30+ components)
TanStack Query 5.60.5 Server state management and caching
React Hook Form 7.55.0 Performant form handling with validation
Wouter 3.3.5 Lightweight routing (2KB)
Framer Motion 11.13.1 Smooth animations and transitions
Recharts 2.15.2 Data visualization and charts
Vite 5.4.20 Fast build tool with HMR

Backend

Technology Version Purpose
Node.js 18+ JavaScript runtime
Express.js 4.21.2 Web framework for APIs
TypeScript 5.6.3 Type-safe backend code
PostgreSQL 14+ Primary database (ACID compliant)
Drizzle ORM 0.39.1 Type-safe database queries
WebSockets (ws) 8.18.3 Real-time bidirectional communication
Passport.js 0.7.0 Authentication middleware
bcrypt 6.0.0 Password hashing
Zod 3.24.2 Runtime validation and type inference
Nodemailer 7.0.10 Email sending (SMTP)

External APIs & Services

Service Purpose Cost Structure
Twilio Phone calling, SMS, phone numbers ~$0.013-0.022/min (US outbound)
ElevenLabs AI voice synthesis, conversational AI ~$0.015-0.03/min
Stripe Payment processing, subscriptions 2.9% + $0.30 per transaction
SMTP (Gmail/SendGrid) Transactional emails (OTP, notifications) Free (Gmail) or $15-20/mo (SendGrid)

🗄️ Database Schema

Total Tables: 21 tables with comprehensive relationships

ORM: Drizzle ORM for type-safe queries

Migrations: Version-controlled schema changes

Core Tables

  • users - User accounts with roles and plans
  • agents - AI voice agents with personalities
  • campaigns - Calling campaigns with scheduling
  • contacts - Contact lists per campaign
  • calls - Individual call records with transcripts
  • call_queue - Intelligent queue with retry logic

Business Logic Tables

  • plans - Subscription plan definitions
  • user_subscriptions - Active user subscriptions
  • credit_packages - Credit purchase options
  • credit_transactions - Credit usage history
  • phone_numbers - Managed phone numbers
  • phone_number_rentals - Billing history

Platform Tables

  • eleven_labs_credentials - API key pool with load balancing
  • knowledge_base - Agent training documents
  • webhooks - CRM integration webhooks
  • webhook_deliveries - Delivery logs
  • notifications - User notifications
  • global_settings - Platform configuration
  • panel_config - Branding settings
  • otp_verifications - Email verification

🏗️ System Architecture

Current Architecture (Monolithic)

┌─────────────────────────────────────┐
│     Client (React SPA)              │
│  • Responsive UI                    │
│  • Real-time updates (WebSocket)    │
└──────────────┬──────────────────────┘
               │ HTTPS/REST API
               ▼
┌─────────────────────────────────────┐
│   Express.js Server (Node.js)       │
│  • API Routes                       │
│  • Authentication                   │
│  • Business Logic                   │
│  • WebSocket Server                 │
│  • Background Jobs                  │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│   PostgreSQL Database               │
│  • 21 tables                        │
│  • JSONB for flexibility            │
│  • Indexed for performance          │
└─────────────────────────────────────┘
                    

External Service Integration

┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│   Twilio     │  │ ElevenLabs   │  │   Stripe     │
│  Telephony   │  │  AI Voice    │  │  Payments    │
└──────┬───────┘  └──────┬───────┘  └──────┬───────┘
       │                 │                 │
       └─────────────────┴─────────────────┘
                         │
                         ▼
              ┌─────────────────────┐
              │  Novitrac Platform  │
              └─────────────────────┘
                    

Scaling Strategy (Future)

Phase 1: Add Redis for caching and sessions

Phase 2: Move to object storage (S3) for files

Phase 3: Horizontal scaling with load balancer

Phase 4: Microservices for queue processing

Phase 5: Multi-region deployment

📊 Code Quality Metrics

Codebase Size

158

TypeScript/TSX files


21,184

Lines of code

Type Safety

100%

TypeScript coverage


Type-safe

Database queries (Drizzle)

Components

100+

React components


50+

API endpoints

Code Organization

  • Separation of concerns (client/server/shared)
  • Service layer for business logic
  • Reusable UI components
  • Type-safe database schema
  • Comprehensive error handling
  • Input validation with Zod

🔒 Security Features

Authentication & Authorization

  • Session-based authentication
  • Password hashing with bcrypt
  • Role-based access control (RBAC)
  • OTP email verification
  • Password reset functionality
  • HttpOnly, Secure cookies

Data Protection

  • SQL injection prevention (ORM)
  • XSS protection (React escaping)
  • Input validation (Zod)
  • Webhook signature verification
  • Environment variable secrets
  • Database connection pooling

⚡ Performance Optimizations

Frontend Performance

  • Code Splitting: Route-based lazy loading
  • Caching: TanStack Query for server state
  • Optimized Rendering: React memoization
  • Fast Build: Vite with HMR
  • Small Bundle: Lightweight routing (Wouter)

Backend Performance

  • Database: Indexed queries, connection pooling
  • Queue Processing: Batch operations
  • API Key Pool: Load balancing across ElevenLabs keys
  • Async Operations: Non-blocking I/O
  • Efficient Queries: Select only needed fields

🚀 Deployment

Current Hosting: VPS

Platform: Hostinger VPS (Debian)

Specifications: 2+ CPU, 2GB+ RAM, 50GB+ SSD

Process Manager: PM2

Reverse Proxy: Nginx (recommended)

SSL: Let's Encrypt (Certbot)

Build & Deploy Process

# Install dependencies npm install # Build for production npm run build # Start production server npm start # Or use PM2 pm2 start dist/index.js --name novitrac

Environment Variables Required

  • Database: PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE
  • Twilio: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
  • ElevenLabs: ELEVENLABS_API_KEY
  • Stripe: STRIPE_SECRET_KEY, VITE_STRIPE_PUBLIC_KEY
  • SMTP: SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS
  • App: NODE_ENV, PORT, APP_URL, SESSION_SECRET

📈 Scalability

Current Capacity

Metric Current Limit Notes
Concurrent Users 100-500 On standard VPS
Calls per Day 1,000-5,000 Limited by API keys
Database Size 50GB+ PostgreSQL handles well
API Requests/min 1,000+ With proper caching

Scaling Bottlenecks & Solutions

Bottleneck Solution When Needed
Database connections Connection pooling, read replicas >500 concurrent users
ElevenLabs API limits API key pool (already implemented) >30 concurrent calls per key
File storage Move to S3/object storage >100GB files
Session storage Move to Redis >1,000 concurrent users
Single server Horizontal scaling + load balancer >2,000 concurrent users