Introduction
The Users API provides endpoints for managing user data in Ticket Hub. Users are automatically created and synced via Clerk webhooks, ensuring seamless authentication and user management.User Schema
Users in Ticket Hub have the following structure:Convex-generated unique identifier for the user
Clerk user ID - the primary identifier from Clerk authentication
Full name of the user (first name + last name from Clerk)
Primary email address from Clerk
Phone number from Clerk (optional)
Stripe Connect account ID for event organizers who want to receive payments
Clerk Integration
Ticket Hub uses Clerk for authentication and user management. User data is automatically synced through webhooks:User Creation Flow
- User signs up through Clerk authentication
- Clerk sends a webhook to your application
- The
upsertUserFromClerkinternal mutation processes the webhook - User is created or updated in the Convex database
Webhook Handler
TheupsertUserFromClerk mutation extracts the following data from Clerk:
- userId: Clerk user ID (
data.id) - email: Primary email address
- phone: Primary phone number (if provided)
- name: Combination of first and last name
User Updates
When a user updates their profile in Clerk, the same webhook mechanism ensures the Convex database stays in sync.Stripe Connect Integration
Event organizers can connect their Stripe accounts to receive payments directly. ThestripeConnectId field stores the Stripe Connect account ID.
Use Cases
- Event Creation: Organizers with Stripe Connect accounts can create paid events
- Payment Routing: Payments are routed to the organizer’s connected Stripe account
- Payout Management: Organizers manage payouts through their Stripe dashboard
Available Queries
Get User by ID
Retrieve user information by Clerk user ID
Get Stripe Connect ID
Retrieve a user’s Stripe Connect account ID
Database Indexes
The users table includes the following indexes for efficient querying:by_user_id: Query by Clerk userIdby_email: Query by email address
Internal Mutations
The following mutations are internal-only and called by webhooks:upsertUserFromClerk: Create or update user from Clerk webhookdeleteUser: Delete user when removed from ClerkupdateOrCreateUserStripeConnectId: Update Stripe Connect ID for event organizers