-
Notifications
You must be signed in to change notification settings - Fork 0
Dev/auth #9
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
base: dev/email
Are you sure you want to change the base?
Conversation
…riables and path mappings
…json files - Upgraded dependencies including turbo to ^2.5.0, typescript to 5.8.3, and next to ^15.2.5 across multiple packages. - Updated posthog-js to ^1.235.0 and posthog-node to ^4.11.3 in analytics package. - Incremented @types/react-dom to 19.1.2 in various packages for improved type definitions. - Updated react-email to ^4.0.6 in email package and adjusted tailwindcss and related packages in ui package.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR updates dependency versions across multiple package manifests in various applications and packages. It revises versions for packages such as Next, TypeScript, and several @types libraries. It also reintroduces and adds environment variables for authentication configuration while enhancing the auth client and server by integrating additional plugins for organization management and OpenAPI support. In addition, the PR introduces new database migration scripts and schema updates to create tables for organizations, members, and invitations, along with associated foreign key constraints and journal metadata. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Auth Client Caller
participant AC as createAuthClient
participant OrgPlugin as organizationClient()
participant Infer as inferAdditionalFields()
Client->>AC: Initialize auth client
AC->>OrgPlugin: Load organization plugin
OrgPlugin-->>AC: Plugin ready
AC->>Infer: Load additional fields
Infer-->>AC: Plugin ready
AC-->>Client: Return configured auth client
sequenceDiagram
participant Server as Auth Server
participant BA as betterAuth
participant Org as organization()
participant API as openAPI()
participant Cookies as nextCookies()
Server->>BA: Configure auth with plugins
BA->>Org: Initialize organization plugin
Org-->>BA: Organization plugin ready
BA->>API: Initialize openAPI plugin
API-->>BA: openAPI plugin ready
BA->>Cookies: Initialize nextCookies plugin
Cookies-->>BA: Plugin ready
BA-->>Server: Return configured auth instance
Possibly related PRs
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Integrated organization management into the auth client by adding the organizationClient plugin. - Updated the auth server to include organization and openAPI plugins for improved functionality. - Introduced new database tables for organization, member, and invitation, along with necessary foreign key constraints. - Modified the session table to include activeOrganizationId for better session management.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/auth/.env.example (1)
9-11: Clarify Environment Variable StatusThe file now includes two new variables,
RESEND_FROMandRESEND_TOKEN, which is in line with the PR objectives. However, the PR summary mentioned the reintroduction ofGITLAB_CLIENT_SECRETas an active (uncommented) variable, but line 9 still shows it commented. If the intention is to enable it by default, please remove the leading#; if not, a comment or clarification could be helpful.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
apps/api/package.json(2 hunks)apps/web/package.json(2 hunks)package.json(1 hunks)packages/analytics/package.json(1 hunks)packages/auth/.env.example(1 hunks)packages/auth/client.ts(2 hunks)packages/auth/package.json(1 hunks)packages/auth/server.ts(2 hunks)packages/auth/tsconfig.json(1 hunks)packages/database/migrations/0002_workable_goblin_queen.sql(1 hunks)packages/database/migrations/meta/0002_snapshot.json(1 hunks)packages/database/migrations/meta/_journal.json(1 hunks)packages/database/package.json(1 hunks)packages/database/schema.ts(2 hunks)packages/email/package.json(1 hunks)packages/next-config/package.json(1 hunks)packages/observability/package.json(1 hunks)packages/ui/package.json(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/auth/client.ts (1)
packages/auth/server.ts (1)
auth(11-74)
packages/auth/server.ts (1)
packages/database/schema.ts (1)
organization(59-66)
🔇 Additional comments (28)
packages/database/package.json (1)
26-26: Update TS version in devDependenciesThe TypeScript version was updated from
"^5.8.2"to"^5.8.3", which meets the PR objective of keeping dependency versions consistent across the repository. Please confirm that this version bump has been validated against your build and test suites.packages/auth/tsconfig.json (1)
4-8: Addition of Path AliasesThe addition of
"baseUrl": "."and the new"paths"mappings:
"@/*": ["./*"]"@repo/*": ["../../packages/*"]enhances module resolution and simplifies import paths. Ensure that these aliases align with your project’s folder structure and that import statements across the codebase are updated accordingly.
packages/next-config/package.json (1)
16-16: Update Next.js VersionThe
nextpackage version was updated to"^15.2.5", aligning with other dependency updates in the project. Double-check that this version upgrade is compatible with your custom Next.js configuration and any related plugins.packages/observability/package.json (1)
23-24: Updated Dependency VersionsThe updates to
"@types/react-dom"(from^19.1.1to^19.1.2) and"typescript"(from^5.8.2to^5.8.3) in the devDependencies section are consistent with the changes across the repository. A quick validation to ensure that these minor version bumps do not introduce any breaking changes would be beneficial.packages/email/package.json (1)
27-29: Dependency Version Updates ConfirmedThe updates for
@types/react-dom(from^19.1.1to^19.1.2) andreact-email(from^4.0.5to^4.0.6) are straightforward and consistent with similar updates throughout the repo. Please verify that these minor version bumps do not introduce any unexpected breaking changes.packages/auth/package.json (1)
20-24: Auth Module Dependency EnhancementsThe dependency
"better-auth"has been updated to"1.2.5"and the dev dependency"next"is now set to"^15.2.5". These changes are in line with updates in other parts of the system, which is great for overall consistency. It is recommended to test the auth workflows thoroughly to ensure the new versions integrate smoothly.packages/database/migrations/meta/_journal.json (1)
18-25: New Migration Journal Entry AddedA new journal entry for
"0002_workable_goblin_queen"has been introduced withidx2. This appears to be correctly formatted and consistent with the existing entries. Please ensure that this journal entry accurately maps to the corresponding migration script and that the progression of indices and timestamps remains in sync with your database migration process.apps/web/package.json (1)
20-30: Updated Web App Dependency VersionsThe file now reflects updates for:
"next"bumped to^15.2.5"@types/react-dom"updated to19.1.2"typescript"revised to5.8.3These changes align with similar updates in other modules, ensuring dependency consistency across the project. It would be beneficial to run a complete build and typecheck to confirm that these updates do not introduce any conflicts.
package.json (1)
25-33: Root Package Dependency and Engine UpdatesThe root
package.jsonnow shows:
"turbo"updated from^2.4.4to^2.5.0"typescript"updated from5.8.2to5.8.3"packageManager"changed frombun@1.2.8tobun@1.2.9These updates are consistent with the rest of the repository. Please double-check that the new versions, especially the package manager change, do not require any adjustments to your build or deployment scripts.
packages/auth/client.ts (2)
1-4: Good addition of the organizationClient importThe addition of
organizationClientfrom 'better-auth/client/plugins' aligns well with the server-side implementation which already includes the organization plugin.
16-16: Properly integrated organizationClient pluginThe organizationClient plugin is correctly added to the plugins array, creating a complete implementation of organization features between the client and server sides.
I recommend verifying that the organization features work as expected from both client and server perspectives after this integration.
apps/api/package.json (1)
15-15: Appropriate dependency updatesThese dependency updates to Next.js, TypeScript, and React DOM types are all minor version increments that align with the PR objectives. These types of updates typically include bug fixes and minor improvements without introducing breaking changes.
Also applies to: 24-25
packages/analytics/package.json (1)
15-16: Analytics dependency updates look goodThe updates to PostHog libraries (posthog-js, posthog-node) and React DOM types are minor version increments that should provide bug fixes and improvements while maintaining backward compatibility.
Also applies to: 24-24
packages/auth/server.ts (3)
8-8: Good addition of organization and OpenAPI pluginsThe import of
openAPIandorganizationplugins from 'better-auth/plugins' is appropriate and matches the needs described in the PR objectives.
11-11: Improved type safety with explicit return typeAdding the explicit return type
ReturnType<typeof betterAuth>enhances the type safety of the codebase, making it more maintainable and reducing the chance of type-related errors.
73-73: Properly configured auth pluginsThe updated plugins array correctly integrates organization and OpenAPI features while preserving the existing NextCookies functionality. This change aligns with the client-side changes and creates a complete implementation of these features.
I recommend verifying that the organization functionality works correctly with the existing database schema (from the database/schema.ts file that defines the organization table) and that the OpenAPI integration provides the expected documentation.
packages/database/migrations/meta/0002_snapshot.json (1)
1-559: Database migration snapshot looks well-structuredThis snapshot properly captures the schema changes including new tables for organizations, members, and invitations with their respective relationships. The foreign key constraints are properly set up with cascade delete behavior where appropriate.
A few observations:
- Organization and membership data model enables multi-tenancy
- Session table now tracks active organization context
- Foreign key relationships maintain referential integrity
packages/database/schema.ts (4)
28-29: Session table properly extended with organization contextAdding
activeOrganizationIdto the session table enables users to switch between organizations in a multi-tenant setup.
59-66: Organization table structure is appropriateThe organization table includes all essential fields (id, name, slug) with appropriate constraints. The unique constraint on slug will ensure organization URLs remain distinct.
68-78: Member table correctly implements many-to-many relationshipThe member table properly establishes the relationship between users and organizations with appropriate cascade delete behavior. This will ensure database integrity when deleting either users or organizations.
80-92: Invitation table structure is well-designedThe invitation table includes all necessary fields for managing organization invitations, including expiry and status tracking. Cascade delete behavior ensures no orphaned invitations when organizations or users are deleted.
packages/database/migrations/0002_workable_goblin_queen.sql (4)
1-9: Invitation table creation looks correctThe SQL for creating the invitation table matches the schema definition with appropriate constraints.
11-17: Member table creation looks correctThe SQL for creating the member table matches the schema definition with appropriate constraints.
19-27: Organization table creation looks correctThe SQL for creating the organization table matches the schema definition with appropriate constraints, including the unique constraint on the slug field.
29-33: Foreign key constraints are properly establishedThe migration script correctly adds the necessary foreign key constraints, ensuring referential integrity between the new tables and existing ones. The cascade delete behavior is appropriately set.
packages/ui/package.json (3)
20-25: Dev dependencies updated to newer versionsThese dependency updates align with the PR objectives to update packages across the project.
29-54: Radix UI components updated to latest minor versionsThe updates to Radix UI component dependencies will provide bug fixes and improvements. These are minor version updates, so they should maintain backward compatibility.
58-70: Other UI dependencies updatedUpdates to embla-carousel-react and tailwind-merge should provide bug fixes and performance improvements.
…avigation components - Added Header, Footer, and Navigation components to the authenticated layout for improved user experience. - Integrated avatar display in the Header using the new avatar service. - Updated layout structure to include the new components, ensuring a cohesive design. - Introduced no-scrollbar utility in global styles for better aesthetics.
…n handling - Replaced the fetch call for session retrieval with a direct cookie extraction method. - Consolidated route protection logic into a single function for clarity. - Enhanced error handling to ensure consistent redirection to the login page.
This pull request includes multiple dependency updates across various packages to ensure compatibility and leverage the latest features and bug fixes. The most important changes include updating the
nextandtypescriptversions in multiple packages, adding new environment variables to the authentication package, and updating various@radix-uidependencies in the UI package.Dependency updates:
nextto version15.2.5inapps/api/package.json,apps/web/package.json,packages/auth/package.json, andpackages/next-config/package.json. [1] [2] [3] [4]typescriptto version5.8.3inapps/api/package.json,apps/web/package.json,package.json,packages/database/package.json,packages/observability/package.json, andpackages/ui/package.json. [1] [2] [3] [4] [5] [6]Environment variables:
RESEND_FROMandRESEND_TOKENenvironment variables topackages/auth/.env.example.UI package updates:
@radix-uidependencies to their latest versions inpackages/ui/package.json.Other notable updates:
posthog-jsto version1.235.0andposthog-nodeto version4.11.3inpackages/analytics/package.json.turboto version2.5.0andbunto version1.2.9inpackage.json.Summary by CodeRabbit
New Features
Chores