An interactive code editor for live-coding HTML, CSS, JavaScript, Hydra, and Strudel experiences with real-time iframe previews.
- Astro prerenders the gallery and
/editor/[experienceName]pages. - React islands preserve the existing editor, controls, and experience context.
- CodeMirror 6 provides editing and syntax highlighting.
- The beta Astro Cloudflare adapter deploys to Workers using the
cfCLI andcloudflare.config.ts. - Workers Builds deploys
mainto production and development branches to Worker Previews. The production domain ismvvmm.com.
Astro, the Cloudflare adapter, and cf use compatible, pinned beta releases.
Update them together and check both production builds and branch previews when
upgrading. This setup uses [email protected],
@astrojs/[email protected], and [email protected].
Use Node.js 22.18 or later and the pnpm version pinned in package.json.
nvm use
pnpm install
pnpm run devOpen the URL printed by Astro, normally http://localhost:6886.
The beta Astro CLI can run development as a background process; use
pnpm exec astro dev status, pnpm exec astro dev logs, and
pnpm exec astro dev stop to inspect or stop it.
pnpm run check # Astro, TypeScript, and React diagnostics
pnpm run build # cf build in production mode; no upload
pnpm run format # Format source; experience files are excludedThe build writes deployment output to .cloudflare/output/v0/ and prerendered
pages to dist/. Generated output is ignored by Git.
Sign in locally before deploying:
pnpm exec cf auth login
pnpm run deploy:previewThe preview name defaults to the Git branch. Each branch has a stable Preview URL and each deployment has an immutable Deployment URL. To specify a name:
pnpm exec cf previews deploy my-preview --mode productionPublish production with:
pnpm run deployProduction publishes the mvvmm-com Worker to mvvmm.com and workers.dev.
cloudflare.config.ts excludes the production custom domain when building a
Preview. Previews use workers.dev URLs with Cloudflare's noindex header.
The app uses static assets only; sessions and managed image processing are
explicitly disabled, so the adapter does not provision KV or Images bindings.
For unattended deployment, supply CLOUDFLARE_API_TOKEN and
CLOUDFLARE_ACCOUNT_ID through the CI environment. Never commit token values.
Both deploy commands build for their target. A production build cannot be reused as a Preview build. To reuse a production build locally:
pnpm run build
pnpm exec cf deploy --prebuilt --mode productionThe GitHub repository is connected to the mvvmm-com Worker. Its Builds settings
use the repository root and the following commands:
| Setting | Production | Previews |
|---|---|---|
| Branch | main |
Development branches |
| Build command | pnpm run check |
pnpm run check |
| Deploy command | pnpm run deploy |
pnpm run deploy:preview |
The deploy command handles the framework build, avoiding a duplicate build step.
Pushes to main publish production, including the mvvmm.com custom domain.
Worker Previews are enabled for branch deployments. cf writes the preview
metadata directly to the WRANGLER_OUTPUT_FILE_PATH or
WRANGLER_OUTPUT_FILE_DIRECTORY supplied by Builds, so Builds can report both
the branch Preview URL and the immutable Deployment URL without a wrapper.
When changing the deployment setup, deploy a fresh preview name, then redeploy
the same name. Check both URLs in Workers Builds and smoke-test the gallery,
an editor page, and the custom 404 after each deployment. This app has no secret
bindings. If secrets are added, declare them with bindings.secret(); cf
preserves existing preview secrets on redeployment. Do not use preview-specific
unsafe:inherit bindings.
GitHub Actions independently checks types, builds, and deployment output without Cloudflare credentials; it does not deploy.
src/pages/— gallery, generated editor routes, and the 404 page.src/layouts/andsrc/styles/— page shell, metadata, favicon, and styling.components/— React editor, controls, gallery cards, and preview iframe.contexts/— editor state, preview controls, and Strudel lifecycle.experiences/— editable HTML, CSS, JavaScript, Hydra, and Strudel sources.data/— build-time experience loading and iframe document generation.lib/— CodeMirror themes, editor setup, and audio initialization.
Experience source files are imported as raw text at build time and serialized
into their pages. Add a folder under experiences/ with a meta.json
containing its createdAt date (YYYY-MM-DD), then rebuild to create its
editor route. The gallery lists experiences newest first. Unknown routes return
the custom 404 page. Browser edits remain in memory and are reset when
navigating away or reloading.
The editor and iframe share one React island with their context and tooltip
providers. Browser-dependent editor and audio code mounts through
client:only="react"; the page shell and gallery links are prerendered.
The experience lab roadmap outlines ten new experiences
and the library integration approach. Try /editor/garden for Three.js
and /editor/tide for vgpu/WebGPU with a Canvas fallback.
Experience files ending in .module.js execute as ES modules. Add a pinned
import map in scripts.html to use browser libraries. Relative imports between
editable files are not yet supported. Run pnpm test for document-builder checks.
