-
Notifications
You must be signed in to change notification settings - Fork 0
release: Better Auth migration and Spec-kit framework adoption #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BREAKING CHANGE: Authentication system migrated from NextAuth.js v5 to Better Auth - Implement Better Auth with Google OAuth - Add Better Auth server config (src/lib/auth.ts) - Add Better Auth client (src/lib/auth-client.ts) - Configure MongoDB adapter for Better Auth - Add auth API route handler ([...all]/route.ts) - Separate User and Profile entities - User: Authentication data (Better Auth managed) - Profile: Business data (teams, preferences) - Add Profile repository and schema - Auto-create profile on first access - Update all API routes to use Better Auth session - Replace auth() with auth.api.getSession() - Standardize session checks (session?.user) - Implement email-based team inviting with User lookup - Update components for Better Auth - Use authClient for sign-in flow - Add error handling to Home component - Remove SessionProvider wrapper - Documentation and migration - Update CLAUDE.md with Better Auth flow - Archive migration script with documentation - Add migration guide in docs/archive/migrations/ Tests passing. Build has pre-existing TypeScript error in info-form.tsx (unrelated to this migration, tracked for future fix).
…rors - Migrate from `.eslintrc.json` to `eslint.config.mjs` (ESLint 9) - Configure Next.js core web vitals and TypeScript rules - Add Storybook, Testing Library, and Jest DOM plugins - Set custom rules for Clean Architecture patterns - Add global ignores including archived migrations - Fix `info-form.tsx` TypeScript compilation error - Add explicit Resolver type assertion - Enhance decidingSetPoints schema with .int() - Modernize `next.config.js` - Convert from CommonJS to ES modules - Simplify phase-based logic - Use `process.env.NODE_ENV` for environment detection - Improve UI component types - Add `ChartTooltipContentProps` interface - Fix Recharts ResponsiveContainer warning with minHeight - Optimize database schemas - Remove duplicate index definition in profile schema Build and tests passing. ESLint warnings are pre-existing issues tracked in `docs/stories/better-auth-follow-up.md`.
Implement automatic Profile creation when User is created via OAuth, following Clean Architecture principles with Use Cases, Controllers, and proper DI integration. Key Changes: - Add Profile Use Cases (Get, Create, Update) with InversifyJS DI - Add Profile Controllers for orchestrating Use Cases - Integrate Better Auth databaseHooks.user.create.after - Refactor /api/profiles to use Controllers (remove direct Mongoose) - Add fallback mechanism for reliability Architecture Improvements: - Remove direct Mongoose operations from API routes - Implement Controller → Use Case → Repository pattern - Maintain business logic in Use Cases (duplicate checks) - Non-blocking design (profile creation failure doesn't block login) Documentation: - Add comprehensive User Management docs (index, flow, sync) - Document design decisions (User vs Profile separation) - Update architecture docs (source tree) - Add future planning (custom name/image fields) Testing: - Build: ✅ Passing - Lint: ✅ No errors in modified files - Manual testing: Passed
Implement Clean Architecture validation layers for Profile API endpoints: - Controller Layer: Format and transport validation using Zod schemas - Add UpdateProfileRequestSchema for request format validation - Add ValidationError class for format validation errors - Validate teams, info, preferences data types and structure - Use Case Layer: Business rules validation - Prevent updates to immutable fields (userId, _id) - Validate Profile existence before updates - Ensure teams arrays are properly formatted - Add BusinessRuleError class for business logic errors - API Route Layer: Error handling and HTTP response formatting - Remove direct userId validation (migrated to Use Case) - Add proper error handling for ValidationError and BusinessRuleError - Return appropriate HTTP status codes (400 for validation/business errors) Files changed: - src/interface/controllers/user/profile.controller.ts - src/applications/usecases/user/profile.usecase.ts - src/app/api/profiles/route.ts
…okies - Create User component at src/components/user/index.tsx - Replace server-side sign-out with authClient.signOut() for proper cookie cleanup - Use client-side navigation (useRouter) instead of server-side redirect - Simplify user page to only render User component Server-side sign-out with redirect failed to clear Better Auth session cookies, causing incomplete logout. Client-side authClient.signOut() properly clears all authentication state and cookies before navigation.
feat(auth): migrate from NextAuth.js to Better Auth
Remove BMad development framework files: - Remove .bmad-core/ agent teams, agents, checklists, tasks, templates, workflows - Remove .claude/commands/BMad/ agent definitions and tasks - Remove .gemini/bmad-method/ configuration Add Spec-kit framework for feature development: - Add .specify/memory/constitution.md (v1.0.0) establishing five core principles - Add .specify/templates/ for spec, plan, tasks, checklist, and agent file templates - Add .specify/scripts/bash/ helper scripts for prerequisites, feature creation, and setup - Update .gitignore to exclude AI agent directories
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @andrewck24's task —— View job PR Review Complete: Better Auth Migration and Spec-kit Framework AdoptionI've conducted a comprehensive review of this major migration PR. Here's my analysis: ✅ Code Quality Assessment: EXCELLENTThis is a well-executed migration that demonstrates strong architectural discipline and attention to detail. Strengths1. Clean Architecture Implementation 🏛️
Example: 2. Security Best Practices 🔐
Security concern addressed: 3. Robust Error Handling ⚡
4. ESLint Modernization 🛠️
Technical Improvements1. Database Architecture 📊// BEFORE: Coupled authentication and business data
User: { email, teams, info, preferences }
// AFTER: Separated concerns
User: { email, name, image, emailVerified } // Auth data
Profile: { userId, teams: {joined[], inviting[]} } // Business dataThis separation enables:
2. API Route Quality 🌐The TypeScript migration of API routes shows significant quality improvements:
3. Framework Migration Excellence 📋The BMad → Spec-kit migration is thorough:
🔍 Potential Issues & RecommendationsMinor Security Considerations
Performance Considerations
Code Quality Improvements
Test Coverage GapsBased on
📋 Migration Completeness✅ Completed Successfully
|
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
1 similar comment
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
This release contains two major updates to the VolleyBro codebase:
Major Changes
1. Authentication Framework Migration (PR #264)
Core Authentication Updates
auth.ts) and client-side (auth-client.ts) authenticationUser-Profile Separation Architecture
Clean Architecture Implementation
GetProfileUseCase,CreateProfileUseCase,UpdateProfileUseCasegetProfileController,createProfileController,updateProfileControllerAPI Refactoring
/api/profilesto use controllers and use cases following layered architecture/api/teamsand/api/membersroutes from.jsto.tsESLint Modernization
.eslintrc.jsonto flat config (eslint.config.mjs)Comprehensive Documentation
2. Development Framework Migration
Spec-kit Framework Adoption
.bmad-core/,.claude/commands/BMad/, and.gemini/bmad-method/directories.specify/directory with new framework structure:check-prerequisites.sh,create-new-feature.sh,setup-plan.sh,update-agent-context.shagent-file-template.md,checklist-template.md,plan-template.md,spec-template.md,tasks-template.mdmemory/constitution.mdBenefits of Spec-kit
Database Changes
User Collection
teams,info,preferencesemailVerifiedchanged from Date to booleanemail,name,imageProfile Collection (New)
userId,teams.joined[],teams.inviting[]Breaking Changes
Environment Variables
AUTH_SECRET,NEXTAUTH_URLBETTER_AUTH_SECRET,BETTER_AUTH_URLSession Structure
auth.api.getSession()for validationAPI Changes
/api/profilesendpointDependencies
Added
[email protected][email protected]Removed
[email protected]@auth/[email protected]Test Plan
npm run build)npm run lint)Known Issues & Follow-up Tasks
Files Changed
摘要
此版本包含兩項主要更新:
1. 驗證系統遷移(PR #264)
核心驗證更新
User-Profile 分離架構
Clean Architecture 實作
GetProfileUseCase,CreateProfileUseCase,UpdateProfileUseCasegetProfileController,createProfileController,updateProfileControllerAPI 重構
/api/profiles使用 controllers 與 use cases,遵循分層架構/api/teams與/api/members從.js遷移至.tsESLint 現代化
.eslintrc.json遷移至 flat config (eslint.config.mjs)完整文件
2. 開發框架遷移
採用 Spec-kit 框架
.bmad-core/、.claude/commands/BMad/、.gemini/bmad-method/目錄(-26,287 行).specify/目錄,包含:Spec-kit 優勢
資料庫變更
User Collection
teams,info,preferencesemailVerified從 Date 改為 booleanemail,name,imageProfile Collection(新增)
userId,teams.joined[],teams.inviting[]重大變更
環境變數
AUTH_SECRET,NEXTAUTH_URLBETTER_AUTH_SECRET,BETTER_AUTH_URLSession 結構
auth.api.getSession()驗證API 變更
/api/profilesendpoint 存取檔案變更
已知問題與後續任務