Skip to content

feat: Integrate Clerk for comprehensive user authentication#3

Merged
devcedrick merged 4 commits into
mainfrom
develop
Jul 12, 2026
Merged

feat: Integrate Clerk for comprehensive user authentication#3
devcedrick merged 4 commits into
mainfrom
develop

Conversation

@devcedrick

@devcedrick devcedrick commented Jul 12, 2026

Copy link
Copy Markdown
Owner

This commit introduces full user authentication and management capabilities using Clerk.

Key changes include:

  • Added Clerk SDK and expo-secure-store plugin.
  • Implemented complete sign-in, sign-up, email verification, and forgot password flows.
  • Established protected routes, redirecting unauthenticated users to the sign-in screen.
  • Dynamically displays user profile information (avatar, name, email, join date) on the Home and Settings screens.
  • Updated app branding (name, slug, scheme) and splash screen assets for consistency.

Summary by CodeRabbit

  • New Features
    • Added complete Clerk-powered sign-in, sign-up (with email verification), and multi-step password recovery.
    • Implemented protected routing for the authenticated area with loading state and redirect behavior.
    • Updated the Settings screen to show user profile/account details and a working log out action.
    • Personalized the home tab with the signed-in user’s avatar and display name.
    • Refreshed app identity and splash/branding imagery.
  • Bug Fixes
    • Prevented app startup when required auth configuration is missing.
  • Chores
    • Updated dependencies to include Clerk and related Expo packages.
    • Updated ignore rules to exclude local .env files.

This commit introduces full user authentication and management capabilities using Clerk.

Key changes include:
- Added Clerk SDK and `expo-secure-store` plugin.
- Implemented complete sign-in, sign-up, email verification, and forgot password flows.
- Established protected routes, redirecting unauthenticated users to the sign-in screen.
- Dynamically displays user profile information (avatar, name, email, join date) on the Home and Settings screens.
- Updated app branding (name, slug, scheme) and splash screen assets for consistency.
Copilot AI review requested due to automatic review settings July 12, 2026 12:06
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6af32fd3-5eb4-4095-a006-a6685183a5b1

📥 Commits

Reviewing files that changed from the base of the PR and between f9c3c28 and 2cd8b0f.

📒 Files selected for processing (1)
  • app/(auth)/sign-up.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/(auth)/sign-up.tsx

📝 Walkthrough

Walkthrough

Clerk is configured at the app root, authentication routes and flows are added, tab routes are protected, and authenticated user information is displayed on the home and settings screens.

Changes

Clerk authentication integration

Layer / File(s) Summary
Clerk foundation and app configuration
.gitignore, app.json, app/_layout.tsx, package.json
Adds Clerk packages and provider initialization, validates the publishable key, updates Expo identity and splash configuration, and ignores .env.
Authentication routes and account flows
app/(auth)/_layout.tsx, app/(auth)/sign-in.tsx, app/(auth)/sign-up.tsx
Adds auth route redirection plus sign-in, MFA, password-reset, sign-up, and email-verification screens using Clerk.
Protected tabs and user profile surfaces
app/(tabs)/_layout.tsx, app/(tabs)/index.tsx, app/(tabs)/settings.tsx
Protects tab routes and displays authenticated user details, account information, and sign-out controls.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AuthScreen
  participant Clerk
  participant TabLayout
  User->>AuthScreen: submit credentials or verification code
  AuthScreen->>Clerk: create or complete authentication
  Clerk-->>AuthScreen: return auth state
  AuthScreen->>TabLayout: navigate to tabs
  TabLayout->>Clerk: read authentication state
  Clerk-->>TabLayout: return signed-in status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: integrating Clerk-based authentication across the app.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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

This comment was marked as resolved.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
app/_layout.tsx (1)

29-33: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Splash hides before Clerk auth state resolves.

SplashScreen.hideAsync() only waits on font loading, not on Clerk's isLoaded. Since (auth)/_layout.tsx (and likely (tabs)/_layout.tsx) render null while useAuth().isLoaded is false, users may briefly see a blank screen after the splash hides but before Clerk resolves sign-in state.

Consider moving auth-state gating into this root layout (e.g. a RootNavigator that checks both fontsLoaded and Clerk's isLoaded before hiding the splash), similar to Clerk's documented pattern with Stack.Protected.

Illustrative pattern
function RootNavigator() {
  const { isLoaded: authLoaded, isSignedIn } = useAuth();
  if (!authLoaded) return null;
  SplashScreen.hideAsync();
  return (
    <Stack screenOptions={{ headerShown: false }}>
      <Stack.Protected guard={isSignedIn === true}>
        <Stack.Screen name="(tabs)" />
      </Stack.Protected>
      <Stack.Protected guard={isSignedIn === false}>
        <Stack.Screen name="(auth)" />
      </Stack.Protected>
    </Stack>
  );
}

Also applies to: 38-45

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/_layout.tsx` around lines 29 - 33, Update the root layout’s splash-screen
gating around the existing useEffect and navigator so SplashScreen.hideAsync()
runs only after both fontsLoaded (or fontsError) and Clerk’s useAuth().isLoaded
are true. Add the auth-loaded check at the root navigation level, while
preserving the existing signed-in/signed-out route protection and preventing
child layouts from rendering during unresolved auth state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/`(auth)/sign-in.tsx:
- Line 249: Update the sign-in render to use optional chaining whenever
accessing the potentially nullish errors object, including the fields code check
and global error display: use errors?.fields?.code and errors?.global while
preserving the existing validation and rendering behavior.
- Around line 221-236: Move the LayoutWrap component from inside SignIn to
module scope alongside SafeAreaView, preserving its children prop and existing
SafeAreaView, KeyboardAvoidingView, and ScrollView configuration so the wrapped
subtree retains focus across SignIn renders.

In `@app/`(auth)/sign-up.tsx:
- Line 141: Update the error-state reads in the sign-up form, including the
className expression near the visible auth-input code and the other referenced
field/global checks, to use optional chaining on errors before accessing fields
or global. Preserve the existing conditional styling and validation behavior
when errors is present.

---

Nitpick comments:
In `@app/_layout.tsx`:
- Around line 29-33: Update the root layout’s splash-screen gating around the
existing useEffect and navigator so SplashScreen.hideAsync() runs only after
both fontsLoaded (or fontsError) and Clerk’s useAuth().isLoaded are true. Add
the auth-loaded check at the root navigation level, while preserving the
existing signed-in/signed-out route protection and preventing child layouts from
rendering during unresolved auth state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8a0eac8-fcf2-4727-b96b-b3661aca7d5b

📥 Commits

Reviewing files that changed from the base of the PR and between 44e9988 and f573f75.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • .gitignore
  • app.json
  • app/(auth)/_layout.tsx
  • app/(auth)/sign-in.tsx
  • app/(auth)/sign-up.tsx
  • app/(tabs)/_layout.tsx
  • app/(tabs)/index.tsx
  • app/(tabs)/settings.tsx
  • app/_layout.tsx
  • package.json

Comment thread app/(auth)/sign-in.tsx Outdated
Comment thread app/(auth)/sign-in.tsx Outdated
Comment thread app/(auth)/sign-up.tsx Outdated
…ion on each render

Move LayoutWrap from inside SignIn to module scope so all early-return
branches can reference it without the component being re-defined on
every render cycle.
…rashes

Clerk's useSignIn hook may return undefined error fields during
transient states. Use optional chaining when accessing
errors.fields and errors.global to avoid uncaught TypeError.
Apply the same defensive null-safety pattern to sign-up.tsx,
guarding against undefined errors during transient hook states.
@devcedrick
devcedrick merged commit 1dbdd00 into main Jul 12, 2026
1 check passed
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