Skip to content

feat(blamy-notes): local + DB + git notes with login sync#11

Open
obvious-autobuild[bot] wants to merge 1 commit into
mainfrom
feat/blamy-notes-local-db-notes
Open

feat(blamy-notes): local + DB + git notes with login sync#11
obvious-autobuild[bot] wants to merge 1 commit into
mainfrom
feat/blamy-notes-local-db-notes

Conversation

@obvious-autobuild

Copy link
Copy Markdown

Adds three first-class ways to store a note in blamy-notes, all sharing one markdown content model. The three sources differ only in where the markdown is persisted.

Source Persistence Auth
Local localStorage (index + per-note bodies) none (guest)
Saved (DB) Netlify Blobs, namespaced per user sub login required
Git GitHub .md files (existing flow) login required

What changed

  • src/lib/storage.tsNotesStorage interface (list/get/create/save/remove) with LocalNotesStorage + DbNotesStorage; unified NoteRef/NoteData.
  • src/lib/sync.ts — on guest→authenticated, upload each local note via POST /api/notes; a local note is deleted only after its DB create succeeds (partial failure loses nothing).
  • src/components/auth-provider.tsx — adds "guest" status + useAuth() hook ({ status, setStatus, login, logout }); "Continue without logging in" persisted in localStorage["blamy_guest"].
  • src/components/local-mode-banner.tsx — persistent banner in guest mode with a Log in / Register action (existing Auth0 flow).
  • netlify/functions/api.mts + lib/notes.ts — authenticated /api/notes/* CRUD backed by per-user Netlify Blobs.
  • App.tsx — sidebar groups notes by source (Saved this device [guest] / Saved notes [DB] / Git repos); "New note" writes to the active store; git commit/PR flow unchanged.

Acceptance criteria

  • New visitor can skip login, create/edit/delete notes that persist across reloads (localStorage), sees a local-mode banner
  • Banner's Log in / Register runs the existing Auth0 flow
  • After login, prior local notes appear as Saved notes (Netlify Blobs); local index cleared; banner gone; no notes lost on partial-sync failure
  • Authenticated users have working Saved notes (DB): create/list/edit/delete, persist across sessions, private per user
  • Git-backed notes behave exactly as before
  • CI green

Notes: CI builds + deploys previews and runs Replay QA (no lint/typecheck gate). Remaining react-hooks/set-state-in-effect lint findings match the pre-existing editor-seeding pattern already on main.

🔗 Obvious Project · 🧵 Obvious Thread

Give blamy-notes three first-class ways to store a note, all sharing one
markdown content model:

- Local notes — usable with no login, persisted in localStorage. A guest
  mode ("Continue without logging in") shows a local-mode banner with a
  Log in / Register action.
- Saved notes (DB) — markdown persisted server-side in Netlify Blobs,
  namespaced per authenticated user (sub) via new /api/notes/* routes.
- Git notes — the existing GitHub .md flow, unchanged.

On login, all local notes are uploaded to the user's DB store (a local note
is removed only after its DB copy succeeds, so a partial failure loses
nothing) and the banner clears.

New:
- src/lib/storage.ts — NotesStorage interface + Local/Db adapters
- src/lib/sync.ts — guest→authed login sync
- src/components/local-mode-banner.tsx
- netlify/functions/lib/notes.ts — per-user Netlify Blobs CRUD

Changed:
- auth-provider.tsx — "guest" status + useAuth() hook
- api.mts — authenticated /api/notes/* group
- App.tsx — branch sidebar/editor on note source
@obvious-autobuild obvious-autobuild Bot marked this pull request as ready for review June 16, 2026 17:26
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Netlify PR Previews

Base: origin/main
Head: HEAD
PR: #11

Project URL Deploy
blamy-notes replay-notes logs

Replay QA

Project Preview QA Project Result Open Bugs
blamy-notes preview project timed out 0

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.

0 participants