Architecture Uncloud follows a hybrid intent/runtime architecture where SQLite stores what the user requested (intent) and Kubernetes holds the actual running state (runtime truth). A sync loop reconciles the two every 15 seconds.

System Overview

Core Design Principles

Hybrid DB/K8s Model

Intent Layer

SQLite stores what the user requested — resource names, configs, and relationships.

Runtime Layer

Kubernetes holds what’s actually running — IPs, pod phases, and ready replicas.

Sync Layer

Go goroutine reconciles every 15 seconds between intent and runtime.
This design means:
  • The API is fast — reads from SQLite, not the K8s API
  • Kubernetes is the source of truth for running state
  • If K8s is temporarily unreachable, the API still serves data
  • New resources are created in SQLite first, then provisioned to K8s

Resource Lifecycle

Tech Stack

Backend

ComponentTechnology
LanguageGo 1.21
HTTP RouterChi v5
DatabaseSQLite (modernc.org)
K8s Clientclient-go v0.28
VM EngineKubeVirt
StorageRook/Ceph
NetworkingCilium
DB OperatorCloudNativePG
MetricsPrometheus

Frontend

ComponentTechnology
FrameworkReact 19 + TypeScript
Build ToolVite 7
StylingTailwind CSS
Componentsshadcn/ui + Radix
ChartsRecharts
RoutingReact Router v7

Backend Architecture

Layer Structure

DirectoryPurpose
cmd/api/Entrypoint
internal/api/HTTP handlers + router
internal/services/Business logic
internal/repository/SQLite data access
internal/k8s/Kubernetes operations
internal/sync/DB/K8s reconciliation
internal/domain/Domain models
internal/provisioner/Infra installers

Domain Models

Resources use prefixed IDs for clarity:
ResourcePrefixExample
Projectproj_proj_default
Dropletdpl_dpl_a1b2c3d4
Volumevol_vol_e5f6g7h8
Appapp_app_i9j0k1l2
Databasedb_db_m3n4o5p6
SSH Keysk_sk_q7r8s9t0

Multi-Tenancy

Projects are the isolation boundary. Each project maps to a Kubernetes namespace. All resources are scoped to a project via project_id.

Project: production

  • Droplet web-server
  • App api-service
  • Database main-pg
  • Volume data-vol
Maps to K8s namespace production

Project: staging

  • Droplet test-vm
  • App api-staging
  • Database staging-pg
Maps to K8s namespace staging

Kubernetes Integration

Resource Mapping

UncloudKubernetes
Droplet (VM)KubeVirt VirtualMachine
VolumePersistentVolumeClaim
AppDeployment + Service + Ingress
DatabaseStatefulSet or operator CR
ProjectNamespace
FirewallCilium NetworkPolicy
QuotaResourceQuota

Provisioner System

Infrastructure components installed via admin setup:
ComponentWhat It Does
K3sLightweight Kubernetes
KubeVirtVM management via CRDs
Storage ClassPV provisioner (Ceph/Longhorn)
Metrics ServerCPU and memory metrics
PrometheusMonitoring and alerting
CloudNativePGPostgreSQL operator
RegistryPrivate image storage
CoreDNSDNS resolution
Object StorageS3-compatible buckets