Spaces:
Sleeping
Sleeping
| # 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. | |