Overview
The Customer Account API handles customer registration, profile management, and social features including following other customers and stores. This system integrates with Clerk authentication to provide comprehensive user account management. Location:convex/customers/account.ts
Register Customer
Register a new customer or update existing customer preferences. New customers automatically get:- Auto-generated unique username
- Default private account (followers only)
- Profile ready for avatar upload
'en' | 'ar'
Preferred language for the customer (default: “en”)
Update Customer Profile
Update the authenticated customer’s profile details.string
Display name of the customer
string
Email address of the customer
string
Phone number of the customer
boolean
Account privacy setting (true = private, false = public)
'en' | 'ar'
Preferred language
boolean
Enable push notifications
boolean
Enable email notifications
boolean
Enable SMS notifications
Avatar Management
Update Avatar
Upload and set a new avatar image for the customer.Id<'_storage'>
required
Storage ID of the uploaded avatar image
Remove Avatar
Remove the customer’s current avatar image.Username Management
Update Username
Change the customer’s username (must be unique).string
required
New username (3-20 alphanumeric characters)
Check Username Availability
Check if a username is available and get suggestions.string
required
Username to check
Search Customers by Username
Search for customers by their username.string
required
Search term to match usernames
number
Maximum number of results (default: 20)
Privacy Controls
Update Privacy Setting
Change account privacy (private accounts show content only to followers).boolean
required
Privacy setting (true = private, false = public)
Get Customer Profile
Retrieve customer profile information for the authenticated user or a specific customer. Respects privacy settings - private accounts are only visible to followers.Id<'customers'>
Customer ID (defaults to authenticated user)
Get Customer Followings
Retrieve stores and customers that the authenticated user is following. Returns a plain object withstores and customers arrays (not paginated).
Id<'customers'>
Customer ID (defaults to authenticated user)
'stores' | 'customers' | 'all'
Filter by follow type (default: “all”)
Get Customer Followers
Retrieve customers that follow the authenticated user. Returns a plain array of follower objects (not paginated).Id<'customers'>
Customer ID (defaults to authenticated user)
Customer Profile Component
Complete customer profile management:Customer Onboarding Flow
Complete onboarding process for new customers:Social Features
The account system includes social networking features:Follow Customers
Follow other customers to see their activity in your feed and discover new products through their interactions.
Follow Stores
Follow favorite stores to get notifications about new products, promotions, and special offers.
Activity Feed
See activity from followed customers and stores including new products, reviews, and recommendations.
Social Discovery
Discover new stores and products through your social network and trending content.
Privacy Settings
Customers can control their privacy preferences:Error Handling
Customer already registered
Customer already registered
Status Code:
200 (Success, returns existing customer)Invalid language preference
Invalid language preference
Status Code:
400Profile not found
Profile not found
Status Code:
404Customer registration is idempotent - calling it multiple times for the same user will update preferences rather than create duplicate accounts.
