1. Front Matter
Title: User Signup
Author: Sean Patrick Caintic
Reviewers: Joshua Uriel Tribiana
Created: February 2026
Status: Approved
References:
Issue: [0.4] User SignUp #14
Milestone: [0] Auth & Security
2. Introduction & Goals
Problem Summary: New users need a secure, frictionless way to create accounts. The system should support both traditional email/password and social login (Google OAuth) while syncing user data to the application database.
Goals:
Enable email/password registration with OTP verification
Support Google OAuth for one-click signup
Sync new users to
app_userstable via webhookAssign default CREATOR role
Non-Goals:
Additional OAuth providers (GitHub, Facebook)
Passwordless/magic link signup
Admin-created accounts
Glossary:
OTP: One-time password for email verification
Webhook: Server-to-server callback from Clerk on user events
3. High-Level Architecture
System Diagram:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ Signup Form │────▶│ Clerk Auth │────▶│ User Creation ││ (Email/Google) │ │ (Registration) │ │ (Clerk) │└─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ │ ▼ ▼ ▼┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ Email Verify │ │ OAuth Consent │ │ Webhook Sync ││ (OTP Flow) │ │ (Google) │ │ (app_users) │└─────────────────┘ └─────────────────┘ └─────────────────┘
Technologies Used:
Clerk - Authentication, OAuth, email verification
Svix - Webhook signature verification
Supabase - User data storage (
app_users)
4. Detailed Design & Implementation
Data Model / Schema:
app_usersTable:Column
Type
Description
idUUID PK
Auto-generated
clerk_idTEXT UNIQUE
Clerk user ID
emailTEXT
Primary email
first_nameTEXT
From registration
last_nameTEXT
From registration
avatar_urlTEXT
Profile image URL
roleTEXT
Default: CREATOR
agency_idUUID FK
Optional agency association
created_atTIMESTAMPTZ
Registration timestamp
API Specification:
POST /api/webhooks/clerk- Clerk webhook for user sync
Webhook Events Handled:
user.created→ Insert toapp_usersuser.updated→ Updateapp_usersuser.deleted→ Soft delete fromapp_users
Logic & Workflows:
Email Registration Flow:
User enters email + password
Clerk sends OTP to email
User enters OTP code
Account created in Clerk
Webhook triggers → sync to
app_usersRedirect to
/creator
Google OAuth Flow:
User clicks "Sign up with Google"
Google consent screen
Profile imported (name, avatar, email pre-verified)
Account created in Clerk
Webhook triggers → sync to
app_usersRedirect to
/creator
Key Files:
app/(auth)/sign-up/[[...sign-up]]/page.tsx- Signup formapp/api/webhooks/clerk/route.ts- Webhook handler
5. Infrastructure & Operations
Dependencies:
Clerk - Authentication
Google OAuth - Social login
Supabase - User data storage
Monitoring & Alerting:
Clerk Dashboard: Registration metrics, failed signups
Supabase Logs: Webhook insert failures
Deployment Plan:
Configure
CLERK_WEBHOOK_SECRETenv varAdd webhook endpoint URL in Clerk dashboard
Test webhook with Clerk CLI
Deploy to production
6. Testing & Quality Assurance
Test Strategy:
Manual: Email signup, Google OAuth
Integration: Webhook sync to
app_users
Known Limitations:
Only Google OAuth supported (no GitHub, Facebook)
Email verification required for email signups
7. Maintenance & Support
Troubleshooting:
User not in
app_users→ Check webhook logs, verify signatureGoogle OAuth fails → Verify Google OAuth credentials in Clerk
Email already exists → User may have existing account
Changelog:
1.0 (Feb 2026): Initial implementation
Document Version
1.0 - Approved, Feature deployed to production, 02/14/2026