Skip to main content
HydroGo
IntroductionArchitecture

Architecture

How the binary, the admin panel, the API and the storage layers fit together, and why publishing never needs a rebuild.

HydroGo Single-Binary Architecturecmd/hydro → internal/* + modules/*
Admin UI
Embedded Svelte 5 SPA
Compiled via //go:embed into /admin
HTTP & Realtime
Stdlib Router + SSE Bus
REST /api/v1, OpenAPI, ETag, Rate Limit
AI Control Plane
Native MCP Server
hydro mcp stdio for Cursor & Claude
↓
Core Engine, Collections & Domain ModulesSingleflight • Transactional Outbox • SHA-256 Audit
collections (YAML)pagesnewsmemberscommercemediaauth/RLS
↓
SQLite WAL
Zero-dep default
PostgreSQL
Forced RLS multi-tenant
MySQL / MariaDB
Full dialect parity
Redis (Optional)
Cluster SSE pub/sub

One binary, three surfaces

hydro serve starts a single HTTP server that exposes three things:

  • /api/v1 the REST API your frontends call. JSON only, every response uses the same envelope.
  • /admin the embedded admin panel (a Svelte 5 SPA compiled into the binary).
  • /media, /sitemap.xml, /healthz, /readyz and /metrics for media delivery, SEO helpers and operational probes.

Modules and shared core

Content and commerce features live in modules under modules/ (pages, news, members, site, seo, commerce). Cross-cutting capabilities live in internal/ (auth, database, media, search, security, jobs, webhooks, caching). Which modules run is configured with the modules list in config.yaml; an inactive module adds no routes, migrations, workers or admin navigation entries.

LayerResponsibility
Transport (transport/http.go)Decode requests, call a service, write the JSON envelope. No SQL, no HTML.
ServiceBusiness rules: validation, publishing, revisions, permissions.
Repository (repository/sqlstore)All SQL and dialect differences for SQLite, PostgreSQL and MySQL.
Content types (YAML)Declarative collections: storage, validation, admin screens and public API are derived from the schema.
Commerce module (modules/commerce)Cart, stock reservation, checkout and orders, with provider interfaces for payment gateways, shipping and invoicing.

Core and optional extensions

HydroGo is licensed under the PolyForm Shield License 1.0.0. It is a core plus optional add-ons.

  • HydroGo Core: The standalone, PolyForm Shield licensed engine containing the complete CMS, embedded Svelte 5 admin studio, YAML content engine, and commerce core.
  • Add-on modules: Optional commercial extensions (payment gateways, shipping carriers, e-invoicing) distributed separately and applied at build time. Core works without them.
  • Hydro Cloud (coming soon): Managed multi-tenant hosting. It is not available yet.

Zero build on publish

Zero-Build Publish FlowSub-10ms live propagation
STEP 01
Editor Publishes
Save or Publish in /admin Svelte 5 Studio
STEP 02
Single Transaction
Content + Outbox event + SHA-256 audit row
STEP 03
Cache & SSE Bus
ETag invalidated; SSE subscribers notified
STEP 04
Live Everywhere
Frontends read /api/v1 with zero SSG rebuild

The public API reads straight from the database. When an editor publishes, retracts or edits a page, a news article or a content record, the next request already returns the new state. This is a hard rule of the project: content changes never require a frontend rebuild, a static pre-rendering pipeline or a CI/CD redeploy.

For frontends this means server-side rendering (or client-side fetching) against the API, optionally behind a short cache you control. If you do choose a static frontend, use webhooks to trigger a rebuild; that is your choice, not a requirement of HydroGo.

Databases and optional services

ComponentDefaultAlternatives
DatabaseSQLite file (data/hydro.db)PostgreSQL, MySQL / MariaDB
Media storageLocal directory (data/media)S3-compatible bucket, optional CDN base URL
Rate limits and cachesIn processRedis or Valkey, shared by several instances
ErrorsLogsSentry / GlitchTip via observability.sentry_dsn
Design decisions are recorded as short ADRs in the repository's docs/decisions/ folder: CMS focus, content types, the Svelte admin SPA and the template distribution model.