gaurv007 commited on
Commit
306583f
Β·
verified Β·
1 Parent(s): 4939516

v3.0: Upload actual DEPLOY.md content

Browse files
Files changed (1) hide show
  1. DEPLOY.md +137 -1
DEPLOY.md CHANGED
@@ -1 +1,137 @@
1
- /app/clauseguard/DEPLOY.md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ClauseGuard β€” Deployment Guide v3.0
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/Mokshith31/legalbert-contract-clause-classification |
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
+ 2. Open Chrome β†’ chrome://extensions/
23
+ 3. Toggle ON "Developer mode" (top right)
24
+ 4. Click "Load unpacked"
25
+ 5. Select the extension/ folder
26
+ 6. Visit any Terms of Service page (try spotify.com/legal or airbnb.com/terms)
27
+ 7. The extension will auto-scan and highlight unfair clauses
28
+ ```
29
+
30
+ To connect to a running API, change `API_BASE` in `background.js`.
31
+
32
+ ---
33
+
34
+ ## 2. Deploy the Backend (choose one)
35
+
36
+ ### Option A: HuggingFace Spaces (free, easiest)
37
+
38
+ Create a new Space with Docker SDK:
39
+
40
+ 1. Go to https://huggingface.co/new-space
41
+ 2. Name: `clauseguard-api`
42
+ 3. SDK: Docker
43
+ 4. Copy `api/main.py`, `api/auth.py`, `api/requirements.txt` into the Space
44
+ 5. Your API will be at: `https://gaurv007-clauseguard-api.hf.space`
45
+
46
+ ### Option B: Railway (free tier, auto-deploy)
47
+
48
+ ```bash
49
+ cd api/
50
+ railway login
51
+ railway init
52
+ railway up
53
+ ```
54
+
55
+ ### After deploying the backend:
56
+
57
+ Update `API_BASE` in `extension/background.js`:
58
+ ```javascript
59
+ const API_BASE = "https://your-backend-url.com";
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 3. Deploy the Website on Vercel (10 minutes)
65
+
66
+ ### Required environment variables on Vercel:
67
+
68
+ ```
69
+ NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
70
+ NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJ...
71
+ SUPABASE_SERVICE_ROLE_KEY=eyJ...
72
+ SUPABASE_JWT_SECRET=your-jwt-secret
73
+
74
+ # Payment: Razorpay (used in web/components/checkout-button.tsx and schema.sql)
75
+ NEXT_PUBLIC_RAZORPAY_KEY_ID=rzp_live_...
76
+ RAZORPAY_KEY_SECRET=...
77
+ RAZORPAY_WEBHOOK_SECRET=...
78
+
79
+ RESEND_API_KEY=re_...
80
+
81
+ NEXT_PUBLIC_SITE_URL=https://your-domain.vercel.app
82
+ CLAUSEGUARD_API_URL=https://your-backend-url.com
83
+ ```
84
+
85
+ > **Note:** The payment integration uses **Razorpay** (see `web/components/checkout-button.tsx`
86
+ > and `web/lib/supabase/schema.sql` which has `razorpay_subscription_id` columns).
87
+
88
+ ---
89
+
90
+ ## 4. Setup Supabase (5 minutes)
91
+
92
+ 1. Go to https://supabase.com β†’ New Project
93
+ 2. Go to SQL Editor β†’ paste and run `web/lib/supabase/schema.sql`
94
+ 3. Go to Authentication β†’ Providers β†’ Enable Google and GitHub
95
+ 4. Copy from Settings β†’ API:
96
+ - Project URL β†’ `NEXT_PUBLIC_SUPABASE_URL`
97
+ - `anon` public key β†’ `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`
98
+ - `service_role` key β†’ `SUPABASE_SERVICE_ROLE_KEY`
99
+ - JWT Secret β†’ `SUPABASE_JWT_SECRET`
100
+
101
+ ---
102
+
103
+ ## 5. Setup Razorpay (5 minutes)
104
+
105
+ 1. Go to https://dashboard.razorpay.com
106
+ 2. Create subscription plans:
107
+ - "ClauseGuard Pro" β€” β‚Ή999/month or $12/month
108
+ - "ClauseGuard Team" β€” β‚Ή3999/month or $49/month
109
+ 3. Settings β†’ API Keys β†’ Copy Key ID and Secret
110
+ 4. Settings β†’ Webhooks β†’ Add endpoint:
111
+ - URL: `https://your-site.vercel.app/api/webhooks/razorpay`
112
+ - Events: `subscription.activated`, `subscription.charged`, `subscription.cancelled`, `payment.failed`
113
+ 5. Copy webhook secret
114
+
115
+ ---
116
+
117
+ ## 6. Setup Resend (2 minutes)
118
+
119
+ 1. Go to https://resend.com β†’ Sign up
120
+ 2. API Keys β†’ Create β†’ Copy key β†’ `RESEND_API_KEY`
121
+ 3. Add your domain for email sending
122
+
123
+ ---
124
+
125
+ ## Order of operations
126
+
127
+ ```
128
+ 1. Supabase (create project, run schema) β€” 5 min
129
+ 2. Backend (deploy to Railway/Render/HF) β€” 5 min
130
+ 3. Razorpay (create plans) β€” 5 min
131
+ 4. Resend (get API key) β€” 2 min
132
+ 5. Vercel (deploy with all env vars) β€” 10 min
133
+ 6. Extension (update API_BASE, load unpacked) β€” 2 min
134
+ 7. Test everything end-to-end β€” 5 min
135
+ ```
136
+
137
+ Total: ~35 minutes to go fully live.