Skip to content

Feat/auth component support - #531

Merged
Leo-rq-yu merged 10 commits into
feat/email-servicefrom
feat/auth-component-support
Oct 28, 2025
Merged

Leo-rq-yu merged 10 commits into
feat/email-servicefrom
feat/auth-component-support

Conversation

@Leo-rq-yu

@Leo-rq-yu Leo-rq-yu commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Summary

Introduced a built-in authentication system for cloud hosting users.

How did you test this change?

Required to use @insforge/nextjs package to build a NextJS application locally, and then connect with the insforge agent locally.
Then choose to use built-in auth components, which will redirect every sign-in and sign-up request to this built-in page.
It will redirect the user to their page after successful authentication.

image image

Summary by CodeRabbit

  • New Features

    • Sign In and Sign Up pages with email normalization, token redirect support, and OAuth sign-in/signup flows
    • New auth UI components: form field, password field (visibility toggle + forgot link), password strength indicator, OAuth provider buttons (responsive grid + loading states), and submit button
    • Password strength validator utility exposed
    • OAuth provider list endpoint is now publicly accessible
  • UI/UX Improvements

    • Client-side routing now serves /auth/* SPA routes
    • Added Manrope font family and stricter password validation rules
  • Documentation

    • New Next.js auth UI components guide added to docs

@coderabbitai

coderabbitai Bot commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Exposes the OAuth configs endpoint publicly, adds SPA routing for /auth* on the server, and implements a frontend auth feature set: SignIn/SignUp pages, reusable auth components (form fields, password/strength, submit, OAuth providers), validation schemas, small CSS update, and docs entry.

Changes

Cohort / File(s) Summary
Backend OAuth API
backend/src/api/routes/auth.oauth.ts
Made GET /api/auth/oauth/configs public by removing admin middleware and changing handler signature from AuthRequest to Request; response shape and logging remain.
Backend SPA Routing
backend/src/server.ts
Added SPA catch-all for /auth* to serve index.html so client-side auth routes load the SPA.
Frontend Auth Components
frontend/src/features/auth/components/*
frontend/src/features/auth/components/AuthFormField.tsx, AuthPasswordField.tsx, AuthPasswordStrengthIndicator.tsx, AuthSubmitButton.tsx, AuthOAuthProviders.tsx
New reusable components: labeled form field, password field with visibility toggle and optional strength indicator, password strength indicator + validatePasswordStrength export, submit button with loading state, and OAuth providers grid with dynamic display modes.
Frontend Components Barrel
frontend/src/features/auth/components/index.ts
New barrel re-exporting the auth components and validatePasswordStrength.
Frontend Auth Pages
frontend/src/features/auth/page/*
frontend/src/features/auth/page/SignInPage.tsx, frontend/src/features/auth/page/SignUpPage.tsx
New SignIn/SignUp pages that fetch /api/auth/oauth/configs, support credential and OAuth flows (/api/auth/oauth/{provider}), client validation, token redirect handling, and loading/error states.
Frontend Routing
frontend/src/lib/routing/AppRoutes.tsx
Added /auth route block with nested /auth/signin, /auth/signup, and catch-all redirect to signin.
Frontend Styling
frontend/src/index.css
Added CSS custom property --fontFamilyManrope: 'Manrope', sans-serif under :root.
Frontend OAuth Helpers
frontend/src/features/auth/helpers.tsx
Adjusted provider icon classes: removed dark text class for Microsoft; added explicit color classes for Discord.
Validation Schemas
frontend/src/lib/utils/validation-schemas.ts
Added strongPasswordSchema, signInFormSchema, signUpFormSchema, exported types SignInFormData/SignUpFormData, and alias loginFormSchema = signInFormSchema.
Docs / Navigation
docs/core-concepts/authentication/ui-components/nextjs.mdx, docs/docs.json
Added Next.js UI Components docs page and registered it in docs.json navigation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant FrontendApp
    participant Backend
    participant OAuthProvider

    rect rgba(200,220,255,0.6)
    Note over User,FrontendApp: Load auth UI
    User->>Browser: Navigate to /auth/signin or /auth/signup
    Browser->>FrontendApp: SPA route -> Sign page
    FrontendApp->>Backend: GET /api/auth/oauth/configs
    Backend-->>FrontendApp: provider list
    FrontendApp-->>User: render form + provider buttons
    end

    rect rgba(220,240,220,0.6)
    Note over User,Backend: Email/password flow
    User->>FrontendApp: Submit credentials
    FrontendApp->>Backend: POST /api/auth/sessions or /api/auth/users
    Backend-->>FrontendApp: access_token
    FrontendApp->>Browser: redirect (append access_token)
    end

    rect rgba(255,235,205,0.6)
    Note over User,OAuthProvider: OAuth flow
    User->>FrontendApp: Click provider
    FrontendApp->>Backend: GET /api/auth/oauth/{provider}?redirect_uri=...
    Backend-->>FrontendApp: provider authUrl
    FrontendApp->>Browser: redirect -> OAuthProvider
    OAuthProvider-->>Backend: callback with code
    Backend-->>Browser: final redirect with access_token
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention areas:
    • Public exposure and auth implications in backend/src/api/routes/auth.oauth.ts
    • Redirect/token-in-URL behavior in frontend/src/features/auth/page/*
    • OAuth initiation and error handling paths
    • Accessibility and responsive layout in AuthOAuthProviders.tsx and password components

Possibly related PRs

Suggested reviewers

  • Fermionic-Lyu
  • tonychang04

Poem

🐰 I hopped to add a field and button bright,

OAuth buttons gleam in morning light,
Strength checks whisper "strong" or "try again",
Routes now lead where sign-in journeys begin,
A tiny font, a hop, and—done—what a sight! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Feat/auth component support" is directly related to the main changes in this pull request, which introduce a comprehensive set of authentication components and infrastructure. The changeset includes multiple new authentication UI components (SignInPage, SignUpPage, form fields, password strength indicator, submit button, and OAuth provider grid), backend endpoint changes to support public OAuth config access, frontend routing for /auth paths, validation schemas for sign-in/sign-up, and documentation. The title appropriately captures that the core contribution is adding built-in authentication component support for cloud hosting users. While the word "support" could be slightly more specific, the term "auth component support" together is sufficiently clear and descriptive for a developer scanning pull request history to understand the primary purpose of these changes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (12)
frontend/src/features/auth/components/AuthPasswordField.tsx (4)

52-59: Input className from consumers is being dropped

Because you destructure className for the wrapper, Input’s className from props is overridden by "pr-10". Expose a dedicated inputClassName and merge via cn to avoid losing consumer styles.

Apply:

- interface AuthPasswordFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
+ interface AuthPasswordFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
   label?: string;
   showStrengthIndicator?: boolean;
   forgotPasswordLink?: {
     href: string;
     text?: string;
   };
+  inputClassName?: string;
 }
@@
-export function AuthPasswordField({
+export function AuthPasswordField({
   label = 'Password',
   id,
-  className,
+  className,
   showStrengthIndicator = false,
   forgotPasswordLink,
   value,
   onFocus,
+  inputClassName,
   ...props
 }: AuthPasswordFieldProps) {
@@
-        <Input
+        <Input
           {...props}
           id={id}
           type={showPassword ? 'text' : 'password'}
-          className="pr-10"
+          className={cn('pr-10', inputClassName)}
           value={value}
           onFocus={handleFocus}
         />

60-67: Improve toggle accessibility

Expose pressed state for assistive tech.

-        <button
+        <button
           type="button"
           onClick={() => setShowPassword(!showPassword)}
           className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
-          aria-label={showPassword ? 'Hide password' : 'Show password'}
+          aria-label={showPassword ? 'Hide password' : 'Show password'}
+          aria-pressed={showPassword}
         >

1-7: Generate a stable id when none is passed

Use React’s useId so Label htmlFor always matches Input, avoiding duplicate-id and missing-id issues.

-import { useState } from 'react';
+import { useId, useState } from 'react';
@@
 export function AuthPasswordField({
   label = 'Password',
   id,
@@
 }: AuthPasswordFieldProps) {
+  const generatedId = useId();
+  const inputId = id ?? generatedId;
@@
-          <Label htmlFor={id} className="text-sm font-medium text-gray-700 dark:text-gray-300">
+          <Label htmlFor={inputId} className="text-sm font-medium text-gray-700 dark:text-gray-300">
             {label}
           </Label>
@@
-          id={id}
+          id={inputId}

Also applies to: 17-26, 40-55


45-49: Router-friendly forgot password navigation

If href points to an internal route, prefer from react-router to avoid full page reloads. If external, keep but add rel="noopener noreferrer" when target="_blank".

frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)

84-87: Grid span shorthand may not span as intended

gridColumn: 'span 2' can be ambiguous; use 'span 2 / span 2' to ensure 2-column span, or Tailwind col-span-* classes.

-      return { gridColumn: 'span 2' };
+      return { gridColumn: 'span 2 / span 2' };
@@
-      return { gridColumn: 'span 2' };
+      return { gridColumn: 'span 2 / span 2' };
@@
-      return { gridColumn: 'span 2' };
+      return { gridColumn: 'span 2 / span 2' };

Alternatively, compute className "col-span-2|3|6" and drop inline styles for better readability and theming consistency.

Also applies to: 99-121

frontend/src/features/auth/page/SignUpPage.tsx (3)

126-132: UI nits: Tailwind class and width token

  • bg-linear-to-br isn’t a Tailwind utility; use bg-gradient-to-br.
  • w-21 isn’t a default width token; use an arbitrary value or nearest scale.
-    <div className="min-h-screen flex items-center justify-center bg-linear-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
+    <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
@@
-          <a href="https://insforge.dev" target="_blank" rel="noopener noreferrer">
-            <InsForgeLogo className="w-21 h-5" />
+          <a href="https://insforge.dev" target="_blank" rel="noopener noreferrer">
+            <InsForgeLogo className="w-[84px] h-5" />
           </a>

Also applies to: 208-214


29-41: Prefer TanStack Query for server state

Fetching providers on mount bypasses the shared cache and retry/timeout policies. Use useQuery with a keyed cache and proper error UI, per repo guidelines.


143-176: Forms: adopt React Hook Form + Zod for validation

Manual state + regex validation is fine short-term but diverges from the project’s form stack and makes reuse harder. Consider RHF + Zod for consistent rules and error messaging.

frontend/src/features/auth/components/AuthSubmitButton.tsx (1)

18-29: Expose busy state to assistive tech

Add aria-busy and aria-live so screen readers get progress feedback.

-    <Button
+    <Button
       {...props}
       type="submit"
       disabled={disabled || isLoading}
+      aria-busy={!!isLoading}
+      aria-live="polite"
       className={cn(
         'mt-4 px-4 py-2 rounded w-full h-10 bg-black hover:bg-gray-800 dark:bg-white dark:hover:bg-gray-200 dark:text-black',
         className
       )}
     >
-      {isLoading && <Loader2 className="w-4 h-4 animate-spin" />}
+      {isLoading && <Loader2 className="w-4 h-4 animate-spin" aria-hidden="true" />}
       {children}
     </Button>
frontend/src/features/auth/page/SignInPage.tsx (3)

115-121: UI nits: Tailwind gradient and width token

Fix the gradient utility and logo width token.

-    <div className="min-h-screen flex items-center justify-center bg-linear-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
+    <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
@@
-            <InsForgeLogo className="w-21 h-5" />
+            <InsForgeLogo className="w-[84px] h-5" />

Also applies to: 194-199


28-41: Prefer TanStack Query for providers

Use useQuery for '/api/auth/oauth/configs' with caching and error states.


132-158: Adopt React Hook Form + Zod for input and validation

Align with project stack for consistency and better UX/accessibility.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d014a3 and e3143f0.

⛔ Files ignored due to path filters (6)
  • frontend/src/assets/logos/apple.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/discord.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/instagram.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/spotify.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/tiktok.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/x.svg is excluded by !**/*.svg
📒 Files selected for processing (13)
  • backend/src/api/routes/auth.oauth.ts (1 hunks)
  • backend/src/server.ts (1 hunks)
  • frontend/src/features/auth/components/AuthFormField.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthMethodTab.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthPasswordField.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthSubmitButton.tsx (1 hunks)
  • frontend/src/features/auth/components/index.ts (1 hunks)
  • frontend/src/features/auth/page/SignInPage.tsx (1 hunks)
  • frontend/src/features/auth/page/SignUpPage.tsx (1 hunks)
  • frontend/src/index.css (1 hunks)
  • frontend/src/lib/routing/AppRoutes.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • backend/src/server.ts
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/index.ts
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • backend/src/api/routes/auth.oauth.ts
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
frontend/src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{tsx,ts}: Use functional React components with hooks exclusively
Use Radix UI primitives for accessibility
Optimize React component re-renders

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/index.ts
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
frontend/src/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.tsx: Implement TypeScript interfaces/types for all component props
Follow component composition patterns; keep components focused and single-purpose
Implement proper loading and error states in UI
Use a consistent icon set from lucide-react

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{ts,tsx}: Use TanStack Query for server state management
Use React Hook Form for form handling with Zod validation
Optimize bundle size with proper imports

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/index.ts
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

React components and TypeScript types/interfaces must use PascalCase

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • backend/src/server.ts
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/index.ts
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • backend/src/api/routes/auth.oauth.ts
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
frontend/src/**/[A-Z]*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Component files must use PascalCase filenames (e.g., DataGrid.tsx)

Files:

  • frontend/src/features/auth/components/AuthFormField.tsx
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/features/auth/components/AuthMethodTab.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
backend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/**/*.{ts,tsx}: Use async/await for asynchronous operations in the backend
Use Zod schemas for request/response validation
Return consistent API responses using utility functions
Validate all user inputs
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper caching strategies (server-side)

Files:

  • backend/src/server.ts
  • backend/src/api/routes/auth.oauth.ts
**/[a-z][a-z0-9-]*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Utility files should use kebab-case or camelCase (kebab-case validated here)

Files:

  • backend/src/server.ts
  • frontend/src/features/auth/components/index.ts
  • backend/src/api/routes/auth.oauth.ts
backend/src/api/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/api/**/*.ts: Implement authentication and error-handling middleware
Follow RESTful conventions for API endpoints
Implement rate limiting for API endpoints

Files:

  • backend/src/api/routes/auth.oauth.ts
🧬 Code graph analysis (8)
frontend/src/features/auth/components/AuthFormField.tsx (1)
frontend/src/lib/utils/utils.ts (1)
  • cn (19-21)
frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (1)
frontend/src/features/auth/components/index.ts (2)
  • validatePasswordStrength (5-5)
  • AuthPasswordStrengthIndicator (4-4)
frontend/src/features/auth/components/AuthPasswordField.tsx (2)
frontend/src/lib/utils/utils.ts (1)
  • cn (19-21)
frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (1)
  • AuthPasswordStrengthIndicator (44-62)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (3)
shared-schemas/src/auth.schema.ts (1)
  • OAuthProvidersSchema (107-107)
frontend/src/features/auth/components/index.ts (1)
  • AuthOAuthProviders (8-8)
frontend/src/components/radix/Button.tsx (1)
  • Button (50-50)
frontend/src/lib/routing/AppRoutes.tsx (2)
frontend/src/features/auth/page/SignInPage.tsx (1)
  • SignInPage (17-203)
frontend/src/features/auth/page/SignUpPage.tsx (1)
  • SignUpPage (17-218)
frontend/src/features/auth/page/SignInPage.tsx (6)
shared-schemas/src/auth.schema.ts (2)
  • OAuthProvidersSchema (107-107)
  • OAuthConfigSchema (106-106)
shared-schemas/src/auth-api.schema.ts (1)
  • ListOAuthConfigsResponse (191-191)
frontend/src/features/auth/components/AuthFormField.tsx (1)
  • AuthFormField (9-20)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)
  • AuthPasswordField (17-74)
frontend/src/features/auth/components/AuthSubmitButton.tsx (1)
  • AuthSubmitButton (10-31)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)
  • AuthOAuthProviders (46-148)
frontend/src/features/auth/page/SignUpPage.tsx (6)
shared-schemas/src/auth.schema.ts (2)
  • OAuthProvidersSchema (107-107)
  • OAuthConfigSchema (106-106)
shared-schemas/src/auth-api.schema.ts (1)
  • ListOAuthConfigsResponse (191-191)
frontend/src/features/auth/components/AuthFormField.tsx (1)
  • AuthFormField (9-20)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)
  • AuthPasswordField (17-74)
frontend/src/features/auth/components/AuthSubmitButton.tsx (1)
  • AuthSubmitButton (10-31)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)
  • AuthOAuthProviders (46-148)
frontend/src/features/auth/components/AuthSubmitButton.tsx (3)
frontend/src/features/auth/components/index.ts (1)
  • AuthSubmitButton (7-7)
frontend/src/components/radix/Button.tsx (1)
  • Button (50-50)
frontend/src/lib/utils/utils.ts (1)
  • cn (19-21)
🔇 Additional comments (14)
backend/src/server.ts (1)

262-264: LGTM! SPA routing for authentication paths.

The new catch-all route for /auth* paths is correctly implemented and consistent with the existing patterns for /cloud* and /dashboard* routes. This ensures the frontend SPA can handle client-side routing for the new authentication pages.

frontend/src/features/auth/components/AuthMethodTab.tsx (3)

41-41: LGTM! Icon styling update.

The Microsoft icon styling has been simplified by removing the dark:text-white class, likely for better visual consistency with the component's design system.


48-48: LGTM! Explicit Discord brand color.

The Discord icon now uses explicit blue color (text-[#3E4CD7]) for both light and dark modes, ensuring brand consistency.


55-55: LGTM! Icon styling simplification.

The LinkedIn icon styling has been simplified by removing explicit text color classes, likely relying on default or inherited colors for better consistency.

frontend/src/lib/routing/AppRoutes.tsx (2)

18-19: LGTM! Import statements for authentication pages.

The new imports for SignInPage and SignUpPage are correctly added and follow the project's import conventions.


26-36: LGTM! Public authentication routes correctly configured.

The new /auth/* routing block is properly implemented:

  • Not wrapped in RequireAuth (correctly public)
  • Includes default redirect to /auth/signin
  • Has catch-all redirect for unknown paths
  • Uses nested Routes pattern consistent with other route groups
frontend/src/features/auth/components/index.ts (1)

1-8: LGTM! Clean barrel exports for auth components.

The barrel file properly consolidates exports for the new authentication components, improving import ergonomics across the codebase.

frontend/src/features/auth/components/AuthFormField.tsx (1)

1-20: LGTM! Well-structured reusable form field component.

The AuthFormField component is properly implemented:

  • Correctly extends React.InputHTMLAttributes for full input prop support
  • Uses Radix UI components for accessibility
  • Conditionally renders label when provided
  • Properly forwards all props to the Input component
  • Follows project coding guidelines (functional component, TypeScript, proper naming)
frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (3)

34-39: LGTM! Clear validation utility.

The validatePasswordStrength function correctly validates that a password meets all requirements. The empty password check prevents false positives.


44-62: LGTM! Clear visual feedback component.

The component provides clear visual feedback by displaying each requirement with a check icon when satisfied or an empty circle when not. The implementation is straightforward and accessible.


12-29: LGTM! Comprehensive password requirements.

The password requirements array defines four clear validation rules:

  • Uppercase letter
  • Number
  • Special character (comprehensive regex)
  • Minimum 8 characters

Ensure these frontend password requirements match the backend validation rules to prevent inconsistencies between client-side and server-side validation.

frontend/src/index.css (1)

63-63: Verify that the Manrope font is properly loaded.

The new font variable --fontFamilyManrope is defined, but ensure the Manrope font is imported via a @font-face rule or Google Fonts link. Based on the relevant code snippets, the new auth pages use font-manrope class, so the font must be available.

Run the following script to check if Manrope is imported:

backend/src/api/routes/auth.oauth.ts (1)

482-496: Verify that sensitive OAuth credentials are not exposed in the public endpoint.

The /api/auth/oauth/configs endpoint has been changed from admin-only to public access, which is necessary for the frontend sign-in/sign-up pages to display available OAuth providers. However, ensure that the response does NOT include sensitive information such as clientSecret.

Run the following script to verify that getAllConfigs() doesn't return client secrets:

Additionally, verify that the individual provider config endpoint (line 499-525) remains admin-protected, as it includes clientSecret on line 509.

frontend/src/features/auth/page/SignUpPage.tsx (1)

100-107: Reset oauthLoading on success navigation fallback

If the backend responds with an error page instead of redirect, oauthLoading may remain set after user navigates back. Consider clearing it in a finally block.

Also applies to: 118-123

@Leo-rq-yu
Leo-rq-yu force-pushed the feat/auth-component-support branch from 3f7fd1e to 04e577e Compare October 28, 2025 00:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
backend/src/api/routes/auth.oauth.ts (3)

251-305: Validate and allow‑list redirect_uri; consider rate limiting init

redirect_uri is trusted and embedded into state without origin checks. Validate scheme (http/https), normalize against a known base, and enforce an allow‑list. Also, add rate limiting on OAuth init to reduce abuse.

Apply helper and usage:

@@
 router.get('/:provider', async (req: Request, res: Response, next: NextFunction) => {
   try {
     const { provider } = req.params;
-    const { redirect_uri } = req.query;
+    const { redirect_uri } = req.query;
@@
-    if (!redirect_uri) {
+    if (!redirect_uri) {
       throw new AppError('Redirect URI is required', 400, ERROR_CODES.INVALID_INPUT);
     }
@@
-    const jwtPayload = {
+    const safeRedirect = parseAndValidateRedirectUri(
+      String(redirect_uri),
+      `${req.protocol}://${req.get('host')}`
+    );
+    const jwtPayload = {
       provider: validatedProvider,
-      redirectUri: redirect_uri ? (redirect_uri as string) : undefined,
+      redirectUri: safeRedirect,
       createdAt: Date.now(),
     };

Place this helper near validateJwtSecret:

// Normalize and allow-list redirect URIs
function parseAndValidateRedirectUri(raw: string, base: string): string {
  let url: URL;
  try {
    url = new URL(raw, base);
  } catch {
    throw new AppError('Invalid redirectUri', 400, ERROR_CODES.INVALID_INPUT);
  }
  if (!['http:', 'https:'].includes(url.protocol)) {
    throw new AppError('Invalid redirectUri scheme', 400, ERROR_CODES.INVALID_INPUT);
  }
  const allowed = (process.env.AUTH_ALLOWED_REDIRECT_ORIGINS || '')
    .split(',')
    .map((s) => s.trim())
    .filter(Boolean);
  if (allowed.length > 0 && !allowed.includes(url.origin)) {
    throw new AppError('redirectUri origin not allowed', 400, ERROR_CODES.INVALID_INPUT);
  }
  return url.toString();
}

307-442: Blocker: open redirect and token leakage in shared callback

Tokens and PII are placed in query params and redirectUri is unguarded. Use hash fragments and validate redirectUri; also parse payload defensively.

@@
-    let redirectUri: string;
+    let redirectUri: string;
     let provider: string;
@@
-      redirectUri = decodedState.redirectUri || '';
+      redirectUri = parseAndValidateRedirectUri(decodedState.redirectUri || '', `${req.protocol}://${req.get('host')}`);
@@
-    if (success !== 'true') {
+    if (success !== 'true') {
       const errorMessage = error || 'OAuth Authentication Failed';
       logger.warn('Shared OAuth callback failed', { error: errorMessage, provider });
-      return res.redirect(`${redirectUri}/?error=${encodeURIComponent(String(errorMessage))}`);
+      const url = new URL(redirectUri);
+      url.hash = `error=${encodeURIComponent(String(errorMessage))}`;
+      return res.redirect(url.toString());
     }
@@
-    const payloadData = JSON.parse(Buffer.from(payload as string, 'base64').toString('utf8'));
+    let payloadData: any;
+    try {
+      payloadData = JSON.parse(Buffer.from(payload as string, 'base64').toString('utf8'));
+    } catch {
+      throw new AppError('Invalid payload format', 400, ERROR_CODES.INVALID_INPUT);
+    }
@@
-    res.redirect(`${redirectUri}?${params.toString()}`);
+    const url = new URL(redirectUri);
+    url.hash = params.toString(); // Place tokens in fragment to avoid referrer leakage
+    return res.redirect(url.toString());

445-532: Blocker: provider callback also leaks tokens and lacks redirect allow‑list

Mirror the fixes: validate redirectUri from state, use fragment for tokens, and on error return error in fragment.

@@
-    let redirectUri: string;
+    let redirectUri: string;
@@
-      redirectUri = stateData.redirectUri || '';
+      redirectUri = parseAndValidateRedirectUri(stateData.redirectUri || '', `${req.protocol}://${req.get('host')}`);
@@
-      params.set('access_token', result?.accessToken ?? '');
+      params.set('access_token', result?.accessToken ?? '');
       params.set('user_id', result?.user.id ?? '');
       params.set('email', result?.user.email ?? '');
       params.set('name', result?.user.name ?? '');
@@
-      const finalRedirectUri = `${redirectUri}?${params.toString()}`;
+      const url = new URL(redirectUri);
+      url.hash = params.toString();
+      const finalRedirectUri = url.toString();
@@
-      const params = new URLSearchParams();
+      const params = new URLSearchParams();
       params.set('error', errorMessage);
-      return res.redirect(`${redirectUri}?${params.toString()}`);
+      const url = new URL(redirectUri);
+      url.hash = params.toString();
+      return res.redirect(url.toString());

Add a lightweight rate limiter to the init/callback routes per backend guidelines.

♻️ Duplicate comments (4)
frontend/src/features/auth/page/SignUpPage.tsx (2)

72-75: Defensive error parsing for non‑JSON responses

Avoid throwing on non‑JSON bodies; parse safely and fall back to text/status.

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error((errorData as { message?: string }).message || 'Sign up failed');
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = 'Sign up failed';
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
@@
-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error(
-          (errorData as { message?: string }).message || `${provider} OAuth initialization failed`
-        );
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = `${provider} OAuth initialization failed`;
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }

Also applies to: 112-117


104-108: Normalize redirect_uri to an absolute URL

Resolve potential relative/malformed redirectUrl to an absolute string before sending to backend.

-      const finalRedirectUri = redirectUrl || window.location.origin;
+      const finalRedirectUri = (() => {
+        try {
+          return redirectUrl
+            ? new URL(redirectUrl, window.location.origin).toString()
+            : window.location.origin;
+        } catch {
+          return window.location.origin;
+        }
+      })();
frontend/src/features/auth/page/SignInPage.tsx (2)

64-67: Defensive error parsing for non‑JSON responses

Mirror SignUp changes to avoid masking original errors.

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error((errorData as { message?: string }).message || 'Sign in failed');
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = 'Sign in failed';
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
@@
-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error(
-          (errorData as { message?: string }).message || `${provider} OAuth initialization failed`
-        );
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = `${provider} OAuth initialization failed`;
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }

Also applies to: 104-109


96-100: Normalize redirect_uri to absolute for OAuth init

Resolve redirectUrl safely before passing to backend.

-      const finalRedirectUri = redirectUrl || window.location.origin;
+      const finalRedirectUri = (() => {
+        try {
+          return redirectUrl
+            ? new URL(redirectUrl, window.location.origin).toString()
+            : window.location.origin;
+        } catch {
+          return window.location.origin;
+        }
+      })();
🧹 Nitpick comments (3)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)

36-41: Consider adding a blur handler to hide the strength indicator.

The strength indicator is shown on focus but never hidden when the input loses focus. This means once visible, it remains visible throughout the form's lifecycle.

Consider adding a blur handler for better UX:

+ const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
+   if (showStrengthIndicator) {
+     setShowStrength(false);
+   }
+   onBlur?.(e);
+ };

Then update the Input component:

  <Input
    {...props}
    id={inputId}
    type={showPassword ? 'text' : 'password'}
    className={cn('pr-10', inputClassName)}
    value={value}
    onFocus={handleFocus}
+   onBlur={handleBlur}
  />
frontend/src/features/auth/page/SignUpPage.tsx (1)

43-97: Form handling with React Hook Form + Zod

Per guidelines, consider React Hook Form with Zod schema for validations and error messaging consistency across auth forms.

As per coding guidelines

backend/src/api/routes/auth.oauth.ts (1)

40-53: Use successResponse utility for consistent response handling

The endpoint correctly excludes sensitive fields from the query (clientSecret is not selected), so no data leak concern. However, align the response pattern with other OAuth routes by wrapping the response with successResponse() instead of res.json() directly:

successResponse(res, {
  data: configs,
  count: configs.length,
});

This maintains consistency with the POST/PUT/DELETE endpoints on the same router (lines 132, 190, 235) and the rest of the codebase. Optionally, consider adding Cache-Control headers for this public endpoint if OAuth provider configs change infrequently.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3143f0 and 04e577e.

⛔ Files ignored due to path filters (6)
  • frontend/src/assets/logos/apple.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/discord.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/instagram.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/spotify.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/tiktok.svg is excluded by !**/*.svg
  • frontend/src/assets/logos/x.svg is excluded by !**/*.svg
📒 Files selected for processing (12)
  • backend/src/api/routes/auth.oauth.ts (1 hunks)
  • backend/src/server.ts (1 hunks)
  • frontend/src/features/auth/components/AuthFormField.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthPasswordField.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (1 hunks)
  • frontend/src/features/auth/components/AuthSubmitButton.tsx (1 hunks)
  • frontend/src/features/auth/components/index.ts (1 hunks)
  • frontend/src/features/auth/page/SignInPage.tsx (1 hunks)
  • frontend/src/features/auth/page/SignUpPage.tsx (1 hunks)
  • frontend/src/index.css (1 hunks)
  • frontend/src/lib/routing/AppRoutes.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • backend/src/server.ts
  • frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx
  • frontend/src/features/auth/components/AuthSubmitButton.tsx
  • frontend/src/features/auth/components/index.ts
  • frontend/src/features/auth/components/AuthFormField.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions

Files:

  • backend/src/api/routes/auth.oauth.ts
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
backend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/**/*.{ts,tsx}: Use async/await for asynchronous operations in the backend
Use Zod schemas for request/response validation
Return consistent API responses using utility functions
Validate all user inputs
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper caching strategies (server-side)

Files:

  • backend/src/api/routes/auth.oauth.ts
backend/src/api/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/api/**/*.ts: Implement authentication and error-handling middleware
Follow RESTful conventions for API endpoints
Implement rate limiting for API endpoints

Files:

  • backend/src/api/routes/auth.oauth.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

React components and TypeScript types/interfaces must use PascalCase

Files:

  • backend/src/api/routes/auth.oauth.ts
  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
**/[a-z][a-z0-9-]*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Utility files should use kebab-case or camelCase (kebab-case validated here)

Files:

  • backend/src/api/routes/auth.oauth.ts
frontend/src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{tsx,ts}: Use functional React components with hooks exclusively
Use Radix UI primitives for accessibility
Optimize React component re-renders

Files:

  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
frontend/src/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.tsx: Implement TypeScript interfaces/types for all component props
Follow component composition patterns; keep components focused and single-purpose
Implement proper loading and error states in UI
Use a consistent icon set from lucide-react

Files:

  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{ts,tsx}: Use TanStack Query for server state management
Use React Hook Form for form handling with Zod validation
Optimize bundle size with proper imports

Files:

  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
frontend/src/**/[A-Z]*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Component files must use PascalCase filenames (e.g., DataGrid.tsx)

Files:

  • frontend/src/features/auth/components/AuthOAuthProviders.tsx
  • frontend/src/lib/routing/AppRoutes.tsx
  • frontend/src/features/auth/components/AuthPasswordField.tsx
  • frontend/src/features/auth/page/SignInPage.tsx
  • frontend/src/features/auth/page/SignUpPage.tsx
🧬 Code graph analysis (5)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (3)
shared-schemas/src/auth.schema.ts (1)
  • OAuthProvidersSchema (110-110)
frontend/src/features/auth/components/index.ts (1)
  • AuthOAuthProviders (8-8)
frontend/src/components/radix/Button.tsx (1)
  • Button (50-50)
frontend/src/lib/routing/AppRoutes.tsx (2)
frontend/src/features/auth/page/SignInPage.tsx (1)
  • SignInPage (17-210)
frontend/src/features/auth/page/SignUpPage.tsx (1)
  • SignUpPage (17-222)
frontend/src/features/auth/components/AuthPasswordField.tsx (2)
frontend/src/lib/utils/utils.ts (1)
  • cn (19-21)
frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx (1)
  • AuthPasswordStrengthIndicator (44-62)
frontend/src/features/auth/page/SignInPage.tsx (6)
shared-schemas/src/auth.schema.ts (2)
  • OAuthProvidersSchema (110-110)
  • OAuthConfigSchema (109-109)
shared-schemas/src/auth-api.schema.ts (1)
  • ListOAuthConfigsResponse (201-201)
frontend/src/features/auth/components/AuthFormField.tsx (1)
  • AuthFormField (9-20)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)
  • AuthPasswordField (19-85)
frontend/src/features/auth/components/AuthSubmitButton.tsx (1)
  • AuthSubmitButton (10-33)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)
  • AuthOAuthProviders (46-149)
frontend/src/features/auth/page/SignUpPage.tsx (6)
shared-schemas/src/auth.schema.ts (2)
  • OAuthProvidersSchema (110-110)
  • OAuthConfigSchema (109-109)
shared-schemas/src/auth-api.schema.ts (1)
  • ListOAuthConfigsResponse (201-201)
frontend/src/features/auth/components/AuthFormField.tsx (1)
  • AuthFormField (9-20)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)
  • AuthPasswordField (19-85)
frontend/src/features/auth/components/AuthSubmitButton.tsx (1)
  • AuthSubmitButton (10-33)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)
  • AuthOAuthProviders (46-149)
🪛 GitHub Actions: Lint and Format Check
frontend/src/features/auth/components/AuthPasswordField.tsx

[error] 54-54: eslint: Promise-returning function provided to attribute where a void return was expected (@typescript-eslint/no-misused-promises).

🪛 GitHub Check: lint-and-format
frontend/src/features/auth/components/AuthPasswordField.tsx

[failure] 54-54:
Promise-returning function provided to attribute where a void return was expected

frontend/src/features/auth/page/SignUpPage.tsx

[failure] 19-19:
'navigate' is assigned a value but never used. Allowed unused vars must match /^_/u

🔇 Additional comments (7)
frontend/src/index.css (1)

1-1: Clarify intent of unused --fontFamilyManrope variable.

The CSS variable is defined on line 63 but is not imported from any source and is not used by any component in the codebase. Verify whether this is:

  1. Needed for the auth UI: If yes, add Manrope to the Google Fonts import on line 1, and update the auth components to use font-family: var(--fontFamilyManrope);

  2. Dead code: If not needed yet, remove line 63 to keep the codebase clean.

Without component usage, the missing import alone is not causing a visual issue, but the incomplete variable suggests unfinished work.

frontend/src/features/auth/components/AuthPasswordField.tsx (5)

1-8: LGTM!

Imports are well-organized and follow the coding guidelines. The component uses the consistent icon set from lucide-react and proper ES module syntax.


9-17: LGTM!

The interface definition properly extends HTML input attributes and follows TypeScript/React best practices. The optional properties provide good flexibility for different use cases.


19-35: LGTM!

The component signature and state management follow React best practices. The use of useId ensures stable, accessible IDs, and the state variables appropriately manage local UI concerns.


70-78: LGTM!

The password visibility toggle is well-implemented with proper accessibility attributes (aria-label and aria-pressed). The use of type="button" correctly prevents form submission, and the icons from lucide-react are consistent with the project's design system.


80-82: LGTM!

The conditional rendering and type conversion for the strength indicator are appropriately handled. The defensive String(value || '') ensures a valid string is passed to the AuthPasswordStrengthIndicator component.

frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)

130-144: Nice a11y improvement with aria-label on icon buttons

Good addition; keeps the control accessible even in icon‑only mode.

Comment thread frontend/src/lib/routing/AppRoutes.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
frontend/src/features/auth/helpers.tsx (1)

43-43: Simplify redundant dark mode color declaration.

Since Discord uses the same color in both light and dark modes, dark:text-[#5765F2] is redundant. The same applies to LinkedIn (line 50).

Apply this diff:

-    icon: <Discord className="w-6 h-6 text-[#5765F2] dark:text-[#5765F2]" />,
+    icon: <Discord className="w-6 h-6 text-[#5765F2]" />,

Similarly for LinkedIn:

-    icon: <LinkedIn className="w-6 h-6 text-[#0A66C2] dark:text-[#0A66C2]" />,
+    icon: <LinkedIn className="w-6 h-6 text-[#0A66C2]" />,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04e577e and a25263a.

📒 Files selected for processing (1)
  • frontend/src/features/auth/helpers.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions

Files:

  • frontend/src/features/auth/helpers.tsx
frontend/src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{tsx,ts}: Use functional React components with hooks exclusively
Use Radix UI primitives for accessibility
Optimize React component re-renders

Files:

  • frontend/src/features/auth/helpers.tsx
frontend/src/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.tsx: Implement TypeScript interfaces/types for all component props
Follow component composition patterns; keep components focused and single-purpose
Implement proper loading and error states in UI
Use a consistent icon set from lucide-react

Files:

  • frontend/src/features/auth/helpers.tsx
frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{ts,tsx}: Use TanStack Query for server state management
Use React Hook Form for form handling with Zod validation
Optimize bundle size with proper imports

Files:

  • frontend/src/features/auth/helpers.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

React components and TypeScript types/interfaces must use PascalCase

Files:

  • frontend/src/features/auth/helpers.tsx
🔇 Additional comments (1)
frontend/src/features/auth/helpers.tsx (1)

36-36: Verify dark mode visibility for Microsoft icon.

The dark:text-white class was removed from the Microsoft icon, while GitHub (line 29) retains it. Ensure the Microsoft SVG has sufficient contrast in dark mode without explicit color overrides.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

♻️ Duplicate comments (8)
frontend/src/features/auth/page/SignUpPage.tsx (4)

69-72: Defensive error parsing to avoid masking real errors.

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error((errorData as { message?: string }).message || 'Sign up failed');
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = 'Sign up failed';
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
``` <!-- review_comment_end -->

---

`101-105`: **Normalize redirect_uri to absolute; handle malformed/relative values.**

```diff
-      const finalRedirectUri = redirectUrl || window.location.origin;
+      const finalRedirectUri = (() => {
+        try {
+          return redirectUrl
+            ? new URL(redirectUrl, window.location.origin).toString()
+            : window.location.origin;
+        } catch {
+          return window.location.origin;
+        }
+      })();

This prevents backend rejections from relative/malformed URIs.


109-114: Defensive error parsing (OAuth init).

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error(
-          (errorData as { message?: string }).message || `${provider} OAuth initialization failed`
-        );
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = `${provider} OAuth initialization failed`;
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
``` <!-- review_comment_end -->

---

`76-88`: **Open redirect still possible; restrict redirects to same-origin (token in hash).**

Using the hash reduces leakage, but redirecting to arbitrary origins remains risky. Restrict to same-origin or an allowlist; fall back to a safe route.

```diff
-      if (redirectUrl) {
-        try {
-          const finalUrl = new URL(redirectUrl, window.location.origin);
-          finalUrl.hash = `access_token=${encodeURIComponent(accessToken)}`;
-          window.location.assign(finalUrl.toString());
-        } catch {
-          // Invalid redirect; default to dashboard
-          window.location.assign('/dashboard');
-        }
-      } else {
-        window.location.assign('/dashboard');
-      }
+      if (redirectUrl) {
+        try {
+          const url = new URL(redirectUrl, window.location.origin);
+          const sameOrigin = url.origin === window.location.origin;
+          if (sameOrigin) {
+            url.hash = `access_token=${encodeURIComponent(accessToken)}`;
+            window.location.assign(url.toString());
+          } else {
+            window.location.assign('/dashboard');
+          }
+        } catch {
+          window.location.assign('/dashboard');
+        }
+      } else {
+        window.location.assign('/dashboard');
+      }

Backend should enforce an allowlist and prefer code/PKCE or HttpOnly cookie issuance over passing access tokens via front-end redirects.

frontend/src/features/auth/page/SignInPage.tsx (4)

69-72: Defensive error parsing to avoid masking real errors.

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error((errorData as { message?: string }).message || 'Sign in failed');
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = 'Sign in failed';
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
``` <!-- review_comment_end -->

---

`101-105`: **Normalize redirect_uri to absolute; handle malformed/relative values.**

```diff
-      const finalRedirectUri = redirectUrl || window.location.origin;
+      const finalRedirectUri = (() => {
+        try {
+          return redirectUrl
+            ? new URL(redirectUrl, window.location.origin).toString()
+            : window.location.origin;
+        } catch {
+          return window.location.origin;
+        }
+      })();

Prevents backend rejects on relative URIs and sanitizes malformed inputs.


109-114: Defensive error parsing (OAuth init).

-      if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error(
-          (errorData as { message?: string }).message || `${provider} OAuth initialization failed`
-        );
-      }
+      if (!response.ok) {
+        const text = await response.text().catch(() => '');
+        let message = `${provider} OAuth initialization failed`;
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
+      }
``` <!-- review_comment_end -->

---

`76-88`: **Open redirect still possible; restrict redirects to same-origin (token in hash).**

```diff
-      if (redirectUrl) {
-        try {
-          const finalUrl = new URL(redirectUrl, window.location.origin);
-          finalUrl.hash = `access_token=${encodeURIComponent(accessToken)}`;
-          window.location.assign(finalUrl.toString());
-        } catch {
-          // Invalid redirect; default to dashboard
-          window.location.assign('/dashboard');
-        }
-      } else {
-        window.location.assign('/dashboard');
-      }
+      if (redirectUrl) {
+        try {
+          const url = new URL(redirectUrl, window.location.origin);
+          const sameOrigin = url.origin === window.location.origin;
+          if (sameOrigin) {
+            url.hash = `access_token=${encodeURIComponent(accessToken)}`;
+            window.location.assign(url.toString());
+          } else {
+            window.location.assign('/dashboard');
+          }
+        } catch {
+          window.location.assign('/dashboard');
+        }
+      } else {
+        window.location.assign('/dashboard');
+      }

Enforce allowlists and prefer server-set HttpOnly cookies or code exchange.

🧹 Nitpick comments (1)
frontend/src/lib/utils/validation-schemas.ts (1)

126-136: Optional: align strongPasswordSchema messaging and escape class consistently.

Minor copy tweaks; current regex is fine. No functional change required.

-  .regex(/[A-Z]/, 'At least 1 Uppercase letter')
-  .regex(/\d/, 'At least 1 Number')
-  .regex(/[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/, 'Special character (e.g. !?<>@#$%)');
+  .regex(/[A-Z]/, 'At least 1 uppercase letter')
+  .regex(/\d/, 'At least 1 number')
+  .regex(/[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/, 'At least 1 special character (e.g., !?<>@#$%)');
``` <!-- review_comment_end -->

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: CodeRabbit UI

**Review profile**: CHILL

**Plan**: Pro

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between a25263a4b194bce637bbe0feab9684aba7a6656d and 55cf745382a5a824fe8c8e918a76e128ef148956.

</details>

<details>
<summary>📒 Files selected for processing (6)</summary>

* `frontend/src/features/auth/components/AuthPasswordField.tsx` (1 hunks)
* `frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx` (1 hunks)
* `frontend/src/features/auth/page/SignInPage.tsx` (1 hunks)
* `frontend/src/features/auth/page/SignUpPage.tsx` (1 hunks)
* `frontend/src/lib/routing/AppRoutes.tsx` (2 hunks)
* `frontend/src/lib/utils/validation-schemas.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (3)</summary>

* frontend/src/lib/routing/AppRoutes.tsx
* frontend/src/features/auth/components/AuthPasswordField.tsx
* frontend/src/features/auth/components/AuthPasswordStrengthIndicator.tsx

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (7)</summary>

<details>
<summary>**/*.{ts,tsx}</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> `**/*.{ts,tsx}`: Use TypeScript for all code files
> Use ES modules (import/export syntax)
> Prefer descriptive, unabbreviated variable and function names
> Implement proper error handling with try-catch blocks and logging where appropriate
> Use single quotes for strings
> Include semicolons at the end of statements
> Use arrow functions for callbacks and inline functions
> Prefer const over let; avoid var
> Use template literals for string interpolation
> Maintain 2-space indentation
> Format code with the repository Prettier configuration
> Variables, parameters, properties, and functions must use camelCase
> Constants and enum members must use UPPER_CASE
> Include JSDoc comments for complex functions

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`
- `frontend/src/lib/utils/validation-schemas.ts`

</details>
<details>
<summary>frontend/src/**/*.{tsx,ts}</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> `frontend/src/**/*.{tsx,ts}`: Use functional React components with hooks exclusively
> Use Radix UI primitives for accessibility
> Optimize React component re-renders

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`
- `frontend/src/lib/utils/validation-schemas.ts`

</details>
<details>
<summary>frontend/src/**/*.tsx</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> `frontend/src/**/*.tsx`: Implement TypeScript interfaces/types for all component props
> Follow component composition patterns; keep components focused and single-purpose
> Implement proper loading and error states in UI
> Use a consistent icon set from lucide-react

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`

</details>
<details>
<summary>frontend/src/**/*.{ts,tsx}</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> `frontend/src/**/*.{ts,tsx}`: Use TanStack Query for server state management
> Use React Hook Form for form handling with Zod validation
> Optimize bundle size with proper imports

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`
- `frontend/src/lib/utils/validation-schemas.ts`

</details>
<details>
<summary>**/*.{tsx,ts}</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> React components and TypeScript types/interfaces must use PascalCase

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`
- `frontend/src/lib/utils/validation-schemas.ts`

</details>
<details>
<summary>frontend/src/**/[A-Z]*.tsx</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> Component files must use PascalCase filenames (e.g., DataGrid.tsx)

Files:
- `frontend/src/features/auth/page/SignUpPage.tsx`
- `frontend/src/features/auth/page/SignInPage.tsx`

</details>
<details>
<summary>**/[a-z][a-z0-9-]*.ts</summary>


**📄 CodeRabbit inference engine (.github/copilot-instructions.md)**

> Utility files should use kebab-case or camelCase (kebab-case validated here)

Files:
- `frontend/src/lib/utils/validation-schemas.ts`

</details>

</details><details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>📚 Learning: 2025-10-15T18:18:47.519Z</summary>

Learnt from: CR
PR: InsForge/InsForge#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-15T18:18:47.519Z
Learning: Applies to backend/src/**/*.{ts,tsx} : Use Zod schemas for request/response validation


**Applied to files:**
- `frontend/src/lib/utils/validation-schemas.ts`

</details>

</details><details>
<summary>🧬 Code graph analysis (2)</summary>

<details>
<summary>frontend/src/features/auth/page/SignUpPage.tsx (7)</summary><blockquote>

<details>
<summary>shared-schemas/src/auth.schema.ts (2)</summary>

* `OAuthProvidersSchema` (110-110)
* `OAuthConfigSchema` (109-109)

</details>
<details>
<summary>shared-schemas/src/auth-api.schema.ts (1)</summary>

* `ListOAuthConfigsResponse` (201-201)

</details>
<details>
<summary>frontend/src/lib/utils/validation-schemas.ts (1)</summary>

* `signUpFormSchema` (143-146)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthFormField.tsx (1)</summary>

* `AuthFormField` (9-20)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthPasswordField.tsx (1)</summary>

* `AuthPasswordField` (19-87)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthSubmitButton.tsx (1)</summary>

* `AuthSubmitButton` (10-33)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)</summary>

* `AuthOAuthProviders` (46-149)

</details>

</blockquote></details>
<details>
<summary>frontend/src/features/auth/page/SignInPage.tsx (7)</summary><blockquote>

<details>
<summary>shared-schemas/src/auth.schema.ts (2)</summary>

* `OAuthProvidersSchema` (110-110)
* `OAuthConfigSchema` (109-109)

</details>
<details>
<summary>shared-schemas/src/auth-api.schema.ts (1)</summary>

* `ListOAuthConfigsResponse` (201-201)

</details>
<details>
<summary>frontend/src/lib/utils/validation-schemas.ts (1)</summary>

* `signInFormSchema` (138-141)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthFormField.tsx (1)</summary>

* `AuthFormField` (9-20)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthPasswordField.tsx (1)</summary>

* `AuthPasswordField` (19-87)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthSubmitButton.tsx (1)</summary>

* `AuthSubmitButton` (10-33)

</details>
<details>
<summary>frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)</summary>

* `AuthOAuthProviders` (46-149)

</details>

</blockquote></details>

</details><details>
<summary>🪛 GitHub Actions: Lint and Format Check</summary>

<details>
<summary>frontend/src/features/auth/page/SignInPage.tsx</summary>

[error] 50-50: prettier/prettier: Delete `····`

</details>

</details>
<details>
<summary>🪛 GitHub Check: lint-and-format</summary>

<details>
<summary>frontend/src/features/auth/page/SignUpPage.tsx</summary>

[failure] 50-50: 
Delete `····`

</details>
<details>
<summary>frontend/src/features/auth/page/SignInPage.tsx</summary>

[failure] 50-50: 
Delete `····`

</details>
<details>
<summary>frontend/src/lib/utils/validation-schemas.ts</summary>

[failure] 126-126: 
Replace `⏎··.string()⏎··` with `.string()`

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)</summary>

* GitHub Check: E2E Tests
* GitHub Check: CI Pre-merge Check

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>frontend/src/features/auth/page/SignUpPage.tsx (1)</summary><blockquote>

`50-50`: **Remove trailing spaces from line 50.**

Line 50 contains 4 trailing spaces that should be removed. Run the formatter:

npx prettier --write frontend/src/features/auth/page/SignUpPage.tsx


</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (6)
frontend/src/lib/utils/validation-schemas.ts (1)

118-124: Trim before validating email; current order rejects valid inputs with whitespace.

.email() runs before .trim(), so inputs like ' [email protected] ' fail validation. Reorder the chain so trimming happens first.

Apply this diff:

 export const emailSchema = z
   .string()
+  .trim()
   .min(1, 'Email is required')
   .email('Please enter a valid email address')
-  .toLowerCase()
-  .trim();
+  .toLowerCase();
frontend/src/features/auth/page/SignUpPage.tsx (5)

30-41: Check response.ok before parsing; consider TanStack Query.

Parsing without checking response.ok can throw on non-JSON error responses. Additionally, coding guidelines recommend TanStack Query for server state management.

Apply this diff to add response.ok check:

   void fetch('/api/auth/oauth/configs')
-    .then((res) => res.json())
+    .then((res) => {
+      if (!res.ok) throw new Error(`Failed to fetch OAuth configs (${res.status})`);
+      return res.json();
+    })
     .then((data: ListOAuthConfigsResponse) => {

Longer-term: refactor to use useQuery for caching and proper error handling. As per coding guidelines.


69-72: Error parsing can throw on non-JSON bodies.

If the error response is HTML or plain text, response.json() will throw and mask the actual error.

Parse defensively:

       if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error((errorData as { message?: string }).message || 'Sign up failed');
+        const text = await response.text().catch(() => '');
+        let message = 'Sign up failed';
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
       }

103-104: Validate and normalize redirect_uri to ensure absolute URL.

OAuth providers typically require absolute redirect URIs. The current code uses redirectUrl directly if provided, which might be a relative path.

Apply this diff:

-      const finalRedirectUri = redirectUrl || window.location.origin;
+      const finalRedirectUri = (() => {
+        try {
+          return redirectUrl ? new URL(redirectUrl, window.location.origin).toString() : window.location.origin;
+        } catch {
+          return window.location.origin;
+        }
+      })();

109-114: Error parsing can throw on non-JSON bodies.

Same issue as in handleSubmit: response.json() on error responses can throw if the body isn't valid JSON.

Apply defensive parsing:

       if (!response.ok) {
-        const errorData = await response.json();
-        throw new Error(
-          (errorData as { message?: string }).message || `${provider} OAuth initialization failed`
-        );
+        const text = await response.text().catch(() => '');
+        let message = `${provider} OAuth initialization failed`;
+        try { message = (JSON.parse(text) as { message?: string }).message ?? message; } catch {}
+        throw new Error(message);
       }

127-127: Fix Tailwind class typo: use bg-gradient-to-br.

bg-linear-to-br is not a valid Tailwind utility class. Use bg-gradient-to-br instead.

Apply this diff:

-    <div className="min-h-screen flex items-center justify-center bg-linear-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
+    <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 to-gray-100 dark:from-neutral-900 dark:to-neutral-800">
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55cf745 and d7911c9.

📒 Files selected for processing (3)
  • frontend/src/features/auth/page/SignInPage.tsx (1 hunks)
  • frontend/src/features/auth/page/SignUpPage.tsx (1 hunks)
  • frontend/src/lib/utils/validation-schemas.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/features/auth/page/SignInPage.tsx
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/lib/utils/validation-schemas.ts
frontend/src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{tsx,ts}: Use functional React components with hooks exclusively
Use Radix UI primitives for accessibility
Optimize React component re-renders

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/lib/utils/validation-schemas.ts
frontend/src/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.tsx: Implement TypeScript interfaces/types for all component props
Follow component composition patterns; keep components focused and single-purpose
Implement proper loading and error states in UI
Use a consistent icon set from lucide-react

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

frontend/src/**/*.{ts,tsx}: Use TanStack Query for server state management
Use React Hook Form for form handling with Zod validation
Optimize bundle size with proper imports

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/lib/utils/validation-schemas.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

React components and TypeScript types/interfaces must use PascalCase

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
  • frontend/src/lib/utils/validation-schemas.ts
frontend/src/**/[A-Z]*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Component files must use PascalCase filenames (e.g., DataGrid.tsx)

Files:

  • frontend/src/features/auth/page/SignUpPage.tsx
**/[a-z][a-z0-9-]*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Utility files should use kebab-case or camelCase (kebab-case validated here)

Files:

  • frontend/src/lib/utils/validation-schemas.ts
🧬 Code graph analysis (1)
frontend/src/features/auth/page/SignUpPage.tsx (7)
shared-schemas/src/auth.schema.ts (2)
  • OAuthProvidersSchema (110-110)
  • OAuthConfigSchema (109-109)
shared-schemas/src/auth-api.schema.ts (1)
  • ListOAuthConfigsResponse (201-201)
frontend/src/lib/utils/validation-schemas.ts (1)
  • signUpFormSchema (141-144)
frontend/src/features/auth/components/AuthFormField.tsx (1)
  • AuthFormField (9-20)
frontend/src/features/auth/components/AuthPasswordField.tsx (1)
  • AuthPasswordField (19-87)
frontend/src/features/auth/components/AuthSubmitButton.tsx (1)
  • AuthSubmitButton (10-33)
frontend/src/features/auth/components/AuthOAuthProviders.tsx (1)
  • AuthOAuthProviders (46-149)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: E2E Tests
  • GitHub Check: CI Pre-merge Check
🔇 Additional comments (6)
frontend/src/lib/utils/validation-schemas.ts (4)

128-134: LGTM! Strong password validation properly enforced.

The regex patterns correctly enforce uppercase, digit, and special character requirements. Error messages align with the AuthPasswordStrengthIndicator component.


136-139: LGTM! Clean schema composition.

Properly combines emailSchema and passwordSchema for sign-in validation.


141-144: LGTM! Appropriate use of stricter validation for signup.

Using strongPasswordSchema for signup ensures new users create secure passwords.


146-151: LGTM! Clean backward compatibility approach.

Aliases maintain existing API while introducing clearer naming for authentication flows.

frontend/src/features/auth/page/SignUpPage.tsx (2)

1-28: LGTM! Clean imports and state setup.

Component properly imports React 19 hooks and auth-related dependencies. State initialization follows best practices.


144-218: LGTM! Well-structured component with good UX patterns.

The form properly uses custom validation, reusable auth components, and preserves the redirect parameter. Password strength indicator and proper autocomplete attributes enhance usability.

@Leo-rq-yu
Leo-rq-yu requested a review from tonychang04 October 28, 2025 03:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
docs/core-concepts/authentication/ui-components/nextjs.mdx (1)

375-497: Custom components section is comprehensive but could clarify primitive component availability.

The section properly documents the transition from built-in auth to custom components, including provider configuration, pre-built components, and primitive building blocks. However, the example at lines 440-484 shows only a subset of available primitives (doesn't demonstrate AuthErrorBanner, AuthPasswordStrengthIndicator, or AuthBranding mentioned in lines 487-497), which could leave developers uncertain about when/how to use all available primitives.

Consider adding a brief note or example showing how to use the additional primitives (AuthErrorBanner, AuthPasswordStrengthIndicator, AuthBranding) not shown in the main CustomSignIn example. This would help developers understand the full palette of available components.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7911c9 and c1b498d.

📒 Files selected for processing (2)
  • docs/core-concepts/authentication/ui-components/nextjs.mdx (1 hunks)
  • docs/docs.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/core-concepts/authentication/ui-components/nextjs.mdx

[grammar] ~425-~425: Ensure spelling is correct
Context: ...fo> ### Component Props #### SignIn / SignUp tsx <SignIn afterSignInUrl="/dashboard" appearance={{ container: { background: '#f5f5f5' } }} onSuccess={(user) => console.log('Signed in:', user)} onError={(error) => console.error('Error:', error)} /> ### Build from Primitives For complete cont...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: E2E Tests
🔇 Additional comments (16)
docs/docs.json (1)

49-56: Navigation structure addition looks correct.

The nested "UI Components" group under Authentication properly documents the new Next.js integration guide. The path reference core-concepts/authentication/ui-components/nextjs correctly corresponds to the MDX file at docs/core-concepts/authentication/ui-components/nextjs.mdx (following Mintlify convention of stripping the docs/ prefix and .mdx extension).

docs/core-concepts/authentication/ui-components/nextjs.mdx (15)

1-50: Clear introduction with accurate feature overview.

The frontmatter, introduction, and features section provides good high-level context. The feature cards effectively communicate the value proposition, and the structure aligns well with the content provided in subsequent sections.

Verify that the "11 providers" claim (line 24-25) accurately reflects what's supported in the implementation. If the actual count differs, this should be updated to match.


53-88: Provider and API route setup examples are clear and follow Next.js conventions.

Both sections properly demonstrate the app directory pattern and include explanatory notes about why each step is necessary. The environment variable usage is appropriate for public vs. private backend URLs.

Verify that:

  1. The createAuthRouteHandlers function from @insforge/nextjs/api includes all three HTTP methods (POST, GET, DELETE) needed by the implementation
  2. The cookieName value 'insforge_token' is consistent with how cookies are referenced elsewhere in the authentication flow

94-158: Callback page implementation is thorough with proper guards against race conditions.

The use of isProcessingRef to prevent double-processing and the Suspense boundary are appropriate patterns. Token synchronization across localStorage, cookies (via API), and sessionStorage-based destination routing is well-coordinated.

Clarify the rationale for the 100ms setTimeout on line 130. Is this a timing requirement to ensure proper state synchronization, or is it a defensive delay? If arbitrary, consider documenting the reason or removing if not necessary.


164-176: Middleware configuration is standard and includes proper route protection setup.

The public routes appropriately include the auth callback endpoint and home page, while the matcher pattern correctly excludes static assets and API routes. The cookieName value matches the API route setup, ensuring consistency.


178-202: Usage example is concise and clearly demonstrates the primary authentication flow.


203-235: Flow diagram and local development setup are well-explained.

The ASCII flow effectively shows the redirect-based authentication pattern, and the separate environment variables for backend API vs. frontend auth pages make sense for local development scenarios.

Confirm that the provider automatically detects and uses NEXT_PUBLIC_INSFORGE_FRONTEND_URL for auth redirects when set (line 234), as documented here.


237-293: React hooks documentation shows clear examples and proper patterns.

The documentation for useAuth, useUser, and useSession includes good practical examples. The useUser example appropriately includes an isLoaded check, which is important for SSR compatibility.

Verify that all methods documented in the useAuth hook return signature (line 262) are actually implemented: signIn(), signUp(), updateUser() in addition to the signOut() shown in examples.


295-352: Control components documentation is clear with good examples.


354-372: Server-side helpers documentation is clear and shows proper async/await pattern.

Verify that getAuthUserId() and getAuthToken() functions are properly exported from @insforge/nextjs/middleware.


499-510: Middleware update for custom components is clear.

Properly documents the required changes: adding custom route paths to publicRoutes and setting useBuiltInAuth: false.


512-542: Customization via appearance prop and CSS is well-documented.

Shows both programmatic (appearance prop) and CSS-based styling approaches, giving developers flexible customization options.


544-558: Auth callbacks section shows practical integration patterns.


560-577: TypeScript support documentation is clear.

Verify that the TypeScript types InsforgeUser, InsforgeSession, and AuthContextValue are properly exported from @insforge/nextjs.


579-605: Closing sections effectively summarize value and provide resources.


1-605: Comprehensive documentation with clear structure and practical examples.

The documentation effectively explains the built-in auth flow, provides multiple setup paths (built-in vs. custom), and includes well-structured code examples following Next.js conventions. The progression from quick-start to advanced customization is logical and easy to follow.

Perform verification across these dimensions:

  1. Component/Function existence: Verify all referenced components and functions actually exist in the @insforge/nextjs package:

    • Components: SignIn, SignUp, SignedIn, SignedOut, UserButton, Protect, and all auth primitives
    • Hooks: useAuth, useUser, useSession
    • Helpers: getAuthUserId, getAuthToken
    • Provider: InsforgeProvider with useBuiltInAuth prop and onAuthChange callback
  2. API consistency: Verify the documented API routes and handlers match the implementation

    • createAuthRouteHandlers function signature and handlers
    • Callback page integration with /api/auth endpoint
    • Token sync action name: 'sync-token'
  3. CSS class names: Verify CSS class names used in styling section match actual implementation

    • insforge-btn-primary, insforge-input

I can run verification scripts if you'd like to confirm these details against the actual codebase.

@Leo-rq-yu
Leo-rq-yu changed the base branch from main to feat/email-service October 28, 2025 18:14
@Leo-rq-yu
Leo-rq-yu force-pushed the feat/auth-component-support branch from c1b498d to 244a704 Compare October 28, 2025 18:16
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.

2 participants