Skip to content

Implement neon authentication middleware and refactor session management - #6

Closed
Waterkyuu wants to merge 15 commits into
mainfrom
feat/middleware
Closed

Implement neon authentication middleware and refactor session management#6
Waterkyuu wants to merge 15 commits into
mainfrom
feat/middleware

Conversation

@Waterkyuu

Copy link
Copy Markdown
Owner

No description provided.

Waterkyuu added 15 commits April 7, 2026 06:06
Split monolithic auth module into separate client and server boundaries
Add catch-all auth api route handler
Initialize neon database and cloudflare r2 infrastructure clients
Update root middleware route matching patterns
Add @neondatabase/auth beta dependency
…e-based session

- Replace @neondatabase/neon-js client with @neondatabase/auth/next createAuthClient
- Use authClient.useSession() hook in providers for reactive session sync
- Rewrite services/user.ts to use authClient for OTP and OAuth
- Rename middleware.ts to proxy.ts (Next.js 16 convention) with auth.middleware()
- Remove localStorage token management from api-client.ts
- Session now stored in HTTP-only cookies, enabling server-side middleware auth
Remove deprecated client-side neon auth client implementation
Delete unused proxy auth handler
Standardise neon auth environment variable names
Add explicit session validation flow for protected routes
- Move auth check to middlewares/auth.ts as standalone middleware
- Use middleware chain pattern in middleware.ts for extensibility
- Check session via auth.getSession() and redirect unauthenticated users
Correct authentication environment variable names in both English
and Chinese documentation. Replace deprecated configuration keys
with the new required NEON_AUTH_BASE_URL and NEON_AUTH_COOKIE_SECRET
values for project setup instructions.
@Waterkyuu Waterkyuu closed this Apr 6, 2026
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