feat: Google sign-in via Clerk and per-user Stripe billing#24
Open
GeorgePearse wants to merge 1 commit intomainfrom
Open
feat: Google sign-in via Clerk and per-user Stripe billing#24GeorgePearse wants to merge 1 commit intomainfrom
GeorgePearse wants to merge 1 commit intomainfrom
Conversation
- Add Clerk React SDK for frontend auth with Google sign-in - Add Clerk Express middleware for server-side session verification - Add Stripe Checkout for subscription purchases - Add Stripe Billing Portal for self-serve management - Add Stripe webhook handler for subscription lifecycle events - Add Postgres schema (users + subscriptions tables) with migration - Add BillingGate component to gate app behind active subscription - Add subscription check middleware on all data API routes - Update .env.example with Clerk, Stripe, and DATABASE_URL vars Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds authentication (Google sign-in) and per-user subscription billing to the Genesis WebUI, following the plan outlined in the README's "Hosted Auth and Payments Plan" section.
Changes
Authentication (Clerk)
ClerkProviderwraps the app inmain.tsx;SignedIn/SignedOutgates inApp.tsxshow a sign-in page when unauthenticatedclerkMiddleware()+requireAuth()on all data routes inserver/index.tsBilling (Stripe)
server/billing.ts: Stripe Checkout session creation, Billing Portal session creation, and webhook handler forcheckout.session.completed,customer.subscription.updated,customer.subscription.deletedBillingGate.tsx: Frontend component that checks subscription status and redirects to Stripe Checkout if no active subscription existsUser/Subscription Database
migrations/001_users_subscriptions.sql: Postgres schema withusersandsubscriptionstablesserver/db.ts: Connection pool and CRUD queries viapgServer Gateway
/api/billing/*) require auth but not a subscription/api/webhooks/stripe) is exempt from both (verified by signature)Environment
.env.exampleupdated withVITE_CLERK_PUBLISHABLE_KEY,CLERK_SECRET_KEY,STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,STRIPE_PRICE_ID,DATABASE_URL,APP_URLUser Flow
Setup Required
migrations/001_users_subscriptions.sql.env.exampleVerification
tsc -bpasses cleanlyoxlint srcreports 0 warnings, 0 errorsvite buildsucceeds