Skip to content

Commit 70f8ebf

Browse files
authored
Merge pull request #15 from tojemoc/cursor/dev-env-setup-2195
Add AGENTS.md with Cursor Cloud development instructions
2 parents 0cde23e + b56f60e commit 70f8ebf

3 files changed

Lines changed: 1649 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/
44
.env.*.local
55
*.tsbuildinfo
66
.wrangler/
7+
.dev.vars

AGENTS.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Cardex — Loyalty Wallet
2+
3+
PWA loyalty card wallet with passkey/magic-link auth and Cloudflare KV sync. Two packages: Vite frontend (root) and Cloudflare Worker API (`worker/`).
4+
5+
## Cursor Cloud specific instructions
6+
7+
### Project structure
8+
- **Frontend** (root): Vanilla TypeScript + Vite 8, PWA via `vite-plugin-pwa`. Dev server: `npm run dev``http://localhost:5173`
9+
- **Worker API** (`worker/`): Cloudflare Worker + Wrangler 3. Dev server: `cd worker && npm run dev``http://localhost:8787` (local KV emulated by Miniflare)
10+
11+
### Local environment files (not committed)
12+
- `.env.local` at root — must contain `VITE_API_URL=http://localhost:8787`
13+
- `worker/.dev.vars` — must contain `JWT_SECRET=<any-random-string>` (and optionally `BREVO_API_KEY` for magic-link email flow)
14+
15+
### Running dev servers
16+
Start both servers — order doesn't matter:
17+
```
18+
# Terminal 1 — Worker API
19+
cd worker && npm run dev
20+
21+
# Terminal 2 — Frontend
22+
npm run dev
23+
```
24+
The worker uses `wrangler dev` which emulates KV locally in `.wrangler/` — no Cloudflare account needed for local dev.
25+
26+
### Lint / type-check
27+
- Frontend: `npm run type-check` — note: there is a pre-existing TS error in `vite.config.ts` (`manualChunks` object form vs Rolldown's function expectation). This does not block `npm run dev`.
28+
- Worker: `cd worker && npm run type-check` — clean pass.
29+
- No ESLint or Prettier configured in this repo.
30+
31+
### Build
32+
- `npm run build` (`tsc && vite build`) — currently fails due to the same Vite 8 / Rolldown `manualChunks` issue described above. The dev server is unaffected.
33+
34+
### CORS for local dev
35+
The worker reads `Origin` header and reflects it in CORS responses. `http://localhost:5173` works automatically with `wrangler dev`.
36+
37+
### Dependencies
38+
- `npm install --legacy-peer-deps` is required at root due to `vite-plugin-pwa@1.x` peer-dep not covering `vite@8`.
39+
- `npm install` in `worker/` works without flags.
40+
41+
### Passkey auth on localhost
42+
Chrome allows WebAuthn on `localhost` without HTTPS. The worker's `FRONTEND_RP_ID` in `wrangler.toml` points to production; passkey registration will fail locally with an RP ID mismatch. Card management (add/edit/delete) works fully in offline/localStorage mode without authentication.

0 commit comments

Comments
 (0)