Docs / App & API Worker

Developer docs

ForkMesh App & API Worker

The Python Worker in app/ serves the Git product UI, REST API, realtime routes, and encrypted ForkMesh mainnode rooms. The canonical official origin is https://app.forkmesh.com.

/api/repo/{owner}/{repo}/rooms/{room}/ws

The older /api/room/{room}/ws path remains as a temporary compatibility endpoint.

Operational pages are deployed with the App through Cloudflare Workers Static Assets, while API, health, Git, federation, and WebSocket routes run through the Python Worker. The official landing pages, marketing, docs, and blog are a separate Worker in www/; the optional 3D experience is in world/. A self-hosted App sets SINGLE_WORKER_SITE=true and serves its complete product entry point at the same origin as its API.

Managed Go mirror services publish signed metadata to the repository catalog at:

/api/repositories

The product UI fetches this endpoint and renders the network repository list. Persistent catalog data lives in D1; the App stores signed metadata only, not local filesystem paths or Git object data.

Clients encrypt room payloads with AES-256-GCM before sending. For default rooms, the Worker derives a shared passphrase from DATA_KEY and releases it to authenticated accounts or signed nodes, so the relay operator can derive the room key and decrypt messages. Frames marked persist: true are kept for at most 7 days, with only the newest 500 retained per room; other frames are broadcast without history storage.

There are no npm, npx, TypeScript, or package-lock dependencies in this worker project.

Local Development

uvx --from workers-py pywrangler dev

Then use this server URL in the Qt client:

ws://127.0.0.1:8787/api/repo/mainnode/forkmesh/rooms/general/ws

The deployed mainnode URL is:

wss://app.forkmesh.com/api/repo/mainnode/forkmesh/rooms/general/ws

Deploy

Deploy or validate only the App target from the repository root:

cd app
./deploy.sh app
./deploy.sh dry-run app

./deploy.sh deploy coordinates all changed official targets. Its per-target fingerprints keep unchanged App, World, and www Workers out of the upload path.

Deploys use pywrangler. If neither uv nor pywrangler is on PATH, the script installs workers-py into a local .pywrangler/ venv and runs that copy automatically.

Set NODE_NAME and NODE_SOLANA_ADDRESS in wrangler.toml or as dashboard environment variables for the health response.

Mainnode binding

The Durable Object binding is FORKMESH_MAINNODE_ROOM. Each object is keyed by repository and room:

repo:{owner}/{repo}:room:{room}

Durable Objects carry transient room and presence traffic. Persistent repository catalog records live in the Worker's DB D1 binding, with REPOSITORY_METADATA used for bounded KV caches and coordination metadata.