Add Supabase Auth with OAuth and PostHog identification#269
Open
Add Supabase Auth with OAuth and PostHog identification#269
Conversation
Dokploy Preview Deployment
|
… identification - Add @supabase/supabase-js and @supabase/ssr dependencies - Create browser and server Supabase client utilities - Update middleware to refresh auth sessions on every request - Add /auth/callback route for OAuth code exchange - Add AuthListener component that calls posthog.identify/reset on auth state changes - Create login page with Google, GitHub, X, and Discord OAuth + email/password - Create protected /notifications page (redirects to login if unauthenticated) - Add UserMenu (sign out button) to nav, visible only when logged in - Add French translations for all new strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77cffe9 to
35b876b
Compare
- Add wrangler.jsonc configuration for Cloudflare Workers - Add open-next.config.ts for OpenNext Cloudflare adapter - Add public/_headers for static asset caching - Update next.config.ts with initOpenNextCloudflareForDev() - Add deploy/preview/upload scripts to package.json - Update .gitignore with .open-next and .dev.vars Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
canadaspends | 39e18f3 | Feb 13 2026, 12:15 AM |
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
9317129 to
39e18f3
Compare
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
posthog.identify()on sign-in andposthog.reset()on sign-out/notificationspage that redirects unauthenticated users to loginCloudflare Workers Deployment
New files for Cloudflare Workers deployment via OpenNext:
wrangler.jsonc— Cloudflare Workers configurationopen-next.config.ts— OpenNext Cloudflare adapter configpublic/_headers— Static asset caching headersNew scripts:
pnpm preview— Build and preview locally with Wranglerpnpm deploy— Build and deploy to Cloudflare Workerspnpm upload— Build and upload a versionSetup: Connect repo to Cloudflare Workers Builds in the dashboard for automatic deployments and preview URLs on PRs.
Auth files
src/lib/supabase/client.ts— Browser clientsrc/lib/supabase/server.ts— Server client (cookies-based)src/app/auth/callback/route.ts— OAuth callback handlersrc/components/AuthListener.tsx— PostHog identify/reset on auth state changesrc/components/UserMenu.tsx— Sign out button (hidden when logged out)src/app/[lang]/(main)/login/page.tsx+login-form.tsx— Login pagesrc/app/[lang]/(main)/notifications/page.tsx— Sample protected pageModified files
src/middleware.ts— Supabase session refresh on every requestsrc/app/layout.tsx+src/app/[lang]/layout.tsx— Added AuthListenerDesktopNav.tsx+MobileMenu.tsx— Added UserMenusrc/locales/fr.po— French translations for all new stringsnext.config.ts— AddedinitOpenNextCloudflareForDev().gitignore— Added.open-nextand.dev.varsPrerequisites
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEYset in.envTest plan
/en/login— see login form with 4 OAuth buttons + email/password/en/notificationswhile logged in — see welcome page/en/notificationswhile logged out — redirected to loginpnpm previewto test Cloudflare Workers build locally🤖 Generated with Claude Code