Skip to main content

System Architecture

TalkifAI is composed of four independently deployed services:
                    ┌──────────────────────────────┐
                    │       End User Browser        │
                    │   or Phone (via SIP carrier)  │
                    └──────────────┬───────────────┘

                    ┌──────────────▼───────────────┐
                    │       TalkifAI Studio         │
                    │    (Next.js 15 - App Router)  │
                    │                               │
                    │  • User authentication        │
                    │  • Agent configuration UI     │
                    │  • Organization management    │
                    │  • LiveKit token generation   │
                    │  • Call session tracking      │
                    │  • Telephony webhooks         │
                    └──────────────┬───────────────┘

              ┌────────────────────┼────────────────────┐
              │                    │                    │
              ▼                    ▼                    ▼
  ┌───────────────────┐  ┌─────────────────┐  ┌────────────────────┐
  │  Voice Agent      │  │  Billing        │  │  Marketing Site    │
  │  Runtime          │  │  Service        │  │  (Next.js)         │
  │  (Python/FastAPI  │  │  (Python/FastAPI│  │                    │
  │   + LiveKit)      │  │   + Redis)      │  │  • Landing pages   │
  │                   │  │                 │  │  • Public demo     │
  │  • STT/LLM/TTS    │  │  • Credits      │  │  • Marketing       │
  │  • Session mgmt   │  │  • Usage track  │  └────────────────────┘
  │  • Function calls │  │  • Auto top-up  │
  │  • Recordings     │  │  • Cost calc    │
  │  • Transcripts    │  └─────────────────┘
  └───────────────────┘


  ┌───────────────────┐
  │   LiveKit Server  │
  │   (WebRTC/SIP)    │
  └───────────────────┘

Services

TalkifAI Studio

Main Next.js app — dashboard, agent builder, auth, API endpoints.

Voice Agent Runtime

Python service running the actual voice agents on LiveKit.

Billing Service

FastAPI service managing credits, usage, and payments.

Security

Authentication, encryption, and multi-tenant isolation.

Database Architecture

All services share a PostgreSQL database (Neon serverless) via Prisma ORM. Key tables:
TablePurpose
userUser accounts
organizationTenant workspaces
memberUser-org relationships + roles
AgentVoice agent configurations
PhoneNumberBYOC phone numbers
CarrierCredentialsEncrypted SIP credentials
UserVoiceSessionCall session records
DeveloperQuotaMonthly usage limits
ApiKeysOrganization API keys (encrypted)
CustomFunctionCustom webhook functions
PostCallAnalysisFormQA form definitions

Infrastructure

ComponentTechnologyHosting
Studio Frontend/BackendNext.js 15Vercel
Voice Agent RuntimePython + FastAPIGoogle Cloud VM
Billing ServicePython + FastAPIGoogle Cloud Run
DatabasePostgreSQL (Neon)Neon Cloud
CacheRedisGoogle Cloud Memorystore
RecordingsGCS BucketsGoogle Cloud Storage
LiveKit ServerLiveKit CloudLiveKit Cloud
Status PageBetterStackBetterStack

Scale Characteristics

MetricValue
LiveKit rooms per node3,000
Participants per node6,000
Concurrent users (horizontal)10,000+
Batch calls per day100,000+
DB connection pool5 (Neon limit)
Redis cache TTL30 seconds (credits)