Skip to content

feat: integrate Drizzle ORM with Neon and implement automatic Clerk u… - #3

Merged
superezzdev merged 1 commit into
mainfrom
feature/landing-page
Aug 4, 2026
Merged

feat: integrate Drizzle ORM with Neon and implement automatic Clerk u…#3
superezzdev merged 1 commit into
mainfrom
feature/landing-page

Conversation

@superezzdev

@superezzdev superezzdev commented Aug 4, 2026

Copy link
Copy Markdown
Owner

…ser synchronization

Summary by CodeRabbit

  • New Features

    • Authenticated user profiles are now synchronized automatically when accessing protected areas.
    • User contact and profile information is stored and updated for a more consistent experience.
    • Added support for retrieving the currently signed-in user and their saved profile.
  • Database

    • Added initial user data storage and migration support.
    • Added safeguards for missing database configuration and unavailable user email information.
  • Chores

    • Added commands for database setup, migrations, and code quality checks.

Copilot AI lite review requested due to automatic review settings August 4, 2026 18:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@superezzdev
superezzdev merged commit d39b0a9 into main Aug 4, 2026
1 check was pending
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 47f4f39f-03f6-4b10-98ab-d3e3bd40b65c

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 8a1962e and c4ce38b.

β›” Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
πŸ“’ Files selected for processing (12)
  • app/(protected)/layout.tsx
  • db/index.ts
  • db/migrate.ts
  • db/queries/users.ts
  • db/schema/index.ts
  • db/schema/users.ts
  • drizzle.config.ts
  • drizzle/0000_aromatic_mandroid.sql
  • drizzle/meta/0000_snapshot.json
  • drizzle/meta/_journal.json
  • lib/auth/sync-user.ts
  • package.json

πŸ“ Walkthrough

Walkthrough

The PR adds a Drizzle users schema, Neon database access, migration tooling, Clerk user queries, authenticated-user synchronization, and protected-layout integration.

Changes

Authentication database synchronization

Layer / File(s) Summary
Database schema and migration foundation
db/schema/*, db/index.ts, db/migrate.ts, drizzle*, package.json
Defines the users table, indexes, constraints, Drizzle configuration, Neon client, migration runner, and database scripts and dependencies.
User query and upsert operations
db/queries/users.ts
Adds typed Clerk user input, lookup functions, and atomic insert-or-update behavior keyed by clerkId.
Authentication synchronization and protected rendering
lib/auth/sync-user.ts, app/(protected)/layout.tsx
Synchronizes authenticated Clerk users with the database and runs synchronization after auth.protect() before rendering protected content.

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

Sequence Diagram(s)

sequenceDiagram
  participant ProtectedLayout
  participant Clerk
  participant syncUser
  participant NeonPostgreSQL
  ProtectedLayout->>Clerk: run auth.protect()
  ProtectedLayout->>syncUser: await syncUser()
  syncUser->>Clerk: retrieve authenticated user
  syncUser->>NeonPostgreSQL: upsert Clerk profile
  NeonPostgreSQL-->>syncUser: return persisted user
  syncUser-->>ProtectedLayout: return database user or null
  ProtectedLayout-->>ProtectedLayout: render protected children
Loading

Possibly related PRs

  • superezzdev/veodit#2: Adds the Clerk authentication flow extended here with database-backed user synchronization.

Suggested reviewers: copilot

✨ 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 feature/landing-page

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

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