Self-hosting Draft Canvas
Build the web app and serve it yourself. It is a static site with no backend.
Build#
You need Node.js 22.22.2 or later. Check out a stable vX.Y.Z tag of the
repository and run:
npm ci
npm run build
Deploy dist/; npm run preview tries it locally. To host the landing page and docs too, run
npm ci --prefix www and npm run build:web, then deploy dist-web/site/ (landing page and docs)
and dist-web/app/ (the web app, the same as dist/) as two sites.
Serve#
- Serve at
/or a folder such as/editor/, redirecting folder URLs to a trailing slash. - Return 404 for unknown paths. Send correct JavaScript and CSS content types.
- Use HTTPS (except on localhost) for offline use and the clipboard.
- Revalidate
index.htmlandsw.js; hashedassets/files can be cached forever. - Keep the build's Content-Security-Policy. To block framing, also send
Content-Security-Policy: frame-ancestors 'none'andX-Frame-Options: DENYheaders.
Live sessions#
Live sessions run between browsers, not through your server.
- The hosted relay accepts only app.draftcanvas.dev and the desktop app, so people join your copy by direct invite.
- To use session links, run your own relay and
build with
VITE_COLLAB_RELAY=wss://your-relay npm run build. VITE_COLLAB_RELAY=(empty) leaves the relay out.
Storage and updates#
- Diagrams belong to each browser and address. Export before moving hosts or clearing site data; see Saving and sharing.
- Deploy each build as a whole. Open copies keep the old version until their service worker updates.