Overview
The registration endpoint creates a new user account using Supabase Auth. Upon successful registration, a user profile is automatically created via database trigger, and a confirmation email is sent to verify the email address.Users must confirm their email address before they can log in. The confirmation link is sent to the provided email.
Endpoint
Authentication
This endpoint does not require authentication.Request Body
User’s email address. Must be a valid email format.
User’s password. Must be at least 6 characters long.
User’s full name. Optional but recommended for better user experience.
Password confirmation. Must match the password field.
Response
The created user object from Supabase Auth.
The automatically created user profile.
Request Example
cURL
JavaScript
Response Example
Error Codes
| Code | Description |
|---|---|
VALIDATION_ERROR | Invalid input data (e.g., invalid email format, password too short) |
EMAIL_EXISTS | An account with this email already exists |
PASSWORD_MISMATCH | Password and confirmPassword fields do not match |
SUPABASE_ERROR | Internal error from Supabase Auth service |
Implementation Details
Authentication Flow
- Client submits registration form with email, password, and optional full name
- Frontend validates password length (min 6 chars) and password confirmation match
- Supabase Auth creates user account in
auth.userstable - Database trigger (
handle_new_user) automatically creates profile inprofilestable - Supabase sends confirmation email to user
- User clicks confirmation link to activate account
- User can now log in with their credentials
Database Trigger
Thehandle_new_user() trigger function automatically creates a profile when a new user is created:
Email Confirmation
Supabase automatically sends a confirmation email with a magic link. The link redirects to:Frontend Integration
The registration form is implemented in theRegisterForm component:
The
useAuth hook internally calls supabase.auth.signUp() which handles the API communication with Supabase.