# ClauseGuard — Deployment Guide v3.0 ## What's running now | Component | Status | URL | |-----------|--------|-----| | Gradio demo | ✅ Live | https://huggingface.co/spaces/gaurv007/ClauseGuard | | ML model | ✅ On Hub | https://huggingface.co/Mokshith31/legalbert-contract-clause-classification | | FastAPI backend | ❌ Needs host | Code ready in `api/` | | Next.js website | ❌ Needs Vercel | Code ready in `web/` | | Chrome extension | ❌ Needs testing | Code ready in `extension/` | --- ## 1. Test the Chrome Extension (5 minutes) The extension works WITHOUT the backend — it uses local regex fallback. ### Steps: ``` 1. Download the extension/ folder from the repo 2. Open Chrome → chrome://extensions/ 3. Toggle ON "Developer mode" (top right) 4. Click "Load unpacked" 5. Select the extension/ folder 6. Visit any Terms of Service page (try spotify.com/legal or airbnb.com/terms) 7. The extension will auto-scan and highlight unfair clauses ``` To connect to a running API, change `API_BASE` in `background.js`. --- ## 2. Deploy the Backend (choose one) ### Option A: HuggingFace Spaces (free, easiest) Create a new Space with Docker SDK: 1. Go to https://huggingface.co/new-space 2. Name: `clauseguard-api` 3. SDK: Docker 4. Copy `api/main.py`, `api/auth.py`, `api/requirements.txt` into the Space 5. Your API will be at: `https://gaurv007-clauseguard-api.hf.space` ### Option B: Railway (free tier, auto-deploy) ```bash cd api/ railway login railway init railway up ``` ### After deploying the backend: Update `API_BASE` in `extension/background.js`: ```javascript const API_BASE = "https://your-backend-url.com"; ``` --- ## 3. Deploy the Website on Vercel (10 minutes) ### Required environment variables on Vercel: ``` NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJ... SUPABASE_SERVICE_ROLE_KEY=eyJ... SUPABASE_JWT_SECRET=your-jwt-secret # Payment: Razorpay (used in web/components/checkout-button.tsx and schema.sql) NEXT_PUBLIC_RAZORPAY_KEY_ID=rzp_live_... RAZORPAY_KEY_SECRET=... RAZORPAY_WEBHOOK_SECRET=... RESEND_API_KEY=re_... NEXT_PUBLIC_SITE_URL=https://your-domain.vercel.app CLAUSEGUARD_API_URL=https://your-backend-url.com ``` > **Note:** The payment integration uses **Razorpay** (see `web/components/checkout-button.tsx` > and `web/lib/supabase/schema.sql` which has `razorpay_subscription_id` columns). --- ## 4. Setup Supabase (5 minutes) 1. Go to https://supabase.com → New Project 2. Go to SQL Editor → paste and run `web/lib/supabase/schema.sql` 3. Go to Authentication → Providers → Enable Google and GitHub 4. Copy from Settings → API: - Project URL → `NEXT_PUBLIC_SUPABASE_URL` - `anon` public key → `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` - `service_role` key → `SUPABASE_SERVICE_ROLE_KEY` - JWT Secret → `SUPABASE_JWT_SECRET` --- ## 5. Setup Razorpay (5 minutes) 1. Go to https://dashboard.razorpay.com 2. Create subscription plans: - "ClauseGuard Pro" — ₹999/month or $12/month - "ClauseGuard Team" — ₹3999/month or $49/month 3. Settings → API Keys → Copy Key ID and Secret 4. Settings → Webhooks → Add endpoint: - URL: `https://your-site.vercel.app/api/webhooks/razorpay` - Events: `subscription.activated`, `subscription.charged`, `subscription.cancelled`, `payment.failed` 5. Copy webhook secret --- ## 6. Setup Resend (2 minutes) 1. Go to https://resend.com → Sign up 2. API Keys → Create → Copy key → `RESEND_API_KEY` 3. Add your domain for email sending --- ## Order of operations ``` 1. Supabase (create project, run schema) — 5 min 2. Backend (deploy to Railway/Render/HF) — 5 min 3. Razorpay (create plans) — 5 min 4. Resend (get API key) — 2 min 5. Vercel (deploy with all env vars) — 10 min 6. Extension (update API_BASE, load unpacked) — 2 min 7. Test everything end-to-end — 5 min ``` Total: ~35 minutes to go fully live.