lightweight excalidraw sharing API implementation in rust https://draw.slonk.ing/
Find a file
2025-04-29 03:45:23 +03:00
migrations make it more storage efficient 2025-04-29 03:45:23 +03:00
src initial commit 2025-04-29 03:03:03 +03:00
.gitignore initial commit 2025-04-29 03:03:03 +03:00
API.md initial commit 2025-04-29 03:03:03 +03:00
Cargo.lock initial commit 2025-04-29 03:03:03 +03:00
Cargo.toml initial commit 2025-04-29 03:03:03 +03:00
README.md make it more storage efficient 2025-04-29 03:45:23 +03:00

excalidraw-api-mini

lightweight excalidraw sharing API implementation in rust

Building

cargo build --release # current target
cargo zigbuild --target=x86_64-unknown-linux-musl # amd64 linux with static libc

Usage

build the excalidraw frontend with the correct endpoints set:

export VITE_APP_BACKEND_V2_GET_URL=http://localhost:2799/ VITE_APP_BACKEND_V2_POST_URL=http://localhost:2799/
export VITE_APP_WS_SERVER_URL=export NODE_ENV=production
yarn build:app:docker # yes, :docker is the configuration you probably want
cd excalidraw-app/build
caddy file-server --listen :8000 --browse

start excalidraw-api-mini:

export DATABASE_URL="postgres:///excalidraw?host=%2Frun%2Fpostgresql&user=$USER"
export CORS_ORIGIN=http://localhost:8000
excalidraw-api-mini

Gotchas

  • SIGTERM (or the equivalent) will not gracefully shut down excalidraw-api-mini on non-UNIX systems, only SIGINT (or the equivalent) will.
  • Only supported backend is PostgreSQL (which you should be using anyways).
  • No per-client rate limiting, only a global concurrency limit to not bog down the database in case of a DOS attack.
  • Shared items last forever (you should use an external script to manage this—the id field is actually an ulid which stores a 48-bit timestamp with millisecond precision.