Self-Hosting Guide

Deploy TeachRepo on your own infrastructure. You get full control, zero platform fees, and can use your own Stripe account. Requires basic devops familiarity.

Prerequisites

1. Clone the repo

git clone https://github.com/ErlisK/openclaw-workspace.git
cd openclaw-workspace/startup-91-lean-launch-plan-repo-to-course-git-native-paywall/apps/web

2. Set up Supabase

Create a new Supabase project at supabase.com. Then run the schema migration:

# From the Supabase dashboard SQL editor, run:
# supabase/schema.sql
# supabase/rls.sql

Copy your Supabase project URL and anon key from Project Settings → API.

3. Configure environment variables

Create a .env.local file:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhb...
SUPABASE_SERVICE_ROLE_KEY=eyJhb...
STRIPE_SECRET_KEY=sk_test_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
NEXT_PUBLIC_APP_URL=https://yourdomain.com
STRIPE_WEBHOOK_SECRET=whsec_...

4. Configure Stripe webhooks

In Stripe Dashboard → Developers → Webhooks, add an endpoint:

https://yourdomain.com/api/webhooks/stripe

Enable these events:

checkout.session.completed
checkout.session.expired
charge.refunded

Copy the webhook signing secret into STRIPE_WEBHOOK_SECRET.

5. Deploy to Vercel

npm install -g vercel
vercel login
vercel --prod

Vercel will prompt you for a project name and auto-detect the Next.js framework. Add your environment variables in Vercel Dashboard → Settings → Environment Variables.

6. Custom domain

vercel domains add yourdomain.com

Add the DNS records Vercel gives you (A record + CNAME) to your DNS provider. Then update NEXT_PUBLIC_APP_URL to your domain.

7. (Optional) AI quiz generation

AI quiz generation uses the Vercel AI Gateway and requires deploying on Vercel (the OIDC token is injected at Vercel runtime). If you deploy elsewhere, set ANTHROPIC_API_KEY and update the quiz generate route to use it directly.

Need help?

Open an issue on GitHub or email hello@teachrepo.com.