# Hosting VectorCraft for the web `vectorcraft-web-.zip` (from the GitHub release, or `packaging/web/package.sh`) holds a static site in `vectorcraft-web-/`: | File | What it is | |---|---| | `index.html` | The page. It loads everything through relative URLs. | | `vectorcraft-web-.js` | wasm-bindgen glue (generated, ES module) | | `vectorcraft-web-_bg.wasm` | The app, about 13 MB, or 5 MB with compression | | `vectorcraft-plugin-worker_loader.js`, `vectorcraft-plugin-worker.js`, `vectorcraft-plugin-worker_bg.wasm` | The plug-in worker, which checks plug-ins and runs filters off the page. These names carry no hash. | | `_headers`, `.htaccess` | Sample header rules for Netlify/Cloudflare Pages and Apache | There is no server-side code. Upload the folder's contents anywhere that serves static files. ## Any path works All URLs in `index.html` are relative (`public_url = "./"` in `apps/vectorcraft-web/Trunk.toml`), so the site works at a domain root (`https://example.com/`), under a prefix (`https://example.com/tools/vectorcraft/`) and from a CDN bucket. The app's asset names carry a content hash, so they can be cached forever. `index.html` and the three `vectorcraft-plugin-worker` files need revalidation. ## Required server settings - **MIME type:** serve `.wasm` as `application/wasm`. Browsers refuse to stream-compile it under any other type, and the app then loads slowly or not at all. Serve `.js` as `text/javascript`. Most hosts already do both. For nginx, check that `mime.types` has `application/wasm wasm;`. - **Compression:** turn on gzip or Brotli for `.wasm`, `.js` and `.html`. That takes the download from about 13 MB to about 5 MB. You can also precompress (`brotli -k *.wasm`) and let the server send `Content-Encoding: br`. - **Caching:** `Cache-Control: public, max-age=31536000, immutable` on the hashed `vectorcraft-web-` `.wasm` and `.js` files, and `no-cache` on `index.html` and the `vectorcraft-plugin-worker` files. The page refuses a cached worker whose messages differ from its own, and plug-ins then fail to install and run until the browser fetches the new worker. - **Content Security Policy:** a site that sends one must allow four things ([CSP Level 3](https://www.w3.org/TR/CSP3/)): - The inline `