cauliflowerC
Convex Community5mo ago
4 replies
cauliflower

Using Convex + BetterAuth in a B2B Next.js app

Hi, I’m building a B2B application using Next.js, Convex, and BetterAuth. I have a couple of questions about how to correctly handle schemas and server-side API calls.

1. User & Organization schemas

I noticed that under convex/data → betterauth there are already tables created for me, such as:

account
apikey
invitation
jwks
member
oauthAccessToken
oauthApplication
oauthConsent
organization
passkey
rateLimit
session
ssoProvider
subscription
team
teamMember
twoFactor
user
verification
walletAddress


Do I need to create my own schema file for user and organization,
or should I continue using these BetterAuth-managed tables directly?

If I need to extend functionality (e.g., adding custom fields to users or organizations), what’s the recommended approach—extending these existing tables, or creating new ones that reference them?

2. Creating Organizations from the server

From the client side, I can create new organization entries into the BetterAuth organization table.
However, how should I handle server-side creation of organizations?

Is there a built-in BetterAuth/Convex API for this?

Or do I need to write my own Convex mutation that inserts into the BetterAuth organization table?
Any thoughts or comments would be appreciated!
Was this page helpful?