# ramananbuilds/anygate architecture

> Architecture diagram of the GitHub repository ramananbuilds/anygate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ramananbuilds/anygate
- Repository: https://github.com/ramananbuilds/anygate

## Overview

anygate is a CLI and visual launcher for configuring model providers, launching coding agents against selected models, and exposing local compatible API gateways. The principal workflow is provider setup, model selection, agent launch, and—optionally—gateway request routing to an upstream provider. Distinct branches cover provider/auth management, supported agent integrations, gateway serving, and the browser UI. Relationships are limited to README statements and the supplied source excerpts/index; some UI-to-backend and unsampled integration links are therefore omitted.

Main entry points: [`src/gateway/server/router.ts`](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/router.ts) (Request routing), [`src/apps/shared/launch.ts`](https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/launch.ts) (Shared launch support), [`src/gateway/server/server.ts`](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/server.ts) (Gateway server), [`src/registry/provider-catalog.ts`](https://github.com/ramananbuilds/anygate/blob/main/src/registry/provider-catalog.ts) (Provider catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands<br/>[index.ts]"]
  node_cli_impl["CLI handlers<br/>[cli.ts]"]
end

subgraph group_providers["Providers and auth"]
  node_registry["Provider catalog"]
  node_registry_import["Provider import<br/>[import-build.ts]"]
  node_provider_auth["Provider authentication<br/>[provider-auth.ts]"]
  node_oauth_auth["OpenCode OAuth<br/>[opencode-auth.ts]"]
  node_config_store[("Provider configuration<br/>[config.ts]")]
end

subgraph group_launch["Agent launch"]
  node_agent_launch["Shared launch support<br/>[launch.ts]"]
  node_agent_claude["Claude integrations<br/>[desktop.ts]"]
  node_agent_codex["Codex app launch<br/>[app.ts]"]
  node_agent_gemini["Gemini integrations<br/>[launch.ts]"]
  node_context["Context sizing<br/>[context-window.ts]"]
  node_cloud_backend["Cloud Code backend"]
end

subgraph group_gateway["API gateways"]
  node_gateway_cli["Gateway setup<br/>[server.ts]"]
  node_gateway_server["Gateway server<br/>[server.ts]"]
  node_gateway_router["Request routing<br/>[router.ts]"]
  node_gateway_models["Model catalog<br/>[models.ts]"]
  node_provider_factory["SDK provider factory"]
  node_sdk_adapter["SDK adapter<br/>[sdk-adapter.ts]"]
  node_anthropic_proxy["Anthropic proxy<br/>[anthropic-proxy.ts]"]
  node_zen_gate["OpenCode gateway<br/>[opencode-gate.ts]"]
  node_trace_log["Request trace log<br/>[trace-log.ts]"]
end

subgraph group_ui["Browser interface"]
  node_ui_app["Visual launcher<br/>[App.svelte]"]
  node_ui_apps["Launch selection<br/>[Apps.svelte]"]
  node_ui_server["Server controls<br/>[server.svelte.ts]"]
  node_ui_api["UI API client<br/>[endpoints.ts]"]
end

node_user(("User"))

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches"| node_cli_impl
node_user -->|"configures providers"| node_registry
node_registry -->|"stores configuration"| node_config_store
node_registry_import -->|"imports provider data"| node_registry
node_provider_auth -->|"uses credentials"| node_oauth_auth
node_user -->|"selects model"| node_agent_launch
node_agent_launch -.->|"launches Claude"| node_agent_claude
node_agent_launch -.->|"launches Codex"| node_agent_codex
node_agent_launch -.->|"launches Gemini"| node_agent_gemini
node_agent_codex -->|"resolves context"| node_context
node_agent_codex -->|"starts backend"| node_cloud_backend
node_user -->|"starts gateway"| node_gateway_cli
node_gateway_cli -->|"starts server"| node_gateway_server
node_gateway_server -->|"loads catalog"| node_registry
node_gateway_server -->|"builds catalog"| node_gateway_models
node_gateway_server -->|"starts routing"| node_gateway_router
node_gateway_router -->|"creates model"| node_provider_factory
node_gateway_router -->|"streams response"| node_sdk_adapter
node_gateway_router -.->|"forwards requests"| node_anthropic_proxy
node_provider_factory -->|"wraps Zen fetch"| node_zen_gate
node_gateway_router -->|"writes traces"| node_trace_log
node_user -->|"opens dashboard"| node_ui_app
node_ui_app -->|"shows launch route"| node_ui_apps
node_ui_apps -.->|"requests launch"| node_agent_launch
node_ui_app -->|"tracks server"| node_ui_server
node_ui_server -->|"calls endpoints"| node_ui_api

click node_cli "https://github.com/ramananbuilds/anygate/blob/main/src/cli/index.ts"
click node_cli_impl "https://github.com/ramananbuilds/anygate/blob/main/src/cli.ts"
click node_registry "https://github.com/ramananbuilds/anygate/blob/main/src/registry/provider-catalog.ts"
click node_registry_import "https://github.com/ramananbuilds/anygate/blob/main/src/registry/loader/import-build.ts"
click node_provider_auth "https://github.com/ramananbuilds/anygate/blob/main/src/registry/provider-auth.ts"
click node_oauth_auth "https://github.com/ramananbuilds/anygate/blob/main/src/registry/opencode-auth.ts"
click node_config_store "https://github.com/ramananbuilds/anygate/blob/main/src/storage/config.ts"
click node_agent_launch "https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/launch.ts"
click node_agent_claude "https://github.com/ramananbuilds/anygate/blob/main/src/apps/claude/desktop.ts"
click node_agent_codex "https://github.com/ramananbuilds/anygate/blob/main/src/apps/codex/app.ts"
click node_agent_gemini "https://github.com/ramananbuilds/anygate/blob/main/src/apps/gemini/launch.ts"
click node_context "https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/context-window.ts"
click node_cloud_backend "https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/cloud-code-backend.ts"
click node_gateway_cli "https://github.com/ramananbuilds/anygate/blob/main/src/cli/server.ts"
click node_gateway_server "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/server.ts"
click node_gateway_router "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/router.ts"
click node_gateway_models "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/models.ts"
click node_provider_factory "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/providers/provider-factory.ts"
click node_sdk_adapter "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/adapters/sdk-adapter.ts"
click node_anthropic_proxy "https://github.com/ramananbuilds/anygate/blob/main/src/gateway/proxy/anthropic-proxy.ts"
click node_zen_gate "https://github.com/ramananbuilds/anygate/blob/main/src/providers/opencode-gate.ts"
click node_trace_log "https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/trace-log.ts"
click node_ui_app "https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/App.svelte"
click node_ui_apps "https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/routes/Apps.svelte"
click node_ui_server "https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/lib/stores/server.svelte.ts"
click node_ui_api "https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/lib/api/endpoints.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_cli_impl,node_user toneBlue
class node_registry,node_registry_import,node_provider_auth,node_oauth_auth,node_config_store toneAmber
class node_agent_launch,node_agent_claude,node_agent_codex,node_agent_gemini,node_context,node_cloud_backend toneMint
class node_gateway_cli,node_gateway_server,node_gateway_router,node_gateway_models,node_provider_factory,node_sdk_adapter,node_anthropic_proxy,node_zen_gate,node_trace_log toneRose
class node_ui_app,node_ui_apps,node_ui_server,node_ui_api toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/ramananbuilds/anygate/blob/main/src/cli/index.ts): `src/cli/index.ts`
- [CLI handlers](https://github.com/ramananbuilds/anygate/blob/main/src/cli.ts): `src/cli.ts`

### Providers and auth

- [Provider catalog](https://github.com/ramananbuilds/anygate/blob/main/src/registry/provider-catalog.ts): `src/registry/provider-catalog.ts`
- [Provider import](https://github.com/ramananbuilds/anygate/blob/main/src/registry/loader/import-build.ts): `src/registry/loader/import-build.ts`
- [Provider authentication](https://github.com/ramananbuilds/anygate/blob/main/src/registry/provider-auth.ts): `src/registry/provider-auth.ts`
- [OpenCode OAuth](https://github.com/ramananbuilds/anygate/blob/main/src/registry/opencode-auth.ts): `src/registry/opencode-auth.ts`
- [Provider configuration](https://github.com/ramananbuilds/anygate/blob/main/src/storage/config.ts): `src/storage/config.ts`

### Agent launch

- [Shared launch support](https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/launch.ts): `src/apps/shared/launch.ts`
- [Claude integrations](https://github.com/ramananbuilds/anygate/blob/main/src/apps/claude/desktop.ts): `src/apps/claude/desktop.ts`
- [Codex app launch](https://github.com/ramananbuilds/anygate/blob/main/src/apps/codex/app.ts): `src/apps/codex/app.ts`
- [Gemini integrations](https://github.com/ramananbuilds/anygate/blob/main/src/apps/gemini/launch.ts): `src/apps/gemini/launch.ts`
- [Context sizing](https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/context-window.ts): `src/apps/shared/context-window.ts`
- [Cloud Code backend](https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/cloud-code-backend.ts): `src/apps/shared/cloud-code-backend.ts`

### API gateways

- [Gateway setup](https://github.com/ramananbuilds/anygate/blob/main/src/cli/server.ts): `src/cli/server.ts`
- [Gateway server](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/server.ts): `src/gateway/server/server.ts`
- [Request routing](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/router.ts): `src/gateway/server/router.ts`
- [Model catalog](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/server/models.ts): `src/gateway/server/models.ts`
- [SDK provider factory](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/providers/provider-factory.ts): `src/gateway/providers/provider-factory.ts`
- [SDK adapter](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/adapters/sdk-adapter.ts): `src/gateway/adapters/sdk-adapter.ts`
- [Anthropic proxy](https://github.com/ramananbuilds/anygate/blob/main/src/gateway/proxy/anthropic-proxy.ts): `src/gateway/proxy/anthropic-proxy.ts`
- [OpenCode gateway](https://github.com/ramananbuilds/anygate/blob/main/src/providers/opencode-gate.ts): `src/providers/opencode-gate.ts`
- [Request trace log](https://github.com/ramananbuilds/anygate/blob/main/src/apps/shared/trace-log.ts): `src/apps/shared/trace-log.ts`

### Browser interface

- [Visual launcher](https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/App.svelte): `src/ui/app/src/App.svelte`
- [Launch selection](https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/routes/Apps.svelte): `src/ui/app/src/routes/Apps.svelte`
- [Server controls](https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/lib/stores/server.svelte.ts): `src/ui/app/src/lib/stores/server.svelte.ts`
- [UI API client](https://github.com/ramananbuilds/anygate/blob/main/src/ui/app/src/lib/api/endpoints.ts): `src/ui/app/src/lib/api/endpoints.ts`

### Other components

- **User**

## Connections

- User → CLI commands: runs commands
- CLI commands → CLI handlers: dispatches (evidence: `src/cli/index.ts`)
- User → Provider catalog: configures providers
- Provider catalog → Provider configuration: stores configuration
- Provider import → Provider catalog: imports provider data
- Provider authentication → OpenCode OAuth: uses credentials (evidence: `src/registry/provider-auth.ts`)
- User → Shared launch support: selects model
- Shared launch support → Claude integrations: launches Claude
- Shared launch support → Codex app launch: launches Codex
- Shared launch support → Gemini integrations: launches Gemini
- Codex app launch → Context sizing: resolves context (evidence: `src/apps/codex/app.ts`)
- Codex app launch → Cloud Code backend: starts backend (evidence: `src/apps/codex/app.ts`)
- User → Gateway setup: starts gateway
- Gateway setup → Gateway server: starts server (evidence: `src/cli/server.ts`)
- Gateway server → Provider catalog: loads catalog (evidence: `src/gateway/server/server.ts`)
- Gateway server → Model catalog: builds catalog (evidence: `src/gateway/server/server.ts`)
- Gateway server → Request routing: starts routing (evidence: `src/gateway/server/server.ts`)
- Request routing → SDK provider factory: creates model (evidence: `src/gateway/server/router.ts`)
- Request routing → SDK adapter: streams response (evidence: `src/gateway/server/router.ts`)
- Request routing → Anthropic proxy: forwards requests
- SDK provider factory → OpenCode gateway: wraps Zen fetch (evidence: `src/gateway/providers/provider-factory.ts`)
- Request routing → Request trace log: writes traces (evidence: `src/gateway/server/router.ts`)
- User → Visual launcher: opens dashboard
- Visual launcher → Launch selection: shows launch route (evidence: `src/ui/app/src/App.svelte`)
- Launch selection → Shared launch support: requests launch
- Visual launcher → Server controls: tracks server (evidence: `src/ui/app/src/App.svelte`)
- Server controls → UI API client: calls endpoints (evidence: `src/ui/app/src/lib/stores/server.svelte.ts`)
