Svelte Flow Showcase uses one loopback Node listener and one systemd unit. The companion wiki is a separate static Quartz release. This page documents the checked-in deployment contract; a successful build alone is not evidence that either public host serves it.
Runtime topology
flowchart LR Browser["Browser"] --> AppEdge["sflw.loca.zone · nginx"] Browser --> WikiEdge["wiki.sflw.loca.zone · nginx"] AppEdge --> Node["127.0.0.1:51939 · sflw.service"] Node --> Build["build/index.js · timestamped release"] WikiEdge --> Wiki["wikis/sflw/current · Quartz release"]
| Surface | Contract |
|---|---|
| Source | /home/loca/dev/sflw |
| Runtime | /usr/bin/node and npm; not Bun |
| Unit | sflw.service, system scope, User=loca, Group=loca |
| Listener | HOST=127.0.0.1, PORT=51939 |
| Public origin | ORIGIN=https://sflw.loca.zone |
| Entry | /usr/bin/node build/index.js from the app root |
| Optional environment | EnvironmentFile=-/etc/sflw/sflw.env; absence is valid |
| Effective request body cap | 256 KiB: BODY_SIZE_LIMIT=256K in the unit and the assistant’s streamed input cap; nginx permits 1m |
| App proxy | http://127.0.0.1:51939, forwarding host, client address, and scheme |
| Wiki source | /home/loca/dev/wikis/sflw/content and quartz.config.yaml |
| Wiki nginx root | /home/loca/dev/wikis/sflw/current |
No DATA_DIR or ReadWritePaths is configured. The hardened service has read-only home and system views, private temporary storage/devices, no capabilities, and restricted namespaces and address families. Node’s JIT is permitted through MemoryDenyWriteExecute=no. The default assistant needs no provider credentials or external model; see assistant.
Source assets and edge headers
deploy/sflw.serviceinstalls to/etc/systemd/system/sflw.service.deploy/sflw.loca.zone.nginx.confinstalls to/etc/nginx/sites-available/sflw.loca.zone, linked fromsites-enabled.- The checked-in nginx file is an HTTP bootstrap for both names. It does not refer to certificates that have not yet been issued. Certbot adds TLS and redirects after the initial configuration check and reload.
- The app includes
snippets/security-headers-app.conf; the application supplies its own Content-Security-Policy. - The wiki includes
snippets/security-headers.confand resolves paths withtry_files $uri $uri.html $uri/ =404. - A single certificate name,
sflw.loca.zone, coverssflw.loca.zoneandwiki.sflw.loca.zone.
Do not replace a working TLS configuration with the HTTP bootstrap during an ordinary application release. Reinstall edge templates only for an intentional infrastructure change.
App releases
From /home/loca/dev/sflw, scripts/deploy.sh performs these ordered operations:
- Refuse to replace a non-symlink
buildpath. - Run
npm ci --no-audit --no-fundwith/usr/binfirst onPATH. - Build with
BUILD_OUT=build-<UTC timestamp>andnpx vite build. The timestamp includes nanoseconds to distinguish successive releases. - Require that release’s
index.jsbefore publication. - Create a temporary symlink and atomically rename it over
build; report the previous target. - If
sflw.serviceis installed, restart it using the script’s only privileged command,sudo -n systemctl restart sflw, then check its active state without sudo. If the unit is not yet installed, leave the prepared release for first-launch installation. - Retain the five newest generated timestamped release directories, always protecting the active target. Never prune
build-devor matching symlinks.
The adapter’s ordinary output is build-dev; setting BUILD_OUT overrides it. The service consumes the build symlink, not local preview output. A failed restart is a failed deployment; the script does not claim an automatic rollback or an HTTP health check.
Canonical gate order
Run final gates only after concurrent source owners have finished. Stop at the first failure and preserve its evidence.
npx svelte-check; usenpm run checkwhen SvelteKit synchronization is needed.npm test, the project’s focused Vitest gate.BUILD_OUT=build-dev npx vite buildfor the integrated app build.scripts/deploy.shfor the timestamped service release.- For first launch: install the unit and nginx vhost, reload systemd, run
nginx -t, reload nginx, issue TLS using Certbot, then enable/startsflw.service. On later releases perform only the applicable approved infrastructure operations. - Under
umask 022, run/home/loca/dev/wikis/build.sh sflw. - Run
scripts/e2e.mjswith/usr/bin/nodeusing its supported Chrome CDP invocation against the intended app. Inspect real mouse/keyboard behavior and a rendered screenshot. - Check loopback, both public HTTPS hosts, loaded assets, documentation navigation, and rendered recipe anchors.
- Record exact commands, observed results, app
buildtarget, wikicurrenttarget, and receipt hashes for the artifacts actually served.
The project slash commands in .omp/commands/gates.md and .omp/commands/publish.md preserve this order. Passing source checks does not replace browser or public-edge verification. Do not call a skipped gate a pass.
Four privileged operation classes
The launch allowlist has exactly four sudo operation classes. The commands below are operator instructions, not evidence they have already run.
1. Install the unit
sudo -n install -m 0644 deploy/sflw.service /etc/systemd/system/sflw.service
sudo -n systemctl daemon-reload2. Install and reload the nginx site
sudo -n install -m 0644 deploy/sflw.loca.zone.nginx.conf /etc/nginx/sites-available/sflw.loca.zone
sudo -n ln -sfn ../sites-available/sflw.loca.zone /etc/nginx/sites-enabled/sflw.loca.zone
sudo -n nginx -t
sudo -n systemctl reload nginxDo not reload if the configuration check fails.
3. Issue TLS for these two hosts
sudo -n certbot --nginx --non-interactive --agree-tos --redirect \
-m admin@loca.zone --cert-name sflw.loca.zone \
-d sflw.loca.zone -d wiki.sflw.loca.zone4. Enable or restart the app
First launch:
sudo -n systemctl enable --now sflw.serviceLater application deployments use the restart already contained in scripts/deploy.sh. Do not use sudo for npm, app builds, wiki publication, status checks, or unrelated services. Optional provider configuration is not part of the default credential-free launch.
Wiki publication
The configuration is adapted from the chat wiki, with pageTitle: Svelte Flow Showcase, baseUrl: wiki.sflw.loca.zone, and fontOrigin: googleFonts. The app and wiki have independent dependency/build paths; app CSS changes do not modify Quartz.
umask 022
/home/loca/dev/wikis/build.sh sflwThe shared publisher builds into a temporary output, checks for index.html, moves it to a dist-* release, and atomically updates current. It preserves the active target and five inactive releases. A check-only build is available as /home/loca/dev/wikis/build.sh sflw --check-only, but is not a publication receipt. Do not edit generated releases, caches, or the shared Quartz engine to make a per-wiki content change.
Before publishing, check sibling wikilinks, Markdown fence balance, and recipe headings against assistant KB identifiers. After publishing, confirm actual page identity and rendered content. A request for /recipes#add-node sends only /recipes to the server: the add-node anchor must exist in the rendered DOM. HTTP 200 alone does not prove that anchor, a diagram, or a stylesheet loaded.
Rollback and observation
For an app rollback, first select a retained release with its index.js present. Assign that directory name to previous, then run from the app root:
test -n "${previous:-}" && test -f "$previous/index.js" &&
ln -s "$previous" build.rollback &&
mv -T build.rollback build &&
sudo -n systemctl restart sflw
systemctl is-active --quiet sflwThe temporary link command deliberately refuses to overwrite an existing build.rollback. Check its provenance rather than deleting an unexpected path. A source revert is separate from selecting a retained release.
For a wiki rollback, choose a retained dist-* directory containing index.html, create a fresh temporary link to it within /home/loca/dev/wikis/sflw, and atomically rename that link over current. Do not use sudo. Recheck the public content and record the selected target.
Useful unprivileged observations:
systemctl status sflw --no-pager
systemctl is-active sflw
readlink build
readlink /home/loca/dev/wikis/sflw/current
curl -fsS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:51939/
curl -fsS -o /dev/null -w '%{http_code}\n' https://sflw.loca.zone/
curl -fsS -o /dev/null -w '%{http_code}\n' https://wiki.sflw.loca.zone/A release receipt must distinguish source files, generated artifacts, and live-response evidence. Record the observed target before hashing; a later publication can legitimately change build or current.