Skip to content

About

The golden architecture for a multiplayer design tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

Building a Multiplayer Design Tool With Durable Actors

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.

A Design Terse canvas with two mobile frames and a desktop landing page

Running Locally

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 dev

That runs the actors (terse actor dev, port 7100), the backend (port 3000), and the frontend (port 5173) together.

The Actors

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.

Project Structure

There are 4 main folders (all are small).

  1. Actors: The stateful serverless functions we are using to host the Canvases
  2. Backend: Express App + PG DB for user auth + basic ACL
  3. Frontend: Vite app for serving the front end
  4. schemas: Shared zod types for type-safety across the wire.

How does this even work?

From the Browser

Users connect via websocket and listen + push changes to the actors. The backend authorizes the connection first, then sends the signed connection url.

From MCP Server

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.

About

The golden architecture for a multiplayer design tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages