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
Preferred language for the customer (default: “en”)
Update Customer Profile
Update the authenticated customer’s profile details.Display name of the customer
Email address of the customer
Phone number of the customer
Account privacy setting (true = private, false = public)
Preferred language
Enable push notifications
Enable email notifications
Enable SMS notifications
Avatar Management
Update Avatar
Upload and set a new avatar image for the customer.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).New username (3-20 alphanumeric characters)
Check Username Availability
Check if a username is available and get suggestions.Username to check
Search Customers by Username
Search for customers by their username.Search term to match usernames
Maximum number of results (default: 20)
Privacy Controls
Update Privacy Setting
Change account privacy (private accounts show content only to followers).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.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).
Customer ID (defaults to authenticated user)
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).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.
