@@ -18,13 +18,21 @@ This monorepo contains:
18
18
- ** Environment variables** for secure key management
19
19
- ** Comprehensive tests** using Vitest
20
20
21
- ### Frontend (` packages/frontend-vanilla/ ` )
21
+ ### Frontend - Vanilla JavaScript (` packages/frontend-vanilla/ ` )
22
22
- ** Vanilla JavaScript** demo application
23
23
- ** jQuery integration** for AJAX calls
24
24
- ** Environment detection** (localhost vs production)
25
25
- ** Live Disqus integration** with login/logout functionality
26
26
- ** Responsive design** that works on mobile and desktop
27
27
28
+ ### Frontend - React (` packages/frontend-react/ ` )
29
+ - ** React 18** with modern hooks and functional components
30
+ - ** Vite** for fast development and optimized builds
31
+ - ** Axios** for HTTP requests to the SSO backend
32
+ - ** disqus-react** package for seamless Disqus integration
33
+ - ** ESLint** configuration for code quality
34
+ - ** Modern ES6+** syntax and module system
35
+
28
36
## 🛠️ Key Features
29
37
30
38
- ** 🔐 Secure Authentication** : HMAC-SHA1 signed payloads for Disqus SSO
@@ -48,11 +56,19 @@ sso-demo/
48
56
│ │ │ └── sso.test.js # Test suite
49
57
│ │ ├── wrangler.toml # Cloudflare Workers config
50
58
│ │ └── package.json
51
- │ └── frontend-vanilla/ # Vanilla JS frontend
52
- │ ├── index.html # Main demo page
59
+ │ ├── frontend-vanilla/ # Vanilla JS frontend
60
+ │ │ ├── index.html # Vanilla JS demo page
61
+ │ │ └── package.json
62
+ │ └── frontend-react/ # React frontend
53
63
│ ├── src/
54
- │ │ └── disqus-sso.js # SSO client library
64
+ │ │ ├── App.jsx # Main React component
65
+ │ │ ├── components/
66
+ │ │ │ └── DisqusSSO.jsx # SSO integration component
67
+ │ │ └── main.jsx # React entry point
68
+ │ ├── vite.config.js # Vite configuration
69
+ │ ├── eslint.config.js # ESLint configuration
55
70
│ └── package.json
71
+ ├── index.html # Landing page for demos
56
72
├── .github/
57
73
│ └── workflows/
58
74
│ ├── deploy.yml # Backend deployment
@@ -89,13 +105,17 @@ nano packages/backend/.dev.vars
89
105
# Start backend (Cloudflare Workers)
90
106
yarn dev
91
107
92
- # In another terminal, serve frontend
108
+ # In another terminal, serve vanilla frontend
93
109
yarn dev:vanilla
110
+
111
+ # Or serve React frontend
112
+ yarn dev:react
94
113
```
95
114
96
115
### 4. Test Locally
97
116
- Backend API: ` http://localhost:8787 `
98
- - Frontend Demo: ` http://localhost:3000 ` (or open ` packages/frontend-vanilla/index.html ` )
117
+ - Vanilla Frontend: ` http://localhost:3000 ` (or open ` packages/frontend-vanilla/index.html ` )
118
+ - React Frontend: ` http://localhost:3001 `
99
119
100
120
## 📡 API Endpoints
101
121
@@ -147,10 +167,15 @@ ALLOWED_ORIGINS=https://yourdomain.com,http://localhost:3000
147
167
```
148
168
149
169
### Frontend Configuration
150
- The frontend automatically detects the environment:
170
+ Both frontends automatically detect the environment:
151
171
- ** Development** : Uses ` http://localhost:8787 `
152
172
- ** Production** : Uses ` https://sso-serverless.ctang-402.workers.dev `
153
173
174
+ ** React-specific configuration:**
175
+ - Vite build configuration in ` vite.config.js `
176
+ - Base path set to ` /sso-demo/react/ ` for GitHub Pages deployment
177
+ - ESLint rules for React development
178
+
154
179
## 🚢 Deployment
155
180
156
181
### Backend (Cloudflare Workers)
@@ -167,7 +192,10 @@ Automatically deployed via GitHub Actions when you push to `main`:
167
192
```
168
193
169
194
### Frontend (GitHub Pages)
170
- Automatically deployed when frontend files change:
195
+ Automatically deployed when frontend files change. Both vanilla and React frontends are deployed to:
196
+ - ** Landing page** : ` https://disqus.github.io/sso-demo/ `
197
+ - ** Vanilla demo** : ` https://disqus.github.io/sso-demo/vanilla/ `
198
+ - ** React demo** : ` https://disqus.github.io/sso-demo/react/ `
171
199
172
200
1 . Enable GitHub Pages in repository settings:
173
201
- Go to Settings → Pages
@@ -191,6 +219,19 @@ yarn workspace @disqus-sso/backend test
191
219
yarn workspace @disqus-sso/backend test --watch
192
220
```
193
221
222
+ ## 🏗️ Building
223
+
224
+ ``` bash
225
+ # Build React frontend for production
226
+ yarn build:react
227
+
228
+ # Build both frontends for GitHub Pages
229
+ yarn build:pages
230
+
231
+ # Build all workspaces
232
+ yarn build
233
+ ```
234
+
194
235
## 🔒 Security
195
236
196
237
- ** HMAC-SHA1 Signatures** : All SSO payloads are cryptographically signed
0 commit comments