Skip to content

Add public and private notebooks - #235

Merged
pearmini merged 3 commits into
mainfrom
notebook-visibility
Sep 27, 2026
Merged

pearmini merged 3 commits into
mainfrom
notebook-visibility

Conversation

@pearmini

@pearmini pearmini commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Each notebook can now be public or private. Anyone with the link can open a public notebook. New notebooks are private.

Database

Notebooks move from users/{uid}/notebooks/{id} to a top-level notebooks/{id} collection, so a link can find a notebook without knowing its owner. Each document now has ownerId and visibility.

The Firestore rules:

  • Allow anyone to read public notebooks, and only the owner to read private ones.
  • Allow only the owner to write or delete, and stop ownerId from changing.
  • Keep owner access to the old location, so notebooks can be migrated and the rules can be deployed before this code.

Listing your notebooks now filters by ownerId and sorts on the client, so no composite index is needed.

Migration

When a user logs in, their notebooks in the old location are copied to notebooks/{id} as private, then deleted from the old location. Notebooks that were already moved are never overwritten, so a failed run just retries on the next login.

UI

  • The owner sees a Private or Public button next to the title. Clicking it saves right away, and making a notebook public copies its link.
  • Anyone else opening a public notebook sees a "View only" label. They can run and edit it locally, but nothing is saved. Duplicate copies it into their own account as private.
  • The notebooks list shows a globe icon on public notebooks.

Deploying

The rules are already deployed to recho-dev. They still allow the old location, so the live site keeps working until this is merged. Once everyone has migrated, the old location's rule can be removed.

Test plan

  • Lint, format, typecheck, unit tests, and next build pass
  • Deploy the rules, log in, and confirm existing notebooks are migrated
  • A private notebook's link shows not found in a logged-out window
  • A public notebook opens logged out, and edits are not saved
  • A second user can view and duplicate a public notebook, but not save it

🤖 Generated with Claude Code

Notebooks move from users/{uid}/notebooks/{id} to a top-level
notebooks/{id} collection with an owner and a visibility, so a public
notebook can be opened by anyone with its link. New notebooks are
private.

- Owners can toggle a notebook between private and public from the
  editor toolbar. Making it public copies the link.
- Others can view, run, and edit a public notebook locally, but can't
  save it. They can duplicate it into their own account.
- Existing notebooks are moved to the new collection as private on
  login, then deleted from the old location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
recho-notebook Ready Ready Preview Sep 27, 2026 9:33pm UTC

Deploying the new rules before the new code would otherwise stop the
live site from saving.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A notebook edited on the old site after being migrated was deleted
  from the old location without copying the newer edits. Copy an old
  notebook when it's newer than the migrated one, keeping its
  visibility.
- Validate visibility in the rules and share the owner check.
- Share the ownership check in the editor, and reset the "Link copied"
  label when visibility changes again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pearmini
pearmini merged commit 55990ab into main Sep 27, 2026
3 checks passed
@pearmini
pearmini deleted the notebook-visibility branch September 27, 2026 21:34

This branch was successfully deployed

1 active deployment
Preview — d61b03dd Deployed Sep 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant