Core Concepts

How MiraBridge orchestrates AI coding โ€” architecture, tools, and real-time sync

Understanding MiraBridge's architecture helps you get the most out of the platform.

The Orchestration Model

In MiraBridge, the developer is the orchestrator โ€” not the coder. You give instructions, the AI writes code. You approve tool executions, the AI applies changes.

Gateway โ€” The Central Hub

The Gateway is a NestJS backend that serves as the single connection point for all clients. It handles:

  • AI processing โ€” routing requests to Claude, GPT, or Gemini
  • Tool execution โ€” dispatching file, terminal, and git operations to VS Code
  • Real-time sync โ€” WebSocket-based message delivery between devices
  • Authentication โ€” JWT tokens with refresh, OAuth (GitHub/Google)
  • Billing โ€” prepaid credits, usage tracking, Stripe integration

Device Registry

The Gateway maintains a device registry tracking all connected clients:

  • VS Code Extension โ€” primary tool executor, runs code locally
  • Mobile App โ€” remote control and monitor
  • Codex Bridge โ€” translates between MiraBridge and Codex CLI

Tool Execution Flow

When the AI needs to perform an action:

  1. AI requests a tool execution (e.g., write a file)
  2. Gateway routes the request to VS Code
  3. VS Code shows an approval dialog
  4. You approve or reject
  5. Tool executes and result flows back through Gateway

WebSocket Communication

All real-time communication uses WebSocket with a custom message protocol. Messages are typed and versioned, supporting streaming, tool approval, plan mode, and more.

Next Steps