This server fulfills the Graffiti protocol as currently defined here. The server is currently written to run as a Cloudflare worker, but in the future it may be modified to run on other platforms or bare metal.
The official deployment live at https://graffiti.actor
- The
webdirectory contains the frontend interface for account creation and management as well as the Oauth authorization frontend. It is written with Vue and during deployment it is compiled with Vite into to a set of static files. - The
workerdirectory contains the server-side logic. It is written using Hono.- The
worker/apidirectory contains the API endpoints that are exposed to the client. These include endpoints for storing and retrieving data from storage buckets, and endpoints for sending and receiving messages from inboxes. - The
worker/appdirectory contains the rest of the server application logic needed by the front end.
- The
Clone the repository and install the dependencies:
git clone git@github.com:graffiti-garden/server.git
cd server
npm installThen, set up the database:
npx wrangler d1 migrations apply graffiti-db --localFinally, start the server:
npm run devThis will start two local web servers for the front and back ends respectively. Make sure to interact via the front end endpoint at https://localhost:5173. You will need to click through a "self signed certificate" warning.
As you change either the front or back end, the server will automatically reload.
For first time deployments:
-
Create a D1 database either using the Cloudflare dashboard or the
wranglerCLI:npx wrangler d1 create graffiti-db
Copy the database name, and ID into your
wrangler.tomlfile:[[d1_databases]] binding = "DB" database_name = "graffiti-db" database_id = "12345678-YOUR-DATA-BASE-ID0000000000"
-
Create an R2 bucket using the Cloudflare dashboard.
Copy the database name into your
wranger.tomlfile:[[r2_buckets]] binding = "STORAGE" bucket_name = "graffiti-bucket"
-
Update
BASE_HOSTand[[routes]]to reflect your production domain. -
Run
npm run deployto deploy the application.
In the future, simply run npm run deploy to update the application.