Set Up DB, Auth, and Payments
Once the marketing surface is clear enough, wire the dynamic stack in this order:
- Clerk
- Convex
- Stripe
Why this order matters
Clerk identifies the user. Convex stores product access and product state. Stripe finishes the payment flow. If those three systems do not agree on the same user and environment values, checkout can look successful while access still fails.
The plain-English version
- Clerk is your identity system.
- Convex is your app state and product-access system.
- Stripe is your payment system.
- Environment variables are the private keys and URLs that let those systems talk to each other.
The setup path
- Follow Clerk + Convex Auth.
- Confirm the Clerk JWT template is named exactly
convex. - Run
bun run dev:convexso.env.localgets the currentNEXT_PUBLIC_CONVEX_URLandCONVEX_DEPLOYMENTvalues for your hosted Convex dev deployment. - Follow Stripe Checkout + Webhook.
- Create the Stripe product and price from the repo scripts.
- Start the Stripe dev listener and let it sync the current webhook secret plus Stripe secret into your hosted Convex dev deployment.
Safety rules
- Start in test mode or a safe sandbox first.
- Do not start with live Stripe mode.
- Restart the app if the Stripe listener writes a new webhook secret.
- Keep the app and Convex on the same webhook secret and Stripe secret key.
What success looks like
You are wired correctly when:
- sign-in works
- protected routes can read viewer state
- checkout starts from the app
- the webhook grants product access
/checkout/successeventually routes the buyer into/start
Last updated on