revert back from .env attempt

This commit is contained in:
JCEEE
2026-06-23 22:47:02 +01:00
parent 95d9db3de4
commit be572b487a
7 changed files with 32 additions and 384 deletions
+20 -13
View File
@@ -9,6 +9,7 @@
# FamChore v2 — AI Agent Reference
## Stack
- SvelteKit (SSR frontend, internal :2080) + Hono proxy (internal :3456) + nginx (container :3001)
- PocketBase (separate Coolify service at `pb.chores.app.com`, :8090)
- Stripe one-time donations
@@ -17,11 +18,11 @@
## Auth
| Role | Auth | Session |
|---|---|---|
| Super admin (me) | PB email+pass | 24hr JWT |
| Fam admin | PB email+pass | 24hr JWT, scoped to own fam |
| Member | Invite code + device token | localStorage, no expiry |
| Role | Auth | Session |
| ---------------- | -------------------------- | --------------------------- |
| Super admin (me) | PB email+pass | 24hr JWT |
| Fam admin | PB email+pass | 24hr JWT, scoped to own fam |
| Member | Invite code + device token | localStorage, no expiry |
## PB Collections (all scoped by `famId`)
@@ -49,12 +50,13 @@
## Data Flow
- **Chore toggle:** Browser → PB SDK directly (auth via device token or admin JWT)
- **Admin CRUD:** Browser → PB SDK (admin JWT)
- **Reward creation:** After completion toggle, SvelteKit server creates reward if threshold met
- **Chore toggle:** Browser → Hono proxy → PB (auth via device token or admin JWT)
- **Admin CRUD:** Browser → Hono proxy → PB (admin JWT)
- **Reward creation:** After completion toggle, Hono proxy creates reward if threshold met
- **Weekly CRON:** Coolify → `GET /api/weekly-cron` on Hono → Hono queries PB, computes summaries, upserts weekly_history
- **Strip donate:** Browser → Hono `/api/stripe/create-checkout` → Stripe → Hono webhook → update fam
- **Stripe donate:** Browser → Hono `/api/stripe/create-checkout` → Stripe → Hono webhook → update fam
- **WhatsApp:** Deferred — Hono CRON handler has pluggable notification interface
- **UI reactivity:** Svelte `$state` / `$derived` / `$effect` — no PB SDK `.subscribe()` / SSE
## Conventions
@@ -66,7 +68,7 @@
- Docker: `docker/Dockerfile` (prod, multi-stage + nginx) + `docker/Dockerfile.dev` (PocketBase)
- Nginx routes in prod: `/api/*` → Hono (`:3456`), `/*` → SvelteKit (`:2080`)
- Ports: frontend `2080`, proxy `3456`, container ext `3001` (port `3000` is reserved)
- Environment: `FRONTEND_PORT`, `PROXY_PORT`, `PB_URL`, `PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD`, `STRIPE_SECRET_KEY`, `DONATION_MODAL_INTERVAL`
- Environment: `FRONTEND_PORT`, `PROXY_PORT`, `PB_PORT`, `PB_EMAIL`, `PB_PASSWORD`, `DEBUG_RECORD_ID`, `STRIPE_SECRET_KEY`, `DONATION_MODAL_INTERVAL`
- Seed via JSON dump (portable for dev)
- Monorepo: SvelteKit in `frontend/`, Hono in `proxy/`, two Dockerfiles
- Decisions tracked in `MEMORY.md`
@@ -74,23 +76,25 @@
## Build Phases (must validate each before next)
### Phase 1 — Infrastructure
1.1 Scaffold SvelteKit + Hono monorepo
1.2 Write Dockerfiles (frontend + backend, correct port mapping)
1.3 Deploy PocketBase on Coolify → validate data persists
1.4 Deploy SvelteKit+Hono on Coolify → validate routing
1.3 Sort out vars (`.env` + `.env.example`)
1.5 Validate Hono `/api/*` reachable, env vars injected
1.6 Validate SvelteKit↔PB connectivity (admin API read/write)
### Phase 2 — Backend Core
2.1 Create PB collections via schema/migration
2.2 Super admin seed + fam signup flow
2.3 Fam admin login (email/pass → 24hr JWT)
2.4 Invite code generation + member join flow
2.5 Device token auth + route guards
2.6 PB realtime SSE subscriptions from FE
2.6 Svelte reactive state management (no PB SSE)
2.7 Remote functions (PB SDK client helpers)
### Phase 3 — Backend Data Streams
3.1 Chore template CRUD + assignment grid (admin)
3.2 Completion toggle (member → PB direct)
3.3 Weekly progress + history computation
@@ -102,6 +106,7 @@
3.9 Notification interface (WhatsApp deferred)
### Phase 4 — Frontend App
4.1 Member kanban (3-column, live SSE updates)
4.2 Admin dashboard (weekly overview, chart)
4.3 Admin panel (members, chores, rewards, settings)
@@ -110,3 +115,5 @@
4.6 Donation modal
4.7 QR invite code
4.8 Polish (loading, empty, error states, responsive)
### Phase 5 deployment of production