In this code base, you will find a simple multiplayer design tool built fully with Durable Actors powering the canvas + coordination.
For a more detailed explanation of how this works, check our our blog post.
The repo is a Bun workspace. With Bun and the terse CLI installed:
Note: You will need a WorkOS account + env variables set up. In the project, you will find a .env.example. I recommend pointing computer use at it to set up all of the WorkOS stuff.
bun install
cp backend/.env.example backend/.env.local # then fill it in
bun run devThat runs the actors (terse actor dev, port 7100), the backend (port 3000), and the frontend (port 5173) together.
In the actors folder, you will find the Canvas actor. This is the core of the project. Every canvas gets its own tiny server + SQLite DB.
Notice there is no complicated websocket support here. No json payloads being written to postgres, no gnarly locking logic. Everything gets simplified tremendously thanks to Durable Actors.
There are 4 main folders (all are small).
- Actors: The stateful serverless functions we are using to host the Canvases
- Backend: Express App + PG DB for user auth + basic ACL
- Frontend: Vite app for serving the front end
- schemas: Shared zod types for type-safety across the wire.
Users connect via websocket and listen + push changes to the actors. The backend authorizes the connection first, then sends the signed connection url.
Users connect the MCP server then auth (very easy thanks to WorkOS). From there, the MCP routes use the RPC connection methods to mutate the actors. This is safe since the MCP server is a trusted connection.
