Architecture & tech stack
Frontier’s technical architecture is built for real-time AI performance and scalability, leveraging a modern monorepo and Cloudflare’s global edge network. This document provides a container-level overview of the system’s deployable units, services, and data stores, orienting engineers before they delve into the codebase.
Stack at a glance
Section titled “Stack at a glance”We run a deliberately opinionated, modern TypeScript stack — one tool per job, chosen for speed and a tight feedback loop:
| Area | Choice |
|---|---|
| Language | TypeScript (strict), everywhere |
| Runtime & package manager | Bun |
| Monorepo / task runner | Turborepo |
| Lint / format | Biome + Oxlint (type-aware) — no ESLint/Prettier |
| Frontend build | Vite (HUD, Live, call-app); Next.js (Dashboard); Astro Starlight (these docs) |
| UI | React + Tailwind + shadcn/Radix |
| Desktop | Electron (Apple-signed) |
| Edge backend | Cloudflare Workers + Durable Objects via the Agents SDK; Hono routing |
| Data | Supabase (Postgres, Drizzle ORM) · Cloudflare D1 / R2 / KV / Vectorize / AI Search |
| Async / jobs | Inngest |
| LLM access | Vercel AI SDK (multi-provider) + Cloudflare AI Gateway |
| Auth / secrets | Clerk · Doppler |
| Deploy | Wrangler (Workers) · Vercel (Dashboard) |
| Tests | Vitest (unit/integration) · Playwright (E2E) · Storybook + Chromatic (visual) |
| Observability | Axiom · Sentry · PostHog |
| Code quality / security CI | SonarQube · CodeQL · Semgrep · Dependabot + AI reviewers (Claude, Qodo, CodeRabbit, BugBot, Aikido) |
Overall Architecture & Runtime
Section titled “Overall Architecture & Runtime”Frontier’s development environment is structured as a Turborepo monorepo, with Bun used for efficient build orchestration and runtime. The system deploys components across various environments, including Cloudflare for its edge compute, a Next.js application for the Dashboard, and an Electron application for the Desktop client.
Frontend & Desktop Experience
Section titled “Frontend & Desktop Experience”The user-facing components of Frontier are designed for a seamless, real-time experience:
Desktop Application
Section titled “Desktop Application”The primary user interface is the Desktop client (an Electron app), which runs on the sales representative’s macOS machine (with Windows planned). This application hosts the call user interface, the Heads-Up Display (HUD) overlay, and is responsible for capturing call audio and rendering real-time coaching cues.
Heads-Up Display (HUD)
Section titled “Heads-Up Display (HUD)”The HUD (@frontierx/hud-app) is a Vite/React web application embedded as an overlay within the Desktop client. It shares core logic and components via the hud-core and call-app libraries, facilitating consistent real-time call management, transcription display, script progress tracking, and AI feedback.
Audio Capture & Transcription
Section titled “Audio Capture & Transcription”Audio capture for live calls is a critical component, currently undergoing migration:
- Current Path: Audio is captured using the Recall Desktop SDK running within the Electron Desktop app on the representative’s machine.
- Mid-migration Path: Frontier is transitioning to direct mic + speaker capture for complete separation of the representative’s and customer’s audio feeds, which the Recall path cannot currently provide. This direct-audio path, enabled by a
USE_DIRECT_AUDIOflag, taps system/customer audio via CoreAudio loopback and the representative’s microphone, streaming it directly to Deepgram for transcription. - Deprecated Path: A legacy Recall.ai cloud bot integration, which would join meetings as a participant, is deprecated and no longer used in the live path.
Dashboard
Section titled “Dashboard”The Dashboard (@frontierx/dash) is a Next.js application that provides administrative and setup functionalities. It hosts API routes for call provisioning, receives webhooks from external services like Recall.ai, and manages asynchronous workflows through Inngest functions.
Backend & Edge Compute
Section titled “Backend & Edge Compute”Frontier’s real-time call processing logic resides on Cloudflare’s global edge network, minimizing latency. The Call Server is not a single entity, but an orchestrated set of Cloudflare Workers deployed together. This setup includes a main worker that hosts multiple per-call Durable Objects via the Agents SDK, along with companion workers for specialized tasks.
Durable Objects
Section titled “Durable Objects”Cloudflare Durable Objects provide a unit of strongly consistent, single-threaded state and execution. Frontier uses several distinct Durable Object classes to manage the lifecycle and real-time state of each call:
- CallAgent: This is the primary orchestrator Durable Object for a live call, extending the
AIChatAgentfrom the Agents SDK. Each active call has its ownCallAgentinstance, addressed by itscallId. It delegates specific tasks to other Durable Objects and companion workers. - CallChatAgent: Manages chat-related state for calls, addressed by a
threadId. - QuickAnswerAgent: Provides fast, inline answers during a call.
- WebSocketRelayAgent: Handles inbound call and transcript WebSocket traffic from external services like Recall.ai, relaying events into the agent system. To maintain continuous connectivity, this Durable Object disables hibernation.
- OrgAnswerAgent: Provides organization-scoped knowledge and answer retrieval.
- CallAnswerAgent: Facilitates call-scoped knowledge and answer retrieval.
In addition, TranscriptStreamAgent and VoiceAgent are Durable Object classes exported from the call-agent Worker, but they are currently not bound or migrated in the production Cloudflare Worker configuration.
Companion Workers
Section titled “Companion Workers”The call-agent Worker is service-bound to five separate Companion Workers. These Cloudflare Workers handle specialized functions like transcript orchestration, question detection, FAQ detection, script completion, and logging, communicating with the main call-agent Worker via private service bindings.
Speech-to-Text
Section titled “Speech-to-Text”The Call Server connects directly to Deepgram via a WebSocket for real-time, word-level-timed speech-to-text (STT) transcription. This direct connection, provided by DirectDeepgramSTT, is used for immediate HUD transcription in all environments.
Data Persistence & Storage
Section titled “Data Persistence & Storage”Frontier leverages a hybrid data storage strategy, combining managed services with Cloudflare’s native data offerings:
- Supabase (Postgres): An external managed Postgres database, Supabase is primarily used for storing application configuration, managing background jobs, and enabling real-time subscriptions for live updates. Calls to Supabase from the edge are comparatively infrequent.
- Cloudflare D1 (SQLite database): Used for storing call transcripts and other structured data related to live calls. It is bound as
DBto thecall-agentCloudflare Worker. - Cloudflare Vectorize: A vector index, bound as
VECTORIZE, used for managing embeddings crucial for retrieval-augmented generation (RAG) and other AI features. - Cloudflare AI Search: An AI-powered search service used for knowledge retrieval, backed by a Cloudflare R2 bucket (
AI_SEARCH_KNOWLEDGE_BUCKET). - Cloudflare KV: A key-value store used for caching data, specifically for
SCRIPT_CACHE.
Knowledge Base & Retrieval
Section titled “Knowledge Base & Retrieval”The Knowledge Base (KB) layer is a critical component for providing accurate, context-aware coaching, and is currently in active evaluation with a multi-backend design. This approach allows for runtime selection of the retrieval backend.
- Today: The KB utilizes Cloudflare AI Search and Supermemory as a deliberate stop-gap solution.
- Planned: Frontier is actively experimenting with Graph RAG services for the KB layer, including solutions like Amazon Bedrock Knowledge Bases and Anthropic models, among others. This strategy prioritizes delivering a robust user experience and high performance first, with further investment planned for accuracy and completeness through advanced knowledge-base modeling.
AI & Language Models
Section titled “AI & Language Models”Frontier integrates with various external Large Language Model (LLM) providers to power its AI coaching capabilities. This multi-provider strategy leverages the Vercel AI SDK for flexibility.
- LLM Providers: Currently integrated providers include Anthropic, Google, OpenAI, and TogetherAI.
- Workers AI: Cloudflare Workers AI is used within the
call-agentWorker for embeddings and inference. AnEmbedder Workeralso provides a local development shim for AI embeddings and question detection when the full Cloudflare Workers AI binding is unavailable.
Asynchronous Workflows
Section titled “Asynchronous Workflows”Asynchronous processing and background jobs are handled by Inngest, which is hosted within the Dashboard Next.js app.
- Event-Driven Processing: Inngest processes a wide range of events, including validating and forwarding Recall.ai webhooks, managing call and bot lifecycles, orchestrating knowledge ingestion, handling Cloudflare AI Search re-indexing, synchronizing FAQs and scripts, performing website crawls, managing user/organization lifecycles, and generating call summaries and metrics.
- Cron-Scheduled Jobs: Inngest also manages durable cron-scheduled jobs for periodic tasks such as calendar cleanups, scheduled bot cleanups, stale heartbeat sweeps, and ensuring upcoming bots are scheduled.
Secrets & Authentication
Section titled “Secrets & Authentication”- Secrets Management: Doppler is utilized for secure management and distribution of application secrets across all environments.
- Authentication: Authentication mechanisms are in place to secure access to the Frontier platform, though specific providers and protocols are not detailed here.
Observability
Section titled “Observability”Frontier’s observability stack provides insights into system performance and health:
- Error Tracking: Sentry is integrated for real-time error tracking and alerting, capturing exceptions and performance issues across the application.
- Logging & Tracing: Axiom is used for centralized logging and distributed tracing, leveraging Cloudflare Workers observability features to provide comprehensive visibility into edge compute operations.
Agentic Development Pipeline
Section titled “Agentic Development Pipeline”Frontier’s development workflow incorporates an agentic pipeline, orchestrated by a system called shepherd (@frontierx/shepherd), designed to automate and enhance code quality, review, and merging processes.
- shepherd CLI: The core of the pipeline is a typed Bun CLI that wraps the
ghCLI and GitHub GraphQL API. It queries GitHub live, without a local database or cache, to manage the PR lifecycle. - PR Pipeline:
shepherdclassifies each open pull request into distinct pipeline stages: TRIAGE, FIX, CI_WAIT, VERIFY, QUEUE, MERGE_QUEUE, and MERGED, with an additional MERGE_QUEUE_EJECTED state. - Feedback Aggregation:
shepherdaggregates feedback from various review tools into a single triage manifest. These tools include:- AI/Bot Reviewers: Claude Code Review (via AWS Bedrock), Qodo/PR-Agent (via Bedrock), Cursor BugBot, Aikido, and GitHub Copilot.
- Static Analysis: SonarQube/SonarCloud, CodeQL, biome (for formatting and linting), and oxlint (type-aware linting).
- Quality Gates: Required CI checks for merging include linting, type-checking, testing, unused code checks, circular dependency checks, and cognitive complexity enforcement (biome). SonarQube runs a full-coverage analysis when explicitly requested (via a
sonar-requestedlabel) and as a required hard gate within the merge queue. - GitHub Merge Queue: The pipeline utilizes GitHub’s native merge queue. All required CI checks, including the full test suite, are run on
merge_groupevents as a final safety net before code lands onmain. - Autonomous Fixes: For PRs classified as
FIX-tier,shepherddispatches parallelpr-fixsub-agents. These agents autonomously rebase, apply local fixes, incorporate bot suggestion patches, and resolve review threads, typically pushing a singleforce-with-leasecommit. - Human Gating: A
review:pausedlabel provides a control mechanism, suppressing automated reviews and acting as a hard merge queue guard. Theprepare-prskill enforces a mandatory local quality and dual-reviewer loop before a PR can be pushed. Guard overrides are audited, requiring a reason for any skip. - Telemetry:
shepherdgenerates structured telemetry toshepherd-log.jsonl, which helps track fix-cycle counts and identify chronic churn, flagging PRs withfixCycle >= 3for human escalation.