Add cloud storage with GitHub and Google login - #231
Merged
Merged
Conversation
Notebooks are saved to Firestore under the logged-in user. Local notebooks are uploaded on login and then cleared; logged-out users can view and run them but can't save. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unsaved edits can be overwritten or silently lost during login, autosave failures, and page unloads.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds Firebase authentication and Firestore-backed notebook persistence, including local notebook migration and autosaving.
Changes:
- Adds GitHub/Google login and account navigation.
- Migrates notebook storage from localStorage to Firestore.
- Adds debounced autosaving, migration, and freeze-state tracking.
File summaries
| File | Description |
|---|---|
.env.example |
Documents Firebase configuration variables. |
.firebaserc |
Selects the Firebase project. |
.gitignore |
Excludes local Firebase artifacts and environment files. |
app/EditorPage.jsx |
Integrates authentication, cloud loading, and autosaving. |
app/Nav.jsx |
Adds the login and account menu. |
app/api.js |
Implements Firestore persistence and local migration. |
app/auth.js |
Adds authentication state and login flows. |
app/examples/ExampleEditor.jsx |
Requires login before duplication. |
app/firebase.js |
Lazily initializes Firebase services. |
app/works/page.jsx |
Loads and deletes cloud notebooks. |
firebase.json |
Configures Firestore rules deployment. |
firestore.rules |
Restricts notebooks to their owners. |
package.json |
Adds the Firebase dependency. |
pnpm-lock.yaml |
Locks Firebase and transitive dependencies. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
- Files reviewed: 12/14 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Keep edits made while logged out on screen after login and save them. - Retry failed autosaves and warn before closing the tab while edits are queued, being written, or waiting for a retry. - Show a retryable error instead of a 404 or an empty list when loading from Firestore fails. - Keep listing local notebooks that failed to upload, and never overwrite cloud notebooks when the upload is retried. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close: #107
Summary
Notebooks are now saved to Firebase (Firestore) instead of only localStorage, with login via GitHub or Google.
/works, but edits aren't saved and delete is hidden.autoRunon every run.Implementation
app/firebase.js: lazy Firebase init, so server rendering never touches Firebase.app/auth.js: auth store (sameuseSyncExternalStorepattern asapp/store.js) andensureUser().app/api.js: notebook reads and writes are async and stored atusers/{uid}/notebooks/{id}.firestore.rules: users can only read and write their own notebooks.Setup
recho-dev, with GitHub and Google providers enabled.NEXT_PUBLIC_FIREBASE_*variables are set in Vercel for all environments. See.env.examplefor local development.firebase deploy --only firestore:rules.Test plan
pnpm test:lint,pnpm test:typecheck, prettier check, vitest (187 tests)pnpm app:build🤖 Generated with Claude Code