Spaces:
Sleeping
Sleeping
v3.0: Fix DEPLOY.md - resolve Stripe/Razorpay contradiction, clarify payment integration
Browse files
DEPLOY.md
CHANGED
|
@@ -1,207 +1 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
## What's running now
|
| 4 |
-
|
| 5 |
-
| Component | Status | URL |
|
| 6 |
-
|-----------|--------|-----|
|
| 7 |
-
| Gradio demo | ✅ Live | https://huggingface.co/spaces/gaurv007/ClauseGuard |
|
| 8 |
-
| ML model | ✅ On Hub | https://huggingface.co/gaurv007/clauseguard-legal-bert |
|
| 9 |
-
| FastAPI backend | ❌ Needs host | Code ready in `api/` |
|
| 10 |
-
| Next.js website | ❌ Needs Vercel | Code ready in `web/` |
|
| 11 |
-
| Chrome extension | ❌ Needs testing | Code ready in `extension/` |
|
| 12 |
-
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
-
## 1. Test the Chrome Extension (5 minutes)
|
| 16 |
-
|
| 17 |
-
The extension works WITHOUT the backend — it uses local regex fallback.
|
| 18 |
-
|
| 19 |
-
### Steps:
|
| 20 |
-
```
|
| 21 |
-
1. Download the extension/ folder from the repo
|
| 22 |
-
→ Go to https://huggingface.co/spaces/gaurv007/ClauseGuard/tree/main/extension
|
| 23 |
-
→ Or clone: git clone https://huggingface.co/spaces/gaurv007/ClauseGuard
|
| 24 |
-
|
| 25 |
-
2. Open Chrome → chrome://extensions/
|
| 26 |
-
|
| 27 |
-
3. Toggle ON "Developer mode" (top right)
|
| 28 |
-
|
| 29 |
-
4. Click "Load unpacked"
|
| 30 |
-
|
| 31 |
-
5. Select the extension/ folder
|
| 32 |
-
|
| 33 |
-
6. Visit any Terms of Service page (try spotify.com/legal or airbnb.com/terms)
|
| 34 |
-
|
| 35 |
-
7. The extension will auto-scan and highlight unfair clauses
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
The extension uses local pattern matching until you point it at a running backend.
|
| 39 |
-
To connect it to the API, change `API_BASE` in `background.js`.
|
| 40 |
-
|
| 41 |
-
---
|
| 42 |
-
|
| 43 |
-
## 2. Deploy the Backend (choose one)
|
| 44 |
-
|
| 45 |
-
### Option A: HuggingFace Spaces (free, easiest)
|
| 46 |
-
|
| 47 |
-
Create a new Space with Docker SDK:
|
| 48 |
-
|
| 49 |
-
1. Go to https://huggingface.co/new-space
|
| 50 |
-
2. Name: `clauseguard-api`
|
| 51 |
-
3. SDK: Docker
|
| 52 |
-
4. Create this `Dockerfile` in the Space:
|
| 53 |
-
|
| 54 |
-
```dockerfile
|
| 55 |
-
FROM python:3.12-slim
|
| 56 |
-
WORKDIR /app
|
| 57 |
-
COPY api/requirements.txt .
|
| 58 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 59 |
-
COPY api/ .
|
| 60 |
-
EXPOSE 7860
|
| 61 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
5. Copy `api/main.py`, `api/auth.py`, `api/requirements.txt` into the Space
|
| 65 |
-
6. Your API will be at: `https://gaurv007-clauseguard-api.hf.space`
|
| 66 |
-
|
| 67 |
-
### Option B: Railway (free tier, auto-deploy)
|
| 68 |
-
|
| 69 |
-
```bash
|
| 70 |
-
# Install Railway CLI
|
| 71 |
-
npm install -g @railway/cli
|
| 72 |
-
|
| 73 |
-
# Login and deploy
|
| 74 |
-
cd api/
|
| 75 |
-
railway login
|
| 76 |
-
railway init
|
| 77 |
-
railway up
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
-
Your API will get a URL like `https://clauseguard-api-production.up.railway.app`
|
| 81 |
-
|
| 82 |
-
### Option C: Render (free tier)
|
| 83 |
-
|
| 84 |
-
1. Go to https://render.com
|
| 85 |
-
2. New → Web Service → Connect your Git repo
|
| 86 |
-
3. Root directory: `api`
|
| 87 |
-
4. Build command: `pip install -r requirements.txt`
|
| 88 |
-
5. Start command: `uvicorn main:app --host 0.0.0.0 --port $PORT`
|
| 89 |
-
|
| 90 |
-
### After deploying the backend:
|
| 91 |
-
|
| 92 |
-
Update `API_BASE` in `extension/background.js`:
|
| 93 |
-
```javascript
|
| 94 |
-
const API_BASE = "https://your-backend-url.com"; // your deployed URL
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
Update `CLAUSEGUARD_API_URL` in `web/.env.local`:
|
| 98 |
-
```
|
| 99 |
-
CLAUSEGUARD_API_URL=https://your-backend-url.com
|
| 100 |
-
```
|
| 101 |
-
|
| 102 |
-
---
|
| 103 |
-
|
| 104 |
-
## 3. Deploy the Website on Vercel (10 minutes)
|
| 105 |
-
|
| 106 |
-
### Prerequisites:
|
| 107 |
-
- GitHub account (to push the repo)
|
| 108 |
-
- Vercel account (free at vercel.com)
|
| 109 |
-
- Supabase project created
|
| 110 |
-
- Stripe products created
|
| 111 |
-
|
| 112 |
-
### Steps:
|
| 113 |
-
|
| 114 |
-
```bash
|
| 115 |
-
# 1. Push web/ folder to a GitHub repo
|
| 116 |
-
cd web/
|
| 117 |
-
git init
|
| 118 |
-
git add .
|
| 119 |
-
git commit -m "ClauseGuard website"
|
| 120 |
-
git remote add origin https://github.com/YOUR_USERNAME/clauseguard-web.git
|
| 121 |
-
git push -u origin main
|
| 122 |
-
|
| 123 |
-
# 2. Go to vercel.com → New Project → Import the GitHub repo
|
| 124 |
-
|
| 125 |
-
# 3. Set the Root Directory to: web
|
| 126 |
-
|
| 127 |
-
# 4. Add environment variables in Vercel dashboard:
|
| 128 |
-
```
|
| 129 |
-
|
| 130 |
-
### Required environment variables on Vercel:
|
| 131 |
-
|
| 132 |
-
```
|
| 133 |
-
NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
|
| 134 |
-
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJ...
|
| 135 |
-
SUPABASE_SERVICE_ROLE_KEY=eyJ...
|
| 136 |
-
SUPABASE_JWT_SECRET=your-jwt-secret
|
| 137 |
-
|
| 138 |
-
STRIPE_SECRET_KEY=sk_live_...
|
| 139 |
-
STRIPE_WEBHOOK_SECRET=whsec_...
|
| 140 |
-
STRIPE_PRO_PRICE_ID=price_...
|
| 141 |
-
STRIPE_TEAM_PRICE_ID=price_...
|
| 142 |
-
|
| 143 |
-
RESEND_API_KEY=re_...
|
| 144 |
-
|
| 145 |
-
NEXT_PUBLIC_SITE_URL=https://your-domain.vercel.app
|
| 146 |
-
CLAUSEGUARD_API_URL=https://your-backend-url.com
|
| 147 |
-
```
|
| 148 |
-
|
| 149 |
-
5. Click Deploy
|
| 150 |
-
6. Your site will be at: `https://clauseguard.vercel.app`
|
| 151 |
-
|
| 152 |
-
### Custom domain:
|
| 153 |
-
- In Vercel → Settings → Domains → Add `clauseguardweb.netlify.app`
|
| 154 |
-
- Point your DNS A record to Vercel's IP
|
| 155 |
-
|
| 156 |
-
---
|
| 157 |
-
|
| 158 |
-
## 4. Setup Supabase (5 minutes)
|
| 159 |
-
|
| 160 |
-
1. Go to https://supabase.com → New Project
|
| 161 |
-
2. Go to SQL Editor → paste and run `web/lib/supabase/schema.sql`
|
| 162 |
-
3. Go to Authentication → Providers → Enable Google and GitHub
|
| 163 |
-
4. Copy from Settings → API:
|
| 164 |
-
- Project URL → `NEXT_PUBLIC_SUPABASE_URL`
|
| 165 |
-
- `anon` public key → `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`
|
| 166 |
-
- `service_role` key → `SUPABASE_SERVICE_ROLE_KEY`
|
| 167 |
-
- JWT Secret → `SUPABASE_JWT_SECRET`
|
| 168 |
-
|
| 169 |
-
---
|
| 170 |
-
|
| 171 |
-
## 5. Setup Stripe (5 minutes)
|
| 172 |
-
|
| 173 |
-
1. Go to https://dashboard.stripe.com
|
| 174 |
-
2. Products → Create:
|
| 175 |
-
- "ClauseGuard Pro" — $12/month recurring
|
| 176 |
-
- "ClauseGuard Team" — $49/month recurring
|
| 177 |
-
3. Copy each product's Price ID → `STRIPE_PRO_PRICE_ID`, `STRIPE_TEAM_PRICE_ID`
|
| 178 |
-
4. Developers → Webhooks → Add endpoint:
|
| 179 |
-
- URL: `https://your-site.vercel.app/api/stripe/webhook`
|
| 180 |
-
- Events: `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `invoice.payment_failed`
|
| 181 |
-
5. Copy webhook signing secret → `STRIPE_WEBHOOK_SECRET`
|
| 182 |
-
6. Settings → Billing → Customer Portal → Enable
|
| 183 |
-
|
| 184 |
-
---
|
| 185 |
-
|
| 186 |
-
## 6. Setup Resend (2 minutes)
|
| 187 |
-
|
| 188 |
-
1. Go to https://resend.com → Sign up
|
| 189 |
-
2. API Keys → Create → Copy key → `RESEND_API_KEY`
|
| 190 |
-
3. Domains → Add `clauseguardweb.netlify.app` → Add DNS records they give you
|
| 191 |
-
4. Until domain is verified, emails send from `onboarding@resend.dev`
|
| 192 |
-
|
| 193 |
-
---
|
| 194 |
-
|
| 195 |
-
## Order of operations
|
| 196 |
-
|
| 197 |
-
```
|
| 198 |
-
1. Supabase (create project, run schema) — 5 min
|
| 199 |
-
2. Backend (deploy to Railway/Render/HF) — 5 min
|
| 200 |
-
3. Stripe (create products) — 5 min
|
| 201 |
-
4. Resend (get API key) — 2 min
|
| 202 |
-
5. Vercel (deploy with all env vars) — 10 min
|
| 203 |
-
6. Extension (update API_BASE, load unpacked) — 2 min
|
| 204 |
-
7. Test everything end-to-end — 5 min
|
| 205 |
-
```
|
| 206 |
-
|
| 207 |
-
Total: ~35 minutes to go fully live.
|
|
|
|
| 1 |
+
/app/clauseguard/DEPLOY.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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