Skip to content

Platform design: self-hosted Cube Cloud on Cube Core ​

Status: accepted · Date: 2026-12-02 · Background: Cloud vs Core research

CubeBI rebuilds Cube Cloud's product layer as services around an unmodified Cube Core. It runs entirely on the customer's host. The only outbound connection is the optional Claude API used by the AI features.

Decisions ​

#DecisionChoiceConsequence
D1Deployment targetDocker Compose on one hostOne docker-compose.yml, images pinned by digest, releases shipped as an offline bundle. No Kubernetes work for now.
D2TenancyOne organisation per installNo tenant IDs in content tables and one Cube app ID. Data security comes only from groups and user attributes.
D3IdentityKeycloakLocal users, groups, attributes and MFA, with optional LDAP/AD federation later. The platform turns Keycloak identities into per-user Cube JWTs.
D4AIClaude API (Messages API), agent loop hosted by usOnly model calls leave the host. Tools, queries, chat history and data access all stay local. The product works fully with AI turned off.
D5EngineCube Core, unmodifiedCustomisation only through cube.js hooks and the model. Cube upgrades are image bumps.

What "offline" means here ​

  • No outbound traffic except api.anthropic.com, and only when AI is enabled. No telemetry, CDNs, external fonts, map tiles or SaaS connectors.
  • AI off = fully functional BI. Explore, dashboards, deliveries and alerts never depend on the model.
  • Supply chain: images come from a mirror registry and are pinned by digest. npm and Python dependencies are baked into images at build time, and Cube image signatures are verified.

Architecture ​

                         ┌──────────── cubebi-web (React UI) ─────────────┐
 users ──► cubebi-proxy ─┤ Explore · Workbooks · Dashboards · Chat · Admin │
           (TLS)         └──────────────────────┬─────────────────────────┘
                                                ▼
 cubebi-keycloak ◄──── OIDC ────────── cubebi-platform (control plane, BFF)
                                        sessions, users/groups/attributes,
                                        reports, dashboards, folders, ACLs,
                                        audit log, mints per-user Cube JWTs
          ┌──────────────────┬──────────────────┼────────────────────┬──────────────────┐
          ▼                  ▼                  ▼                    ▼                  ▼
   cubebi-cube         cubebi-agent        cubebi-worker        cubebi-renderer    cubebi-gitea
   cubebi-cube-refresh Claude API          job queue: deliveries, headless Chromium model repo +
   cubebi-cubestore    (only egress) +     alerts, agent tasks,   PNG / PDF          branches
                       Cube tools          pre-agg jobs → SMTP
                                                │
                     cubebi-db (Postgres: warehouse sample, platform, keycloak, query log)
ServiceReplaces this Cloud featureNotes
cubebi-cube + cubebi-cube-refresh + cubebi-cubestoreManaged semantic layerAPI and refresh worker are separate containers. Hooks: checkAuth, checkSqlAuth, contextToGroups, queryRewrite, logger.
cubebi-platformUsers, roles, content, sharing, audit, settingsBackend-for-frontend. The browser never holds a Cube token. Reports are the central object (dashboard tiles, deliveries and alerts reference them). Folder permissions are view/edit/full; the closest folder wins, capped by role.
cubebi-keycloakSSO, SCIMRealm cubebi; groups and attributes come through token mappers.
cubebi-webCloud UIDashboards use Cloud's published file format (grid of widgets, controls, cross-filters).
cubebi-agentAnalytics Chat, Dashboard Agent, rules, certified queries, skills, evals, MCPSee AI design.
cubebi-workerDeliveries, alerts, scheduled tasks, warm-upPostgres-backed queue. Uses Cube's Orchestration API. Alert rules follow Cloud's documented semantics.
cubebi-rendererPNG/PDF downloads and exportsHeadless Chromium on the web app's print routes.
cubebi-giteaData model IDE, dev branchesrepositoryFactory + schemaVersion, one compiled model per branch.

Identity and data security ​

  1. Users sign in through Keycloak (OIDC authorization code + PKCE). cubebi-platform keeps the session in an HTTP-only cookie.
  2. For every Cube call, the platform mints a short-lived JWT: { sub, cubeCloud: { groups: [...], userAttributes: {...} } }.
  3. Cube's contextToGroups reads the groups, and access policies in the model enforce row- and member-level security for every user, including the AI agent, deliveries and alerts, which run as the owner.
  4. Content permissions (who can open a dashboard) are separate from data permissions (what rows they see). Sharing content never widens data access.

AI design ​

  • Agent loop: hosted in cubebi-agent with the Anthropic TypeScript SDK, using the Messages API tool runner.
    • Why not Managed Agents: it would host the loop, a sandbox and the session history at Anthropic. Keeping the loop local means only model requests cross the boundary.
  • Model: claude-opus-5-5.
    • Adaptive thinking, streaming, and explicit effort per route: medium for chat, higher for analysis.
    • Server-side refusal fallbacks are enabled.
    • Whether to use a cheaper model for small tasks (titles, suggested questions, date parsing) is a cost decision for later, made with measurements.
  • Tools (strict schemas). Every tool runs with the end user's Cube JWT:
    • list_views: from /v1/meta, including descriptions and meta.ai_context.
    • query: Semantic SQL via /v1/cubesql, or a Cube JSON query. Results are capped (row limit, aggregated by default).
    • to_chart: /v1/convert-query, turning agent SQL into an editable chart.
    • save_report, and later folder, schedule and dashboard-state tools.
  • Grounding:
    • agents/ folder in the repo, same layout as Cube Cloud: config.yml, rules/, certified_queries/, skills/.
    • Rule conditions use the same groups and attributes as access policies. Conditions only select which prompts are sent; they are not security.
  • Cost and latency:
    • The tool list, system prompt and model catalog form a stable, cached prefix (prompt caching).
    • Long chats use compaction.
  • Protocol: streaming NDJSON in the shape of Cube's Chat API, so a client written for one can be pointed at the other.
  • Quality: an eval set (exact-match grader plus a Claude judge, following Cube's documented method) runs in CI before any prompt or model change ships.
  • Data leaving the host: the user's question, the model catalog (names and descriptions) and the query results the agent reads. Never credentials, never more rows than the cap. Every LLM call is written to the audit log with user, tokens and cost. A single switch (AI_ENABLED=false) turns all of it off.

Phases ​

PhaseScopeDone when
0 FoundationsSeparate refresh worker; telemetry off everywhere; SQL API (18454) with checkSqlAuth; contextToGroups; proxy the unused Core endpoints (cubesql, convert-query, sql-filters, running-query); query log from Cube eventsStack runs with no outbound traffic; SQL API works with a per-user check; every query lands in query_log
1 Platform + KeycloakLogin, users/groups/attributes, per-user JWTs, reports, folders, permissions, auditA user in group X sees only X's rows in every surface
2 Dashboards v2Cloud dashboard format, grid builder, controls + URL state, cross-filtering, drill-through, versionsA dashboard round-trips as a file in Git
3 AgentChat with the tools above, agents/ config, evals; then the Dashboard AgentEval pass rate meets the agreed bar; works with AI off
4 Worker + rendererDeliveries, alerts, PNG/PDF export, scheduled agent tasksAn alert fires exactly once when its condition starts to hold
5 Ops + modelingQuery history UI, pre-aggregation console, Gitea branches, data-lake integrations—
6 PackagingOffline release bundle, upgrade runbook, backup/restoreFresh install from the bundle on a host with no internet