feat: clipboard sync at /clip with supabase auth + realtime#41
Merged
Conversation
Adds an invite-only shared clipboard feature reachable at /clip and via the clip.kaichen.dev subdomain. Users sign in with Google (Supabase Auth, cookie session via @supabase/ssr), see the rooms they're a member of, and within a room get a left-side history list, an editor, and live-syncing of new entries through Supabase Realtime postgres_changes on clipboard_entries. A /clip/admin panel restricted by ADMIN_EMAILS lets the operator create or delete rooms, browse signed-up users, and manage per-room read/write members. Row-level security on clipboards / clipboard_members / clipboard_entries is relied on for browser-side access checks; admin mutations go through service- role server actions. Routing uses the new Next.js 16 proxy.ts (replacing middleware.ts) to refresh the auth cookie on every request and to rewrite clip.kaichen.dev/* → /clip/* so a single Vercel project serves both hosts. Co-authored-by: Claude <noreply@anthropic.com> Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1 task
kaiiiichen
added a commit
that referenced
this pull request
Apr 26, 2026
revert: clipboard sync at /clip (revert #41)
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.
Summary
/clip(andclip.kaichen.devvia subdomain rewrite): Google sign-in (Supabase Auth + cookie session via@supabase/ssr), per-room access controlled through Supabase RLS, and live updates via Supabase Realtimepostgres_changesonclipboard_entries./clip/admin(gated byADMIN_EMAILS): list signed-up users, create/delete rooms, manageread/writemembership through service-role server actions.proxy.ts(the new name formiddleware.ts) that refreshes the Supabase auth cookie on every request and rewritesclip.kaichen.dev/*→/clip/*so a single Vercel project serves both hosts.NEXT_PUBLIC_SUPABASE_ANON_KEY,ADMIN_EMAILS), redirect URLs, and Vercel domain setup inREADME.md+.env.example.Files of note
app/clip/page.tsx— sign-in landing + room list (RLS-scoped query)app/clip/board/[id]/page.tsx+board-realtime.tsx— server data + client realtime UIapp/clip/admin/{page,admin-panel,admin-actions}.tsx— admin-only managementapp/auth/{callback,sign-out}/route.ts— Supabase OAuth flowlib/supabase/{client,server,admin}.ts— three explicit Supabase client variantslib/clip/{admin,types}.ts— admin-email helper + shared typesproxy.ts— session refresh + subdomain rewriteRequired env vars (already present in production except the new ones)
NEXT_PUBLIC_SUPABASE_URL(existing)NEXT_PUBLIC_SUPABASE_ANON_KEY(new — public anon key for cookie auth)SUPABASE_SERVICE_ROLE_KEY(existing)ADMIN_EMAILS(new — comma-separated, e.g.kaichen26@berkeley.edu)Supabase setup (outside this PR)
clipboards,clipboard_members,clipboard_entries) already created.https://kaichen.dev/auth/callback,https://clip.kaichen.dev/auth/callback, andhttp://localhost:3000/auth/callback. Enable the Google provider.clipboard_entriesand ensure RLS policies expose only rows the user is a member of (the browser relies on RLS forSELECT/INSERT).Vercel setup
clip.kaichen.devas a domain on this project. Theproxy.tsrewrite handles routing — no separate project needed.Test plan
npm run lint && npm run typecheck && npm run test && npm run buildall clean (no new warnings introduced)./clip, sign in with Google, get redirected back, see room list (likely empty for a non-admin).ADMIN_EMAILSuser, open/clip/admin, create a room, add yourself withwrite, open the room, post an entry, and verify it appears in another browser/incognito session for a different member in real time./clip/admin(403-style fallback).https://clip.kaichen.dev/after deploy and confirm it serves the/clippage (rewrite works) and the/auth/callbackredirect URL works against that host.Made with Cursor