Skip to content
SaDaGoPiaPublic

About

A real-time collaborative whiteboard — draw shapes, see live cursors, and sync instantly with others. Built with Next.js, Supabase, and Konva.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OpenBoard

A real-time collaborative whiteboard, Figma-lite style: multiple people draw and move shapes on a shared canvas, see each other's cursors live, and edits sync in about a second — no lost work on refresh.

Built with Next.js, Supabase (Postgres + Realtime + Auth + Storage), and Konva.js.

Board canvas with shapes, toolbar, and live presence

Features

  • Auth — email magic-link sign-in, no passwords
  • Boards — create, rename, duplicate, delete; each board is invite-only
  • Roles — owner / editor / viewer per board, invite collaborators by email; viewers get a read-only canvas
  • Canvas — rectangles, ellipses, freehand pen, text boxes, and image uploads: create, move, resize, recolor, layer (bring to front/back), delete
  • Multi-select — shift-click or marquee-select to move/recolor/delete several shapes at once
  • Pan & zoom — scroll to pan, Ctrl/Cmd+scroll to zoom, centered on the pointer
  • Snap-to-grid, undo/redo, and PNG export of the current view
  • Live sync — shape changes broadcast to everyone on the same board over a per-board Supabase Realtime channel, with a live connection-status indicator
  • Live cursors + presence — see collaborators' cursor position, name, and color, plus an avatar stack of who's currently on the board
  • Persistence — the board is saved to Postgres and restored on refresh
  • Toast notifications, loading skeletons, and board thumbnails round out the everyday experience
Boards list with thumbnail Members panel with invite form

Tech stack

Framework Next.js (App Router) + TypeScript
Backend Supabase — Postgres, Realtime (broadcast + presence), Auth, Storage
Canvas Konva.js via react-konva
Styling Tailwind CSS
Deploy target Vercel

Getting started

  1. Install dependencies

    npm install
  2. Create a Supabase project at supabase.com/dashboard.

  3. Configure environment variables

    cp .env.local.example .env.local

    From Project Settings → API in the Supabase dashboard, fill in:

    • NEXT_PUBLIC_SUPABASE_URL
    • NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY (the current dashboard issues a sb_publishable_... key, not the legacy anon JWT)
    • SUPABASE_SERVICE_ROLE_KEY — the secret service_role key. Used server-side only, to invite collaborators by email and resolve member emails for the members panel. Never expose this to the browser.
  4. Enable the magic-link redirect. In the dashboard, under Authentication → URL Configuration, add http://localhost:3000/auth/callback to the redirect URL allowlist (and your deployed URL's equivalent once you have one). Email OTP / magic link is on by default, though its shared sender has a low rate limit — see Custom SMTP below before inviting real users.

  5. Run the database migrations. Open the Supabase SQL Editor and run each file in supabase/migrations/ in order — they create the schema, storage bucket, and row-level security policies that later migrations depend on.

  6. Start the dev server

    npm run dev

    Open http://localhost:3000, sign in with your email, and you'll land on /boards once the magic link is confirmed.

Custom SMTP

Supabase's built-in email sender is rate-limited to a handful of emails per hour — fine for your own testing, not enough for real signups or invites. Before other people need to receive magic links or invite emails, set up a provider under Project Settings → Authentication → SMTP Settings. Any provider that supports single sender verification (no domain required) works — Brevo's free tier is a good starting point.

How it works

  • Each board is one Supabase Realtime channel (board-<id>), carrying shape broadcasts, cursor position, and presence together.
  • Shape mutations are optimistic: applied to local state immediately, then upserted to Postgres and broadcast to the channel in the same step. Other clients merge incoming changes into their local state by shape id.
  • Cursor position is sent in world coordinates (i.e. board space, not screen pixels), so it stays correct regardless of each viewer's own pan, zoom, or window size — only the receiver's own view transform is applied when rendering someone else's cursor.
  • Access is membership-gated: a board_members table with an owner / editor / viewer role per user, enforced by Postgres row-level security (not just the UI) via SECURITY DEFINER helper functions that avoid RLS self-recursion. The board's link alone is not enough — invite collaborators from the board's People panel.
  • Shape rendering (Konva) is kept decoupled from the sync layer, so the conflict-resolution strategy (currently last-write-wins) can be swapped out later without touching the canvas code.

Known limitations (by design, for now)

  • No CRDT/OT — concurrent edits to the same shape are last-write-wins. Fine for a small group on one board; would need real conflict resolution to scale to heavier concurrent editing.
  • No offline support.
  • Custom SMTP is required before inviting collaborators who don't already have an account — otherwise Supabase's shared sender rate-limits fast.

Deploy

Target platform is Vercel. Set the same environment variables from .env.local.example (including SUPABASE_SERVICE_ROLE_KEY) in the Vercel project settings, and update NEXT_PUBLIC_SITE_URL plus the Supabase redirect URL allowlist to match the deployed domain.

Push order matters: this app's database migrations aren't applied automatically, so run any new migration in Supabase before pushing code that depends on it — pushing first would break the live site for everyone until the schema catches up.

Regenerating screenshots

npm run screenshots drives a headless browser through sign-up, board creation, drawing, and the members panel, saving to docs/screenshots/. It needs SUPABASE_SERVICE_ROLE_KEY in .env.local and the dev server running. It creates throwaway screenshot-bot+<timestamp>@example.com accounts — clean them up afterward with npm run cleanup-test-users.

Project docs

See CLAUDE.md for the full project spec, data model, and build history.

About

A real-time collaborative whiteboard — draw shapes, see live cursors, and sync instantly with others. Built with Next.js, Supabase, and Konva.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages