Suggested GitHub repository description: Interactive visual explorer for understanding how Twilic transforms and encodes structured data.
Browser explorer built with Vite, React, and Cloudflare Kumo. Explore how Twilic transforms structured data into compact binary representations.
Size tables and schema-first codec comparisons live in the playground — this app is the visual pipeline explorer only.
The workspace is:
- Full-bleed 3D — encoding pipeline fills the viewport (no card chrome); byte cubes are colored by transform stage.
- Inspect panel — right-side tabs for Input / Steps / Bytes (demo fixtures, mode, step detail, hex inspector).
Encoding steps:
- Input JSON — paste or pick a demo fixture
- Dynamic profile — Dynamic, Batch,
SCHEMA_BATCH, orBOUND_STREAM - Shape detection — homogeneous map-array candidates
- Shape tree — field keys registered as
shape_def - String interning — literals vs string table references
- Batch / typed vector — ROW vs COLUMN layout and approximate column codecs
- Binary — final bytes with a highlighted hex inspector
Click any 3D node or step to drill down. Byte ranges for the selected step are highlighted in the inspector.
Encoding uses @twilic/core/advanced (WASM). Intermediate stage tables are reconstructed from the wire format and input JSON; exact Rust codec-explain APIs are not exposed by the SDK yet — batch codec labels are marked approximate.
This project always depends on a local sibling twilic-js checkout via file:../twilic-js (not the published npm package), so the explorer tracks your latest TypeScript and WASM build.
- Demo fixtures — repeated strings, single user shape, small role batch, and schema-example.json style
UserRecordV1records (×3). - Custom JSON — paste or edit a root object
{…}, array[…], or JSONL; the pipeline rebuilds when the payload is valid. - Encoding modes — Dynamic, Batch,
SCHEMA_BATCH, andBOUND_STREAMvia segmented controls. - Bound schema — Schema and Bound modes use an editable JSON schema. Demos infer a matching schema; scalar arrays are wrapped as a single
valuefield. You can also pasteschema-example.jsonfield names (type,enum,range). - Step inspector — expandable step list with inline detail (shapes, string table, batch heuristics, hex preview).
- Bytes view — stage-highlighted hex cells plus a full hex dump with ASCII.
- 3D pipeline — Three.js byte field; hover shows offset/label, click selects the owning stage.
- WASM runtime — encoding runs in the browser via
@twilic/core/advancedwithinit({ prefer: 'wasm' }); Node N-API is not bundled.
| Layer | Choice |
|---|---|
| UI | @cloudflare/kumo + Tailwind CSS v4 |
| App | React 19, TypeScript, Vite 8 (Rolldown), Three.js |
| Encoding | Local twilic-js (WASM) |
- Node.js ≥ 24
- pnpm 10.18.1 (see
packageManagerinpackage.json) - Cloned next to
twilic-js:
your-workspace/
twilic-js/ # https://github.com/twilic/twilic-js
twilic-rust/ # required when building twilic-js (bridge path dependency)
explorer/ # this repo
Build WASM and TypeScript in twilic-js before running the explorer:
cd ../twilic-js
pnpm install
pnpm build:wasm
pnpm build:tsFor a full twilic-js setup from a clean tree, follow that repository’s README (Rust, wasm-pack).
cd explorer
pnpm install
pnpm sync-wasm # mirrors ../twilic-js/wasm/pkg → wasm/pkg (also runs before dev/build)
pnpm dev # http://localhost:5173
pnpm build # production build (bundled WASM in dist/assets/)
pnpm preview # preview the production build locally
pnpm test # Vitest
pnpm lint # ESLint
pnpm format # PrettierProject sites are served from https://<user>.github.io/<repo>/. Vite’s base is set when GITHUB_PAGES=true at build time (see vite.config.ts). Production JS and WASM chunks use hashed names under dist/assets/ and honor that base path.
- In the repository Settings → Pages, set Source to GitHub Actions.
- Push to
main, or run Actions → Deploy GitHub Pages manually.
The workflow (.github/workflows/github-pages.yml) checks out this repo, clones twilic/twilic-js and twilic/twilic-rust beside the workspace (same layout as twilic-js CI), builds WASM + TypeScript there, then installs and builds this app. Deployed Pages therefore track the latest twilic-js default branch, not the npm registry.
- Intermediate stage tables are reconstructed from the wire format and input JSON; the SDK does not yet expose exact Rust codec-explain APIs.
- Batch / column codec labels in the step detail are approximate (public heuristics from the Twilic spec) and marked as such in the UI.
- Size tables and cross-codec comparisons are intentionally out of scope here — use the playground.
scripts/sync-twilic-wasm.mjs(viapnpm sync-wasm,predev,prebuild, and a matching VitebuildStarthook) copies../twilic-js/wasm/pkgintowasm/pkg/(gitignored) so wasm imports resolve inside this workspace.vite.config.tssetsassetsIncludefor*.wasmso Rolldown can bundle wasm-pack’simport '*.wasm'. Without bundling, serving raw bindings from/publicoften breaks underpnpm preview(MIME / module errors in Chromium).build.rolldownOptions.output.codeSplittingsplits vendor chunks (React, Kumo, Three.js, Twilic) to keep the main bundle under Vite’s size warning threshold.src/shims/substitutes browser-safe backends so the client bundle excludes Node-only N-API loaders and.nodebinaries.- WASM loads via
twilic_wasm_bg.wasm?url+ manualinstantiateStreamingwith{ './twilic_wasm_bg.js': glue }(nottwilic_wasm.jsor bare?init): Rolldown/?initomit wasm-bindgen JS imports and break initialization. - The 3D view is code-split (
React.lazy) so the Inspect panel can load before Three.js finishes downloading.
This project is licensed under the MIT License - see the LICENSE file for details.