How darwintjoe/dbhub works
DBHub is a standalone LAN sync hub: devices submit ledger bundles, which the hub validates and records in a verified local chain, then exposes through device pull/manifest APIs and a read-only admin dashboard. The product also covers device pairing and management, quarantine and maintenance, monitoring, backups, configuration, and optional connectivity/replica modes. Edges are limited to relationships visible in excerpts, the SOURCE INDEX, or README; several route and integration details are unsampled, so those links are omitted.
Main entry points: ingest.ts Bundle Ingest · server.ts Service Runtime · admin-extra.ts Admin API Routes · app.ts HTTP Application
Components 30
Device Sync
- Devices
src/http/routes/devices.ts - Pairing
src/http/routes/pairings.ts - Bundle Ingest
src/services/ingest.ts - Sync Routes
src/http/routes/relay.ts - Pull & Manifest
src/http/routes/pull.ts - Chain Verification
src/domain/chain.ts - Canonical Hashing
src/domain/hashing.ts - Bundle Validation
src/domain/validation.ts
Local State
- SQLite Database
src/db/database.ts - Device Records
src/db/devices.repo.ts - Bundle Records
src/db/bundles.repo.ts - Manifest Records
src/db/manifests.repo.ts - Replica Outbox
src/db/outbox.repo.ts - Replica Targets
src/services/replica
Admin Experience
- Admin Dashboard
public/admin/app.js - Admin API Routes
src/http/routes/admin-extra.ts - Admin Sessions
src/http/admin-session.ts - Config Management
src/services/config-service.ts
Operations
- Host Monitoring
src/services/metrics/sampler.ts - Hub Overview
src/services/overview.ts - Maintenance
src/services/maintenance.ts - Backups
src/services/backup.ts - Connectivity
src/http/routes/connectivity.ts - Cloudflare Tunnel
src/services/cloudflare-tunnel.ts - mDNS Discovery
src/services/mdns.ts
Runtime
- Runtime Config
src/config.ts - HTTP Application
src/app.ts - Service Runtime
src/server.ts
Other components
- Sync Devices
- Administrator
Connections 32
- Sync Devices → HTTP Application: submits sync
README.md - HTTP Application → Pairing: routes claims
src/app.ts - HTTP Application → Sync Routes: routes relay
src/app.ts - HTTP Application → Pull & Manifest: routes pull
src/app.ts - Sync Routes → Bundle Ingest: invokes ingest
src/app.ts - Bundle Ingest → Bundle Validation: validates bundles
src/services/ingest.ts - Bundle Ingest → Canonical Hashing: computes hashes
src/services/ingest.ts - Bundle Ingest → Chain Verification: checks continuity
src/services/ingest.ts - Bundle Ingest → Bundle Records: stores bundles
src/services/ingest.ts - Bundle Ingest → Device Records: reads device state
src/services/ingest.ts - Bundle Ingest → Manifest Records: uses manifests
src/services/ingest.ts - Bundle Ingest → Replica Outbox: queues replicas
src/services/ingest.ts - Pull & Manifest → Bundle Records: reads bundles
src/app.ts - Service Runtime → SQLite Database: opens database
src/server.ts - Service Runtime → Device Records: creates repository
src/server.ts - Service Runtime → Bundle Records: creates repository
src/server.ts - Service Runtime → Manifest Records: creates repository
src/server.ts - Service Runtime → Replica Outbox: creates repository
src/server.ts - Service Runtime → HTTP Application: starts application
src/server.ts - Service Runtime → Runtime Config: loads settings
src/server.ts - Administrator → Admin Dashboard: uses dashboard
README.md - Admin Dashboard → Admin API Routes: requests overview
- HTTP Application → Admin Sessions: guards admin routes
src/app.ts - Admin API Routes → Config Management: uses config service
src/http/routes/admin-extra.ts - Admin API Routes → Host Monitoring: reads samples
src/http/routes/admin-extra.ts - Admin API Routes → Hub Overview: reads overview
src/http/routes/admin-extra.ts - Admin API Routes → Backups: uses backup service
src/http/routes/admin-extra.ts - Admin API Routes → Maintenance: routes maintenance
- Runtime Config → Connectivity: configures mode
- Runtime Config → Replica Targets: selects target
src/config.ts - Connectivity → Cloudflare Tunnel: optionally starts
- Connectivity → mDNS Discovery: optionally advertises