# noamroger/burrow architecture

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

- Interactive diagram: https://gitdiagram.com/noamroger/burrow
- Repository: https://github.com/noamroger/burrow

## Overview

Burrow is a web application for publishing homelab services through Cloudflare Tunnel. An administrator opens the UI, configures Cloudflare and a host, then the server reconciles tunnel ingress and DNS; visitors reach the service through Cloudflare, while Burrow supervises connectors and checks health. The graph includes documented monitoring, access control, backups, drift, and operational features. Some service internals are unsampled, so those relationships are shown only where the README or excerpts support them.

Main entry points: [`apps/server/src/app.ts`](https://github.com/noamroger/burrow/blob/main/apps/server/src/app.ts) (HTTP application), [`apps/server/src/http/session.ts`](https://github.com/noamroger/burrow/blob/main/apps/server/src/http/session.ts) (Session security), [`apps/server/src/routes/hosts.ts`](https://github.com/noamroger/burrow/blob/main/apps/server/src/routes/hosts.ts) (Host and tunnel routes), [`apps/server/src/services/cloudflare.ts`](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/cloudflare.ts) (Cloudflare management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web console"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_hostui["Host management UI<br/>[HostsPage.tsx]"]
  node_api_client["Typed API client<br/>[client.ts]"]
end

subgraph group_api["API and identity"]
  node_server["HTTP application<br/>[app.ts]"]
  node_sessions["Session security<br/>[session.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_twofactor["Two-factor and passkeys<br/>[two-factor.ts]"]
  node_tokens["API tokens<br/>[api-tokens.ts]"]
end

subgraph group_publishing["Host publishing"]
  node_host_routes["Host and tunnel routes<br/>[hosts.ts]"]
  node_reconciler["Route reconciliation<br/>[reconciler.ts]"]
  node_cloudflare["Cloudflare management<br/>[cloudflare.ts]"]
  node_cf_api["Cloudflare API<br/>[client.ts]"]
  node_connector["Connector supervision<br/>[supervisors.ts]"]
  node_docker["Docker discovery<br/>[discovery.ts]"]
end

subgraph group_operations["Operations"]
  node_monitoring["Uptime monitoring<br/>[monitoring.ts]"]
  node_drift["Drift detection<br/>[drift.ts]"]
  node_audit["Audit and undo<br/>[audit.ts]"]
  node_maintenance["Maintenance mode<br/>[maintenance.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
  node_backups["Scheduled backups<br/>[service.ts]"]
end

subgraph group_storage["State and integrations"]
  node_db[("SQLite database<br/>[client.ts]")]
  node_schema["Persistent schema<br/>[schema.ts]"]
end

node_admin(("Administrator"))
node_visitor(("Service visitor"))
node_cloudflare_service{{"Cloudflare Tunnel"}}

node_admin -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_hostui
node_hostui -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_server
node_server -->|"registers"| node_host_routes
node_server -->|"registers"| node_sessions
node_sessions -->|"validates sessions"| node_auth
node_sessions -->|"uses"| node_twofactor
node_host_routes -.->|"requests changes"| node_reconciler
node_reconciler -->|"reconciles routes"| node_cloudflare
node_cloudflare -->|"calls"| node_cf_api
node_cf_api -->|"manages tunnel and DNS"| node_cloudflare_service
node_cloudflare_service -->|"routes traffic"| node_visitor
node_connector -->|"maintains connection"| node_cloudflare_service
node_docker -->|"publishes labeled hosts"| node_host_routes
node_monitoring -->|"reports outages"| node_notifications
node_drift -->|"reports drift"| node_notifications
node_audit -->|"records activity"| node_db
node_backups -->|"snapshots"| node_db
node_db -->|"uses schema"| node_schema
node_server -.->|"serves monitoring"| node_monitoring
node_server -.->|"serves drift controls"| node_drift
node_server -.->|"serves backup controls"| node_backups
node_server -.->|"serves token controls"| node_tokens
node_maintenance -.->|"changes host behavior"| node_cloudflare

click node_webapp "https://github.com/noamroger/burrow/blob/main/apps/web/src/App.tsx"
click node_hostui "https://github.com/noamroger/burrow/blob/main/apps/web/src/pages/HostsPage.tsx"
click node_api_client "https://github.com/noamroger/burrow/blob/main/apps/web/src/api/client.ts"
click node_server "https://github.com/noamroger/burrow/blob/main/apps/server/src/app.ts"
click node_sessions "https://github.com/noamroger/burrow/blob/main/apps/server/src/http/session.ts"
click node_auth "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/auth.ts"
click node_twofactor "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/two-factor.ts"
click node_tokens "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/api-tokens.ts"
click node_host_routes "https://github.com/noamroger/burrow/blob/main/apps/server/src/routes/hosts.ts"
click node_reconciler "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/reconciler.ts"
click node_cloudflare "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/cloudflare.ts"
click node_cf_api "https://github.com/noamroger/burrow/blob/main/apps/server/src/cloudflare/client.ts"
click node_connector "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/supervisors.ts"
click node_docker "https://github.com/noamroger/burrow/blob/main/apps/server/src/docker/discovery.ts"
click node_monitoring "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/monitoring.ts"
click node_drift "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/drift.ts"
click node_audit "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/audit.ts"
click node_maintenance "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/maintenance.ts"
click node_notifications "https://github.com/noamroger/burrow/blob/main/apps/server/src/services/notifications.ts"
click node_backups "https://github.com/noamroger/burrow/blob/main/apps/server/src/backup/service.ts"
click node_db "https://github.com/noamroger/burrow/blob/main/apps/server/src/db/client.ts"
click node_schema "https://github.com/noamroger/burrow/blob/main/apps/server/src/db/schema.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_webapp,node_hostui,node_api_client toneBlue
class node_server,node_sessions,node_auth,node_twofactor,node_tokens toneAmber
class node_host_routes,node_reconciler,node_cloudflare,node_cf_api,node_connector,node_docker toneMint
class node_monitoring,node_drift,node_audit,node_maintenance,node_notifications,node_backups toneRose
class node_db,node_schema,node_admin,node_visitor,node_cloudflare_service toneIndigo
```

## Components

### Web console

- [Web application](https://github.com/noamroger/burrow/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Host management UI](https://github.com/noamroger/burrow/blob/main/apps/web/src/pages/HostsPage.tsx): `apps/web/src/pages/HostsPage.tsx`
- [Typed API client](https://github.com/noamroger/burrow/blob/main/apps/web/src/api/client.ts): `apps/web/src/api/client.ts`

### API and identity

- [HTTP application](https://github.com/noamroger/burrow/blob/main/apps/server/src/app.ts): `apps/server/src/app.ts`
- [Session security](https://github.com/noamroger/burrow/blob/main/apps/server/src/http/session.ts): `apps/server/src/http/session.ts`
- [Authentication](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/auth.ts): `apps/server/src/services/auth.ts`
- [Two-factor and passkeys](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/two-factor.ts): `apps/server/src/services/two-factor.ts`
- [API tokens](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/api-tokens.ts): `apps/server/src/services/api-tokens.ts`

### Host publishing

- [Host and tunnel routes](https://github.com/noamroger/burrow/blob/main/apps/server/src/routes/hosts.ts): `apps/server/src/routes/hosts.ts`
- [Route reconciliation](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/reconciler.ts): `apps/server/src/services/reconciler.ts`
- [Cloudflare management](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/cloudflare.ts): `apps/server/src/services/cloudflare.ts`
- [Cloudflare API](https://github.com/noamroger/burrow/blob/main/apps/server/src/cloudflare/client.ts): `apps/server/src/cloudflare/client.ts`
- [Connector supervision](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/supervisors.ts): `apps/server/src/services/supervisors.ts`
- [Docker discovery](https://github.com/noamroger/burrow/blob/main/apps/server/src/docker/discovery.ts): `apps/server/src/docker/discovery.ts`

### Operations

- [Uptime monitoring](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/monitoring.ts): `apps/server/src/services/monitoring.ts`
- [Drift detection](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/drift.ts): `apps/server/src/services/drift.ts`
- [Audit and undo](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/audit.ts): `apps/server/src/services/audit.ts`
- [Maintenance mode](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/maintenance.ts): `apps/server/src/services/maintenance.ts`
- [Notifications](https://github.com/noamroger/burrow/blob/main/apps/server/src/services/notifications.ts): `apps/server/src/services/notifications.ts`
- [Scheduled backups](https://github.com/noamroger/burrow/blob/main/apps/server/src/backup/service.ts): `apps/server/src/backup/service.ts`

### State and integrations

- [SQLite database](https://github.com/noamroger/burrow/blob/main/apps/server/src/db/client.ts): `apps/server/src/db/client.ts`
- [Persistent schema](https://github.com/noamroger/burrow/blob/main/apps/server/src/db/schema.ts): `apps/server/src/db/schema.ts`

### Other components

- **Administrator**
- **Service visitor**
- **Cloudflare Tunnel**

## Connections

- Administrator → Web application: uses (evidence: `README.md`)
- Web application → Host management UI: routes to (evidence: `apps/web/src/App.tsx`)
- Host management UI → Typed API client: requests data (evidence: `apps/web/src/pages/HostsPage.tsx`)
- Typed API client → HTTP application: calls API (evidence: `apps/web/src/api/client.ts`)
- HTTP application → Host and tunnel routes: registers (evidence: `apps/server/src/app.ts`)
- HTTP application → Session security: registers (evidence: `apps/server/src/app.ts`)
- Session security → Authentication: validates sessions (evidence: `apps/server/src/http/session.ts`)
- Session security → Two-factor and passkeys: uses (evidence: `apps/server/src/http/session.ts`)
- Host and tunnel routes → Route reconciliation: requests changes
- Route reconciliation → Cloudflare management: reconciles routes (evidence: `README.md`)
- Cloudflare management → Cloudflare API: calls (evidence: `apps/server/src/cloudflare/client.ts`)
- Cloudflare API → Cloudflare Tunnel: manages tunnel and DNS (evidence: `README.md`)
- Cloudflare Tunnel → Service visitor: routes traffic (evidence: `README.md`)
- Connector supervision → Cloudflare Tunnel: maintains connection (evidence: `README.md`)
- Docker discovery → Host and tunnel routes: publishes labeled hosts (evidence: `README.md`)
- Uptime monitoring → Notifications: reports outages (evidence: `apps/server/src/context.ts`)
- Drift detection → Notifications: reports drift (evidence: `apps/server/src/context.ts`)
- Audit and undo → SQLite database: records activity (evidence: `apps/server/src/services/audit.ts`)
- Scheduled backups → SQLite database: snapshots (evidence: `apps/server/src/backup/service.ts`)
- SQLite database → Persistent schema: uses schema (evidence: `apps/server/src/db/client.ts`)
- HTTP application → Uptime monitoring: serves monitoring
- HTTP application → Drift detection: serves drift controls
- HTTP application → Scheduled backups: serves backup controls
- HTTP application → API tokens: serves token controls
- Maintenance mode → Cloudflare management: changes host behavior
