Skip to content

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.

We run a deliberately opinionated, modern TypeScript stack — one tool per job, chosen for speed and a tight feedback loop:

AreaChoice
LanguageTypeScript (strict), everywhere
Runtime & package managerBun
Monorepo / task runnerTurborepo
Lint / formatBiome + Oxlint (type-aware) — no ESLint/Prettier
Frontend buildVite (HUD, Live, call-app); Next.js (Dashboard); Astro Starlight (these docs)
UIReact + Tailwind + shadcn/Radix
DesktopElectron (Apple-signed)
Edge backendCloudflare Workers + Durable Objects via the Agents SDK; Hono routing
DataSupabase (Postgres, Drizzle ORM) · Cloudflare D1 / R2 / KV / Vectorize / AI Search
Async / jobsInngest
LLM accessVercel AI SDK (multi-provider) + Cloudflare AI Gateway
Auth / secretsClerk · Doppler
DeployWrangler (Workers) · Vercel (Dashboard)
TestsVitest (unit/integration) · Playwright (E2E) · Storybook + Chromatic (visual)
ObservabilityAxiom · Sentry · PostHog
Code quality / security CISonarQube · CodeQL · Semgrep · Dependabot + AI reviewers (Claude, Qodo, CodeRabbit, BugBot, Aikido)

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.

The user-facing components of Frontier are designed for a seamless, real-time experience:

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.

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 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_AUDIO flag, 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.

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.

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.

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 AIChatAgent from the Agents SDK. Each active call has its own CallAgent instance, addressed by its callId. 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.

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.

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.

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 DB to the call-agent Cloudflare 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.

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.

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-agent Worker for embeddings and inference. An Embedder Worker also provides a local development shim for AI embeddings and question detection when the full Cloudflare Workers AI binding is unavailable.

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 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.

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.

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 gh CLI and GitHub GraphQL API. It queries GitHub live, without a local database or cache, to manage the PR lifecycle.
  • PR Pipeline: shepherd classifies 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: shepherd aggregates 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-requested label) 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_group events as a final safety net before code lands on main.
  • Autonomous Fixes: For PRs classified as FIX-tier, shepherd dispatches parallel pr-fix sub-agents. These agents autonomously rebase, apply local fixes, incorporate bot suggestion patches, and resolve review threads, typically pushing a single force-with-lease commit.
  • Human Gating: A review:paused label provides a control mechanism, suppressing automated reviews and acting as a hard merge queue guard. The prepare-pr skill 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: shepherd generates structured telemetry to shepherd-log.jsonl, which helps track fix-cycle counts and identify chronic churn, flagging PRs with fixCycle >= 3 for human escalation.