blockcn

Demo

Run the public demo locally, and deploy the static app plus the example server.

The demo is the Vite app in editor/. It is not part of the registry: shadcn add does not copy src/demo or src/App.tsx.

The top bar turns add-ons, right-to-left layout, a German sample (?lang=de), read-only mode, and the theme on and off. The address bar keeps those choices. Collaborate opens ?room= against the example server. That tab loads the document you were editing, once (seed=1 is removed from the URL after it applies). Anyone with the room link then shares that document. The server stores each room on disk, and the browser also keeps the local demo in localStorage under blockcn-demo:.

Run it locally

pnpm --dir server dev
pnpm --dir editor dev

The editor expects the server at ws://localhost:8001/collaboration. Override it with VITE_COLLAB_URL, VITE_AI_URL, and VITE_UPLOAD_URL in editor/.env. See Backend for COLLAB_SEED, tokens, and uploads.

Deploy

Do not point a static host at the server. The editor is a static Vite build. Collaboration is a WebSocket process that has to stay running, and it writes room files under server/data.

Build the editor from the repo root. pnpm --dir editor build also stamps the registry and needs scripts/ next to editor/.

HostWhat to publishNotes
Verceleditor/distRoot directory: the repo. Install: pnpm install. Build: pnpm --dir editor build. Output: editor/dist. Set VITE_COLLAB_URL, VITE_AI_URL, and VITE_UPLOAD_URL before the build. Vite inlines them.
Netlifyeditor/distSame build. Publish directory editor/dist. The WebSocket server is not a Netlify function.

VITE_COLLAB_URL looks like wss://collab.example.com/collaboration. VITE_AI_URL looks like https://collab.example.com/api/ai.

Run the server on a host that accepts WebSockets and a persistent disk (a VM, Fly.io, or Railway). From the repo:

pnpm --dir server build
PORT=8001 COLLAB_SEED=demo pnpm --dir server start

Keep server/data (or the SQLite file, if COLLAB_STORAGE says so) across restarts, or rooms reset. Put the AI provider keys and COLLAB_SECRET in that host's environment, not in the static build. Mint browser tokens with pnpm --dir server collab:token and pass them as ?token=, or leave anonymous access on for a public demo. The Backend page lists every variable.

This repo does not deploy either host. The steps above are for the owner.

On this page