Spaces:
Sleeping
Sleeping
File size: 3,941 Bytes
306583f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | # 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.
|