8000 GitHub - goldmedal/wrenai-wasm-demo · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

wrenai-wasm-demo

A single-file HTML dashboard that queries Canner/WrenAI GitHub activity through @wrenai/wren-core-wasm — DataFusion-in-WASM running directly in the browser over Parquet files. No backend, no server-side database.

Layout

dashboard/         Single-page demo
  index.html       The dashboard itself (Chart.js + wren-core-wasm)
  mdl.json         Pre-compiled MDL (semantic layer)
  data/*.parquet   GitHub events / issues / PRs / stargazers
  test_*.mjs       Node smoke tests for the same queries

wren_project/      Source MDL (models, relationships). Compiles to mdl.json.
github/            dlt verified-source code (do not edit by hand).
github_pipeline.py dlt pipeline that rebuilds wrenai_github.duckdb from
                   the GitHub API.
wrenai_github.duckdb DuckDB file produced by github_pipeline.py.

Start the dashboard

The dashboard fetches mdl.json and data/*.parquet over HTTP, so opening index.html directly with file:// will not work. Serve it with any static HTTP server from the dashboard/ directory:

cd dashboard
python3 -m http.server 8000

Then open http://localhost:8000/index.html.

The first load fetches wren-core-wasm (~14 MB gzipped) from unpkg and may take 10–30 s. Subsequent loads are cached by the browser.

Any static server works — these are all fine alternatives:

npx serve -l 8000 .          # Node
ruby -run -e httpd . -p 8000 # Ruby
caddy file-server --listen :8000

Run the smoke tests (optional)

The test_*.mjs files re-run the dashboard's queries from Node to catch regressions before opening the browser:

cd dashboard
npm init -y >/dev/null && npm install @wrenai/wren-core-wasm@0.4.0
node test_smoke.mjs
node test_union.mjs
node test_drill.mjs
node test_union_matrix.mjs

Refresh the data (optional)

To rebuild wrenai_github.duckdb and the parquet files from the live GitHub API:

pip install "dlt[duckdb]>=0.5.1"

# .dlt/secrets.toml — NOT committed; create it yourself:
#   [sources.github]
#   access_token = "ghp_..."

python github_pipeline.py

Then export the DuckDB tables to dashboard/data/*.parquet so the dashboard picks them up.

Notes

  • The dashboard pins @wrenai/wren-core-wasm@0.4.0. That version crashes on UNION ALL, so the dashboard merges union results in JS — see the comments in index.html.
  • Model names are case-sensitive; quote them in raw SQL (SELECT * FROM "issues").
  • wren_project/target/ is gitignored. Run wren context build inside wren_project/ to regenerate target/mdl.json (the dashboard ships with its own copy at dashboard/mdl.json).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0