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 `. β¦