Skip to content

Repository files navigation

Yunjing (云镜)

Cloud Mirror — a mirror that reflects your data, faithfully.

Open-source, developer-first analytics: a versioned semantic layer that makes dashboards correct by construction, with every dashboard emitted as real React code in your repo — editable via GUI or code, both views of the same source of truth.

Status: MVP. Semantic layer, query compiler, DuckDB/Postgres connectors, widget library, codegen, and a studio with live preview + GUI↔YAML editing.

Quickstart (5 minutes)

Requires Node ≥ 20 and pnpm.

git clone <this repo> && cd yunjing
pnpm install
pnpm build
pnpm --filter @yunjing/studio dev   # → http://localhost:3000

The studio opens on the demo project (a small SaaS: 240 users, ~500 orders seeded into in-memory DuckDB). From there:

  1. Preview — the right pane runs real queries through the semantic layer.
  2. Edit visually — drag a widget by its top bar, resize via the corner handle; watch the YAML on the left update (comments preserved).
  3. Edit as code — change a title or a metric reference in the YAML; the preview re-renders on every valid keystroke. Invalid references get squiggles with line numbers. Save (or Cmd+S) writes to disk.
  4. Add / remove widgets+ Widget inserts a template into the YAML; select a widget and hit Delete to remove it.
  5. Connect your data — the bar above the preview accepts a Postgres URL or a local CSV/Parquet path (exposed as a DuckDB view, no ingestion). "tables" shows the introspected schema to write your semantic layer against.
  6. Export — emits Dashboard.tsx + queries.ts + runtime.tsx into a directory you choose. The generated code imports @yunjing/ui, passes strict tsc and ESLint, and is yours to own.

To sanity-check the whole pipeline without the studio:

node examples/demo/smoke.mjs   # specs → validation → SQL → DuckDB → codegen

The three artifacts

File Role
semantic.yunjing.yaml Models, dimensions, metrics, joins — the trusted definitions (ADR-001)
*.dashboard.yaml Layout + widgets, referencing metrics by name only — never raw SQL (ADR-002)
Generated React Build artifact of the two specs; regenerate any time

GUI edits and code edits both mutate the spec files. See examples/demo/ for a complete example (generate-seed.mjs regenerates the dataset deterministically).

Development

pnpm install
pnpm build && pnpm lint && pnpm test

Layout

Path Purpose
packages/core Semantic layer: schema types, parser, validator
packages/query Compiles metric requests → SQL; executes
packages/connectors Postgres, DuckDB (CSV/Parquet via DuckDB)
packages/codegen Dashboard spec → React components
packages/ui Widget library (charts, tables, KPI cards)
apps/studio GUI editor + code editor + live preview

About

A dashboard tool built to work with AI. Versioned semantic layer, GUI ↔ code editing, exportable React. TypeScript.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages