Skip to content

Share a database as a web studio (Labs) - #283

Merged
broisnees merged 1 commit into
nightlyfrom
studio-share
Nov 17, 2026
Merged

broisnees merged 1 commit into
nightlyfrom
studio-share

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

A link that opens a database in the web studio on any device, for anyone it's sent to, through the relay at stroke.click (stroke-app/stroke-web#61, deployed). End-to-end encrypted: AES-256-GCM with a key that exists only in the link's #fragment; the relay passes ciphertext.

strokedb 0.3.0 (cli/)

  • --share prints a share link alongside the local studio (needs Node 22+ for WebSocket); --write lets it edit.
  • Read-only by default, enforced by the engine, not only the routes: the shared side opens its own connection. Postgres runs each statement alone (extended protocol) inside BEGIN READ ONLY … ROLLBACK; MySQL inside START TRANSACTION READ ONLY … ROLLBACK; SQLite opens the file read-only. On top, the console accepts reading statements only (isReadingSql), and edit routes are absent.
  • makeRoutes is shared by the local bridge and the relay host; relay.js holds the room socket and reconnects with backoff.
  • Tests: read-only routes, the SQL filter, the crypto round trip, and a read-only SQLite engine refusing writes (14 pass).

Desktop app

  • Settings → Labs → Share as a web studio; then Share as web studio in the command palette opens a dialog: Read-only / Allow edits, Create link, Copy, live status, Stop sharing. A different level makes a new link.
  • The app answers the studio itself (studio-share.js), on the connection it has open. SQL goes through a new share_execute_sql command, which is the MCP server's path: the access classifier (one reading statement), then the engine's read-only transaction. The share pauses if another database is in front, and ends on disconnect or when the Labs switch goes off.
  • PostgreSQL, MySQL and SQLite connections (what the web studio speaks).

Tested

  • Against the local relay: the app shared crm.db; a second browser browsed 500 rows; DELETE, select 1; delete … and row edits were refused; Stop sharing took the room offline.
  • Against production stroke.click: strokedb --share; the live studio opened it with the read-only badge; a DELETE through the relay was refused.

cargo build, svelte-check, design-lint, 1800 vitest and the CLI tests pass.

@broisnees
broisnees merged commit 006f09a into nightly Nov 17, 2026
1 check passed
@broisnees
broisnees deleted the studio-share branch November 17, 2026 10:40
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant