AI Study Platform for African Students
# PassAI — Complete Deployment Guide 🚀
## Stack Overview
```
Frontend → Vercel (React/Next.js)
Backend → Railway (Node.js Express)
Database → Supabase (Postgres + Auth + RLS)
Cache → Upstash Redis
Payments → Stripe
AI → Anthropic Claude (claude-sonnet-4-20250514)
```
---
## Step 1 — Supabase Setup (Database + Auth)
1. Go to supabase.com → New Project
2. Name it `passai` → Choose region closest to Nigeria (eu-west or us-east)
3. In the SQL Editor, run `schema.sql` (this file is in your project)
4. Go to **Authentication → Settings**:
- Enable Email/Password sign-ins âś…
- Set Site URL to your frontend URL
5. Get your keys from **Project Settings → API**:
- `SUPABASE_URL` = Project URL
- `SUPABASE_SERVICE_KEY` = `service_role` key (keep secret!)
---
## Step 2 — Stripe Setup (Payments)
1. Create account at stripe.com
2. In **Products**, create two products:
- **PassAI Basic** → ₦4,000/month recurring
- **PassAI Pro** → ₦8,000/month recurring
3. Copy each Price ID → set as `STRIPE_PRICE_BASIC` and `STRIPE_PRICE_PRO`
4. Go to **Developers → Webhooks** → Add endpoint:
- URL: `
your-railway-app.railway.app`
- Events to listen for:
- `checkout.session.completed`
- `customer.subscription.updated`
- `customer.subscription.deleted`
- `invoice.payment_failed`
5. Copy Webhook Signing Secret → set as `STRIPE_WEBHOOK_SECRET`
> **Note on Nigerian payments:** Stripe supports Naira (NGN). Enable in Dashboard → Settings → Currencies. For local Nigerian payments (Paystack/Flutterwave), you can add them as an alternative alongside Stripe.
---
## Step 3 — Upstash Redis (Rate Limiting + Cache)
1. Go to console.upstash.com
2. Create a Redis database → Choose closest region
3. Copy the **ioredis connection string** → set as `UPSTASH_REDIS_URL`
---
## Step 4 — Railway Deployment (Backend)
1. Go to railway.app → New Project → Deploy from GitHub
2. Connect your `passai-backend` repository
3. In **Settings → Variables**, add all env vars from `. …