Skip to main content

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
preferredLanguage
'en' | 'ar'
Preferred language for the customer (default: “en”)

Update Customer Profile

Update the authenticated customer’s profile details.
name
string
Display name of the customer
email
string
Email address of the customer
phoneNumber
string
Phone number of the customer
isPrivate
boolean
Account privacy setting (true = private, false = public)
preferences.preferredLanguage
'en' | 'ar'
Preferred language
preferences.pushNotifications
boolean
Enable push notifications
preferences.emailNotifications
boolean
Enable email notifications
preferences.smsNotifications
boolean
Enable SMS notifications

Avatar Management

Update Avatar

Upload and set a new avatar image for the customer.
avatarId
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).
username
string
required
New username (3-20 alphanumeric characters)

Check Username Availability

Check if a username is available and get suggestions.
username
string
required
Username to check

Search Customers by Username

Search for customers by their username.
searchTerm
string
required
Search term to match usernames
limit
number
Maximum number of results (default: 20)

Privacy Controls

Update Privacy Setting

Change account privacy (private accounts show content only to followers).
isPrivate
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.
customerId
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 with stores and customers arrays (not paginated).
customerId
Id<'customers'>
Customer ID (defaults to authenticated user)
type
'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).
customerId
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

Status Code: 200 (Success, returns existing customer)
Status Code: 400
Status Code: 404
Customer registration is idempotent - calling it multiple times for the same user will update preferences rather than create duplicate accounts.
Use the auto-registration pattern to seamlessly onboard users when they first authenticate, then guide them through preference setup.