@vatvaghool/create-ipl-dashboard 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/template/README.md +41 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatvaghool/create-ipl-dashboard",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Scaffold an IPL fantasy cricket dashboard project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,15 +12,7 @@ npx @vatvaghool/create-ipl-dashboard my-league
12
12
  npm install
13
13
  ```
14
14
 
15
- Create a `.env` file:
16
-
17
- ```env
18
- MONGODB_URI=your_mongodb_connection_string
19
- IPL_LEAGUE_URL=https://fantasy.iplt20.com/classic/league/view/your_league_id
20
- IPL_POST_SECRET=your_secret_here
21
- ```
22
-
23
- Start the app:
15
+ Start the dev server:
24
16
 
25
17
  ```bash
26
18
  npm run dev:simple
@@ -28,6 +20,27 @@ npm run dev:simple
28
20
 
29
21
  Open http://localhost:3000
30
22
 
23
+ ### Available commands
24
+
25
+ | Command | Description |
26
+ |---------|-------------|
27
+ | `npm run dev` | Dev server with welcome splash |
28
+ | `npm run dev:simple` | Dev server (simple, no splash) |
29
+ | `npm run build` | Production build |
30
+ | `npm start` | Production server |
31
+ | `npm run capture:ipl-auth` | Capture Playwright login state (one-time) |
32
+ | `npm run sync:ipl` | Scrape live leaderboard snapshot |
33
+ | `npm run sync:ipl:watch` | Scrape leaderboard in watch mode (polls every 2 min) |
34
+ | `npm run sync:ipl:transfers-daily` | Scrape transfer/booster data |
35
+ | `npm run sync:cloud` | Run both leaderboard + transfer sync (for cloud jobs) |
36
+ | `npm run seed:league` | Seed league metadata into storage |
37
+ | `npm run seed:mongodb` | Seed initial raw user data from `data.ts` |
38
+ | `npm run seed:mongodb:reset` | Reset and re-seed MongoDB data |
39
+ | `npm run verify:production` | Verify production setup |
40
+ | `npm run monitor:ops` | Check ops health status |
41
+ | `npm run test` | Run test suite |
42
+ | `npm run lint` | Run linter |
43
+
31
44
  ---
32
45
 
33
46
  ## Screenshots
@@ -116,9 +129,9 @@ Open http://localhost:3000
116
129
 
117
130
  ```
118
131
  GET /api/ipl resolution order:
119
- 1. MongoDB raw users (if MONGODB_URI configured)
132
+ 1. Storage raw users (if configured — MongoDB or Google Sheets)
120
133
  2. Fallback: local seed data (app/api/ipl/data.ts)
121
- 3. MongoDB live snapshot (if MONGODB_URI configured)
134
+ 3. Storage live snapshot (if configured)
122
135
  4. Fallback: local snapshot file (app/api/ipl/live-snapshot.json)
123
136
  ```
124
137
 
@@ -130,11 +143,16 @@ All hardcoded values are centralized in `app/lib/config.ts` and overridable via
130
143
 
131
144
  | Variable | Default | Description |
132
145
  |----------|---------|-------------|
133
- | `MONGODB_URI` | - | MongoDB connection string |
146
+ | `STORAGE_BACKEND` | `mongodb` | Storage backend: `mongodb` or `google_sheets` |
147
+ | `MONGODB_URI` | - | MongoDB connection string (for MongoDB backend) |
148
+ | `GOOGLE_SHEET_ID` | - | Google Sheet ID (for Google Sheets backend) |
149
+ | `GOOGLE_SERVICE_ACCOUNT_EMAIL` | - | Google service account email |
150
+ | `GOOGLE_PRIVATE_KEY` | - | Google service account private key |
151
+ | `LEAGUE_NAME` | - | League name (collection/sheet name) |
134
152
  | `IPL_LEAGUE_URL` | fantasy.iplt20.com/... | Fantasy league page URL |
135
153
  | `IPL_POST_SECRET` | - | Bearer token for POST endpoints |
136
- | `IPL_DB_NAME` | `ipl` | MongoDB database name |
137
- | `IPL_COLLECTION_NAME` | `ipl` | MongoDB collection name |
154
+ | `IPL_DB_NAME` | `ipl` | MongoDB database name (MongoDB only) |
155
+ | `IPL_COLLECTION_NAME` | `ipl` | MongoDB collection name (MongoDB only) |
138
156
  | `IPL_TOTAL_TRANSFERS` | `160` | Total transfers per season |
139
157
  | `IPL_SYNC_INTERVAL_MS` | `120000` | Dashboard polling interval |
140
158
  | `IPL_DASHBOARD_STALE_MINUTES` | `20` (prod) / `180` (dev) | Staleness threshold |
@@ -144,19 +162,7 @@ All hardcoded values are centralized in `app/lib/config.ts` and overridable via
144
162
 
145
163
  ## Automation
146
164
 
147
- ```bash
148
- # Capture login state for Playwright scrapers
149
- npm run capture:ipl-auth
150
-
151
- # Scrape live leaderboard snapshot
152
- npm run sync:ipl
153
-
154
- # Scrape transfer/booster data
155
- npm run sync:ipl:transfers
156
-
157
- # Run both in sequence (for cloud jobs)
158
- npm run sync:cloud
159
- ```
165
+ See the [commands table](#available-commands) above for all options.
160
166
 
161
167
  Also supports a browser bookmarklet — visit `/api/ipl/bookmarklet` while the app is running, copy the returned `javascript:` code, and save it as a bookmark. Click it on the fantasy leaderboard page to sync data.
162
168
 
@@ -178,7 +184,12 @@ Set these environment variables in your Vercel project dashboard:
178
184
 
179
185
  | Variable | Required | Description |
180
186
  |----------|----------|-------------|
181
- | `MONGODB_URI` | Yes | MongoDB connection string |
187
+ | `STORAGE_BACKEND` | Yes | `mongodb` or `google_sheets` |
188
+ | `MONGODB_URI` | Yes* | MongoDB connection string (required if `mongodb`) |
189
+ | `GOOGLE_SHEET_ID` | Yes* | Google Sheet ID (required if `google_sheets`) |
190
+ | `GOOGLE_SERVICE_ACCOUNT_EMAIL` | Yes* | Service account email (required if `google_sheets`) |
191
+ | `GOOGLE_PRIVATE_KEY` | Yes* | Private key (required if `google_sheets`) |
192
+ | `LEAGUE_NAME` | Yes | Collection or sheet name |
182
193
  | `IPL_POST_SECRET` | Yes | Bearer token protecting write endpoints |
183
194
  | `IPL_LEAGUE_URL` | Yes | Your fantasy league page URL |
184
195
  | `IPL_DASHBOARD_STALE_MINUTES` | No | Staleness threshold for health checks (default: `20`) |
@@ -204,7 +215,7 @@ The app runs as a standard Node.js server on `process.env.PORT` (default `3000`)
204
215
 
205
216
  ### Production requirements
206
217
 
207
- - **MongoDB** is required in production for POST endpoints (returns `503` without it)
218
+ - **Storage** (MongoDB or Google Sheets) is required in production for POST endpoints (returns `503` without it)
208
219
  - **IPL_POST_SECRET** should be a strong random value set in your hosting environment
209
220
  - The scraper should run outside the web app (Cloud Run, GitHub Actions, cron) — never in the same process
210
221
 
@@ -218,6 +229,6 @@ The app runs as a standard Node.js server on `process.env.PORT` (default `3000`)
218
229
  - **Tailwind CSS** 4
219
230
  - **Recharts** — charts
220
231
  - **Framer Motion** — animations
221
- - **MongoDB** — data persistence
232
+ - **MongoDB** or **Google Sheets** — data persistence
222
233
  - **Zustand** — client state
223
234
  - **Playwright** — scraper automation