How thomasballinger/convex-clerk-users-table works
Project Type and Purpose
• This is a full-stack, real-time chat application with user authentication.
• Frontend: React (TSX) + Vite.
• Backend: Convex serverless functions + Convex DB.
• Authentication: Clerk (external service), with webhooks keeping the “users” table in sync.
File Structure Analysis
• Top-level “src/”: React components (App.tsx, LoginPage.tsx, SigningUp.tsx), entry point (main.tsx), styling (index.css).
• index.html and vite.config.ts: static shell and build configuration.
• “convex/”:
• schema.ts defines Convex data model (messages, users).
• sendMessage.ts & listMessages.ts: RPC functions for sending/listing chat messages.
• users.ts & http.ts: HTTP handler for Clerk webhooks updating user records.
• auth.config.js: JWT validation config for Convex.
• _generated/: TypeScript definitions for API, server, dataModel.
Key Architectural Insights from README
• The frontend uses ClerkProvider (in main.tsx) with a publishable key, obtains JWTs.
• Convex functions authenticate requests using auth.config.js.
• Clerk webhooks post user-lifecycle events to the Convex HTTP endpoint, updating the “users” table.
• Frontend subscribes (via Convex client) to live updates on messages and users.