[Hugo] Phase 1 · Decision + spike: how to render the Sistent docs (live React demos)
Parent: #8297 · Phase 1 (Foundation)
Why
/projects/sistent/* is 153 live URLs: 138 collection docs plus getting-started and identity pages in src/pages. These pages demonstrate a React component library. 133 of the 138 docs import @sistent/sistent, with 300+ different demo components (BasicModalDemo, SortableTableDemo, …), and 124 produce converter warnings. Shortcodes cannot reproduce a live MUI component. This is the one area where a plain Hugo port would lose functionality.
Options
| Approach | Cost | Risk | |
|---|---|---|---|
| A | React islands via Hugo js.Build (esbuild). Markdown and prose go through Hugo; each demo mounts into <div data-sistent-demo="BasicModalDemo"> from one bundled entry per page. |
M–L | Bundle size, but it's limited to Sistent pages |
| B | Keep Sistent docs in a small separate React/Vite app published under /projects/sistent/ |
M | Two build systems, two navigation implementations |
| C | Static screenshots + code samples | S | Loses live demos. Not acceptable for a component library's docs |
Spike (recommended before deciding)
- [ ] Port one component (e.g.
modal:index+code+guidance) with option A. Measure:- JS bytes per page (gzip)
- Hugo build time impact (esbuild runs inside Hugo)
- light/dark theme sync between the site toggle and
SistentThemeProvider
- [ ] Check that
npm ciinsidehugo/for@sistent/sistent,reactand@mui/materialdoesn't bring back Gatsby-sized install times. - [ ] Post findings and a recommendation in this issue.
Acceptance criteria
- [ ] A decision recorded in the epic. P4-08 is updated with the chosen approach.
Contributor Resources and Handbook
The layer5.io website uses Gatsby, React, and GitHub Pages. Site content is found under the master branch.
- 📚 See contributing instructions.
- 🎨 Wireframes and designs for Layer5 site in Figma (open invite)
- 🙋🏾🙋🏼 Questions: Discussion Forum and Community Slack.
Join the Layer5 Community by submitting your community member form.
Hi @saurabhraghuvanshii , I would like to work on this issue. Could you please assign it to me?
i can work on this.
Option A is better according to me. built a prototype and ran locally. attaching Recordings here.
these are the findings -
-
Live demos work. All 4 modal demos (basic, confirmation, action, index demo) render under Hugo: modals open/close, form inputs work. No functionality lost vs Gatsby pages.
-
Bundle: island JS is 15.27 MB raw / ~2.9 MB gzipped – one shared, cacheable bundle across all 153 pages, not per-page. Beyond that, per-page added JS is negligible (placeholders + tiny mount script).
-
Tree-shaking: currently impossible. @sistent/sistent dist is a single pre-bundled ~5.3 MB ESM file, and its module-scope code touches every peer dependency (rjsf, xstate, date-fns all required – stubbing any of them breaks the runtime). Shrinking needs per-component ESM chunks upstream in Sistent itself.
-
Hugo build time: +90–120s for 2 pages (esbuild re-bundles on every build). Mitigation: prebuild the island entry outside Hugo.
-
npm weight: ~175 packages in the Hugo tree (~6 min install) – Sistent peers required, far smaller than the full Gatsby install.
-
Theme sync: works – page toggle dispatches an event → each island re-renders inside a re-keyed SistentThemeProvider (light/dark verified).
-
Mechanics discovered: demos live in .jsx assets (Hugo esbuild only takes JSX outside .js), data-demo placeholder divs in markdown replace
JSX, and small browser shims (process/path/url) are required when bundling.
Recordings
https://github.com/user-attachments/assets/178ddb4d-9ca9-478b-8862-607a242d7301
should i raise a PR?
@PARTH-TUSSLE ^^
@yashspidey raise Pr for this. and Please keep ui same as current on layer5.io
Option A is better according to me. built a prototype and ran locally. attaching Recordings here.
these are the findings -
- Live demos work. All 4 modal demos (basic, confirmation, action, index demo) render under Hugo: modals open/close, form inputs work. No functionality lost vs Gatsby pages.
- Bundle: island JS is 15.27 MB raw / ~2.9 MB gzipped – one shared, cacheable bundle across all 153 pages, not per-page. Beyond that, per-page added JS is negligible (placeholders + tiny mount script).
- Tree-shaking: currently impossible. @sistent/sistent dist is a single pre-bundled ~5.3 MB ESM file, and its module-scope code touches every peer dependency (rjsf, xstate, date-fns all required – stubbing any of them breaks the runtime). Shrinking needs per-component ESM chunks upstream in Sistent itself.
- Hugo build time: +90–120s for 2 pages (esbuild re-bundles on every build). Mitigation: prebuild the island entry outside Hugo.
- npm weight: ~175 packages in the Hugo tree (~6 min install) – Sistent peers required, far smaller than the full Gatsby install.
- Theme sync: works – page toggle dispatches an event → each island re-renders inside a re-keyed SistentThemeProvider (light/dark verified).
- Mechanics discovered: demos live in .jsx assets (Hugo esbuild only takes JSX outside .js), data-demo placeholder divs in markdown replace JSX, and small browser shims (process/path/url) are required when bundling.
Recordings
Screen.Recording.2026-11-06.223851.mp4 should i raise a PR?
Thanks @yashspidey, great spike. +1 to Saurabh, let's go with Option A. Please raise the PR with these in mind:
- Set the base branch to
hugo, notmaster, and keep all changes insidehugo/. - Build the islands setup (
js.Buildentry, mount script, shims, theme event) so other features can reuse it, not just Sistent. Forms, calendar, Cytoscape and the Meshery embed in Phase 4 will need the same thing (P4-00 in #8298). Modal can be the first component that uses it. - Keep the UI the same as the current Sistent modal pages on layer5.io, as Saurabh mentioned, and add light and dark mode screenshots.
- Try the prebuild mitigation you mentioned and include before/after build-time numbers in the PR description.
I'll record the decision in #8297 and update P4-08 with this approach.
Checking in... it has been awhile since we've heard from you on this issue. Are you still working on it? Please let us know and please don't hesitate to contact a MeshMate (https://meshery.io/community/meshmates/) or any other community member (https://meshery.io/community) for assistance.
Hi @yashspidey, just following up on this issue. If we do not hear from you within the next 7 days, we will unassign it so someone else can pick it up. Thanks!