This guide covers production client builds and integration with the MoDiff backend. It does not turn MoDiff into a hardened public service. The supported default is a trusted, local, single-user deployment on 127.0.0.1.
Use the locked toolchain from the repository:
- Node.js
24.12.0from.nvmrc - npm
11.6.2 - dependencies installed with
npm ci
Build from the client root:
npm ci
npm run check
npm run release:assets:gateThe checked-in src/studio/templateAssetSource.json must be in huggingface mode
with a public Dataset repository, an immutable 40-character commit SHA, and a
verified asset-set identity before producing a release. Run
npm run release:assets:gate to preflight the checked source, build, compare
the build's emitted source identity with that checked source, and reject any
bundled Gallery payload. npm run test:asset-storage remains the lightweight
unit/contract gate and deliberately permits local mode during migration and
offline development.
The build command runs TypeScript project compilation and Vite. Its output is written to dist/ and includes:
index.htmlandfavicon.ico- bundled JavaScript, styles, fonts, and brand assets under
assets/
The source release build must not contain dist/template-gallery. The MoDiff
installer subsequently downloads the exact pinned Dataset, verifies every
SHA-256 digest, and performs a local-mode client build into the backend's
web/template-gallery. Normal installed-app reads are therefore same-origin
disk reads rather than Hub requests. See
Template Gallery asset storage.
dist/ is generated and ignored by Git. Do not commit it to the client repository.
Release qualification fingerprints the backend's actual installer inputs:
pyproject.toml, modiff/compatibility/accelerators.v1.json, and every profile
requirements file named by that manifest. The backend intentionally declares
[tool.uv] managed = false; its accelerator-aware installer owns the executable
environment, so there is no repository uv.lock and the client release contract
must not require or synthesize one.
For a static client-only inspection:
npm run preview -- --host 127.0.0.1 --port 4173This confirms that built assets load, but it is not a full MoDiff runtime test. Registry, file, queue, websocket, model, and generation behavior still require a compatible backend.
Run the bundle budget after changes that affect dependencies or code splitting:
npm run bundle:checkThe MoDiff backend serves the integrated application from its web/ directory. Replace generated client content, but preserve backend/user-owned content that is not produced by this client checkout.
PowerShell example from MoDiff-client. robocopy exit codes below 8 are
success:
npm run build
$backend = Resolve-Path '..\MoDiff'
robocopy .\dist "$backend\web" /MIR /XD user
if ($LASTEXITCODE -ge 8) { throw "Client mirror failed with exit code $LASTEXITCODE" }
if (Test-Path "$backend\web\template-gallery") { throw 'Remote build unexpectedly contains Gallery assets.' }Bash example from MoDiff-client:
npm run build
backend="$(cd ../MoDiff && pwd)"
rsync -a --delete --exclude '/user/' dist/ "$backend/web/"
test ! -e "$backend/web/template-gallery"Before running either example, verify that the resolved backend path is the intended checkout. Do not delete the entire backend web/ directory: a deployment may contain backend-owned or user-provided content such as web/user/ custom fields.
These manual commands create the lightweight source-release build. The normal
backend install.sh / install.ps1 flow instead verifies or downloads the
complete Gallery before building, bundles it into web/template-gallery, and
fails installation if that exact snapshot cannot be prepared.
Start the managed backend from its repository:
./run.shOn Windows use .\run.ps1.
Then open http://127.0.0.1:8088/. The backend should serve the client and API/websocket routes from one origin.
Verify at least:
curl -fsS http://127.0.0.1:8088/ > /dev/null
curl -fsS http://127.0.0.1:8088/health > /dev/null
curl -fsS http://127.0.0.1:8088/nodes > /dev/null
curl -fsS http://127.0.0.1:8088/runtime/status > /dev/nullAlso load the UI in a browser, confirm the websocket connects, create a
lightweight graph, and open Gallery. In browser network tools, verify its
manifest, an image, audio, video, and a default input resolve from the expected
public Dataset commit without authentication; no request may use main.
Development normally uses the Vite proxy. A production build normally uses backend same-origin hosting. If you intentionally host the client and backend on different origins:
- Build with
VITE_SERVER_ADDRESSset to the complete backend origin. - Configure backend HTTP CORS for only the intended client origin.
- Configure websocket origin checks and the correct
ws://orwss://path. - Terminate TLS before sending prompts, media, or workflow metadata over a network.
- Add authentication and authorization outside the current application.
- Restrict filesystem endpoints, upload size, request rate, and model/custom-module administration.
MoDiff does not currently provide the authentication boundary required for an internet-facing multi-user service. Binding the backend to 0.0.0.0 without compensating controls can expose local files, uploaded media, generated outputs, model operations, and graph execution.
Before publishing a client/backend pair:
- Run
npm ci,npm run check, andnpm run check:uiin the client. - Run
npm run test:asset-storage,npm run gallery:verify, andnpm run gallery:coverageif Gallery metadata or content changed, then runnpm run release:assets:gatefor every release build. - Build and copy the client into the exact backend revision being released.
- Run the backend test and preflight commands documented by that backend revision.
- Start the integrated backend from a clean process and verify the endpoints above.
- Confirm the built bundle contains no personal paths, credentials, private repository URLs, or stale product names.
- Confirm the pinned public Dataset manifest is anonymously readable, every referenced file matches its SHA-256, and published provenance is redacted.
- Confirm user/custom files in
web/were not deleted by the sync. - Document which model paths were mocked, schema-validated, or live-run; do not collapse those proof levels into one support claim.
- Keep the server on localhost unless the deployment has the controls listed under separate-origin hosting.