Adding plans and docs
This commit is contained in:
@@ -0,0 +1,123 @@
|
|||||||
|
# Sis Implementation Plan
|
||||||
|
|
||||||
|
**Goal:** Build the complete Sis household chore tracker per BUILD_TASKS.md — auth, households, chores/schedules, activity recording, PWA, all styled with NeoBrutalismCSS.
|
||||||
|
|
||||||
|
**Architecture:** Monolithic Haskell/Orb backend serving JSON API routes + SQLite persistence. Mithril.js SPA frontend with client-side routing. Session-based auth via httpOnly cookies with PBKDF2-hashed passwords using `crypton`. All household-scoped data is protected by session middleware.
|
||||||
|
|
||||||
|
**Tech Stack:** Haskell (GHC 9.10), Orb/Warp, sqlite-simple, crypton (PBKDF2), aeson, Mithril.js v2, TypeScript, NeoBrutalismCSS CDN.
|
||||||
|
|
||||||
|
**Product decisions:**
|
||||||
|
- Any member can manage chores (edit/delete) — collaborative model
|
||||||
|
- Activity records are append-only (no edit/undo)
|
||||||
|
- "Anyone" chores: completing an occurrence clears it for the whole household
|
||||||
|
- Recurring: specific day-of-week/month, not just "every N days"
|
||||||
|
- Occurrences generated 90 days ahead, rolling window
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 0 — Foundation: DB schema + session infrastructure
|
||||||
|
|
||||||
|
### Task 0.1: Database schema migrations
|
||||||
|
- **Files:** `src/Sis/Database.hs`
|
||||||
|
- Add `runMigrations` that creates all tables on startup: users, sessions, households, memberships, invites, chores, occurrences, activities.
|
||||||
|
|
||||||
|
### Task 0.2: Password hashing module
|
||||||
|
- **Files:** New `src/Sis/Auth.hs`
|
||||||
|
- PBKDF2 via crypton: `hashPassword`, `verifyPassword`, `generateSessionToken` (32 random bytes hex), session cookie handling.
|
||||||
|
|
||||||
|
### Task 0.3: Session middleware
|
||||||
|
- **Files:** `src/Sis/Server.hs`, `src/Sis/Auth.hs`
|
||||||
|
- Extract session token from cookie, load user, attach to request context. Auth-required routes check for valid user.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1 — Auth routes (Milestone 1)
|
||||||
|
|
||||||
|
### Task 1.1: Auth route types + handlers
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- POST /api/auth/signup, POST /api/auth/login, POST /api/auth/logout, GET /api/auth/me
|
||||||
|
- Validate unique email, password strength, matching confirmation.
|
||||||
|
|
||||||
|
### Task 1.2: Frontend auth pages
|
||||||
|
- **Files:** `frontend/src/components/LoginPage.ts`, `frontend/src/components/SignupPage.ts`
|
||||||
|
- Signup form with inline validation. Login form with "remember me". Client-side router integration.
|
||||||
|
|
||||||
|
### Task 1.3: Password reset
|
||||||
|
- **Files:** `src/Sis/Server.hs`, `frontend/src/components/ForgotPassword.ts`
|
||||||
|
- POST /api/auth/forgot-password (generates reset token), POST /api/auth/reset-password (consumes token).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2 — Households (Milestone 2)
|
||||||
|
|
||||||
|
### Task 2.1: Household CRUD routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- POST /api/households, GET /api/households, GET /api/households/:id, PUT /api/households/:id, DELETE /api/households/:id
|
||||||
|
- GET /api/households/:id/members, DELETE /api/households/:id/members/:userId
|
||||||
|
|
||||||
|
### Task 2.2: Invite routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- POST /api/households/:id/invites, GET /api/households/:id/invites, DELETE /api/households/:id/invites/:inviteId
|
||||||
|
- GET /api/invites/:code (public lookup), POST /api/invites/:code/accept
|
||||||
|
|
||||||
|
### Task 2.3: Frontend household pages
|
||||||
|
- **Files:** `frontend/src/components/HouseholdPage.ts`, `frontend/src/components/HouseholdList.ts`, `frontend/src/components/CreateHousehold.ts`
|
||||||
|
- Household switcher, member list, invite panel.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3 — Chores (Milestone 3)
|
||||||
|
|
||||||
|
### Task 3.1: Chore CRUD routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- GET /api/households/:id/chores, POST /api/households/:id/chores, PUT /api/households/:id/chores/:id, DELETE /api/households/:id/chores/:id
|
||||||
|
|
||||||
|
### Task 3.2: Occurrence generation logic
|
||||||
|
- **Files:** `src/Sis/Database.hs` (for occurrence queries)
|
||||||
|
- Generate rolling 90-day window of occurrences from recurring schedules. Recompute on schedule edit.
|
||||||
|
|
||||||
|
### Task 3.3: Dashboard routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- GET /api/households/:id/dashboard — returns overdue, due-today, completed-today stats and lists.
|
||||||
|
|
||||||
|
### Task 3.4: Frontend chore + dashboard pages
|
||||||
|
- **Files:** `frontend/src/components/DashboardPage.ts`, `frontend/src/components/ChoreList.ts`, `frontend/src/components/ChoreForm.ts`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4 — Activity (Milestone 4)
|
||||||
|
|
||||||
|
### Task 4.1: Activity record routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- POST /api/occurrences/:id/activity
|
||||||
|
|
||||||
|
### Task 4.2: Activity log routes
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- GET /api/households/:id/activity?member=&status=&page=&perPage=
|
||||||
|
|
||||||
|
### Task 4.3: Frontend activity pages
|
||||||
|
- **Files:** `frontend/src/components/RecordActivity.ts`, `frontend/src/components/ActivityLog.ts`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 5 — PWA (Milestone 5)
|
||||||
|
|
||||||
|
### Task 5.1: Manifest + service worker
|
||||||
|
- **Files:** `frontend/public/manifest.json`, `frontend/public/sw.js`
|
||||||
|
- Web app manifest, basic offline service worker.
|
||||||
|
|
||||||
|
### Task 5.2: Frontend polish, routing, navigation
|
||||||
|
- **Files:** `frontend/src/router.ts`, `frontend/src/components/Layout.ts`, `frontend/public/style.css`
|
||||||
|
- Client-side router, nav bar, responsive layouts, all nav links.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 6 — Seed data + tests (Milestone 6)
|
||||||
|
|
||||||
|
### Task 6.1: Seed data route
|
||||||
|
- **Files:** `src/Sis/Server.hs`
|
||||||
|
- POST /api/seed — creates demo household with sample chores, members, activity.
|
||||||
|
|
||||||
|
### Task 6.2: Backend tests
|
||||||
|
- **Files:** `test/Spec.hs`
|
||||||
|
- Test auth flow, household CRUD, chore CRUD, activity recording.
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
# Sis — Build Tasks
|
||||||
|
|
||||||
|
A household chore-tracking web app (PWA-capable, with push notifications). These tasks describe **what** to build and the behavior required. Technical stack decisions (language, framework, database, hosting, push provider, auth library) are intentionally left out — fill them in per your chosen agent.
|
||||||
|
|
||||||
|
Styling reference for all UI: [NeoBrutalismCSS](https://matifandy8.github.io/NeoBrutalismCSS/) via CDN `https://cdn.jsdelivr.net/gh/matifandy8/NeoBrutalismCSS/dist/index.min.css`. Mockup screenshots are attached for the target look and layout.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Domain Model (reference for all tasks)
|
||||||
|
|
||||||
|
- **User** — an account. Has display name, email, password (hashed). Belongs to zero or more Households.
|
||||||
|
- **Household** — a named group. Created by a User (the owner). Has many members. A User can belong to multiple Households and switch between them.
|
||||||
|
- **Membership** — links a User to a Household with a role (`owner` | `member`).
|
||||||
|
- **Invite** — a pending invitation to a Household, by email or shareable link/code. States: `pending` | `accepted` | `revoked`.
|
||||||
|
- **Chore** — belongs to a Household. Has a name, an optional assignee (a member, or "anyone"), a Schedule, and an optional "notify on due" flag.
|
||||||
|
- **Schedule** — the timing rule for a Chore. One of:
|
||||||
|
- `one_off` — a specific date, or date+time.
|
||||||
|
- `recurring` — a period of `daily` | `weekly` | `monthly`, with a start date and optional time-of-day.
|
||||||
|
- `sometime` — no due date; open-ended "someday" task.
|
||||||
|
- **Occurrence** — a single dated instance of a Chore. One-off/sometime chores have one occurrence; recurring chores generate occurrences per period. Occurrences drive the "due today / overdue" views and are what Activities attach to.
|
||||||
|
- **Activity** — a record that a User acted on a specific **Occurrence**. Has a status (`completed` | `skipped`), an optional free-text note, the acting user, and a timestamp.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 1 — Accounts & Authentication
|
||||||
|
|
||||||
|
### Task 1.1 — User registration (Sign Up)
|
||||||
|
- Build a sign-up screen: display name, email, password, confirm password, and an agreement checkbox.
|
||||||
|
- Validate: unique email, password strength, matching confirmation. Show inline field errors.
|
||||||
|
- On success, create the account and log the user in.
|
||||||
|
- Screen: see `signup.png`.
|
||||||
|
|
||||||
|
### Task 1.2 — Login
|
||||||
|
- Build a login screen: email, password, "remember me", and a "forgot password" link.
|
||||||
|
- Authenticate credentials; on failure show a clear error without revealing which field was wrong.
|
||||||
|
- Persist the session; "remember me" extends session lifetime.
|
||||||
|
- Screen: see `login.png`.
|
||||||
|
|
||||||
|
### Task 1.3 — Password reset
|
||||||
|
- "Forgot password" flow: request reset by email, deliver a reset link/token, allow setting a new password.
|
||||||
|
- Expire reset tokens after a short window and after use.
|
||||||
|
|
||||||
|
### Task 1.4 — Session & route protection
|
||||||
|
- Redirect unauthenticated users to login for any app route.
|
||||||
|
- Provide logout.
|
||||||
|
- After login, land the user on the Today/dashboard view of their current Household (or the create-household flow if they have none).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 2 — Households & Membership
|
||||||
|
|
||||||
|
### Task 2.1 — Create a household
|
||||||
|
- Any logged-in user can create a Household by giving it a name.
|
||||||
|
- The creator becomes the `owner` and first member.
|
||||||
|
- Support a user belonging to multiple households, with a way to switch the "active" household (see the "Your Households" switcher in `household.png`).
|
||||||
|
|
||||||
|
### Task 2.2 — Household management screen
|
||||||
|
- Show household name, member count, and creator.
|
||||||
|
- List all members with avatar (initials), display name, email, and role badge (Owner/Member).
|
||||||
|
- Screen: see `household.png`.
|
||||||
|
|
||||||
|
### Task 2.3 — Invite members
|
||||||
|
- Invite by email address (sends an invitation) **and** by a shareable join link/code.
|
||||||
|
- Show a list of pending invites with invited-date and a "Revoke" action.
|
||||||
|
- Screen: invite panel and pending-invites panel in `household.png`.
|
||||||
|
|
||||||
|
### Task 2.4 — Accept / join a household
|
||||||
|
- Handle an invited user clicking a join link or code: if logged out, route through login/sign-up first, then join.
|
||||||
|
- On accept, create a membership and mark the invite `accepted`.
|
||||||
|
- Prevent duplicate memberships and joining via revoked/expired invites.
|
||||||
|
|
||||||
|
### Task 2.5 — Roles & permissions
|
||||||
|
- Owner can: rename household, invite, revoke invites, remove members, delete household.
|
||||||
|
- Members can: manage chores and record activity (per product decision below).
|
||||||
|
- Enforce that a user can only see/act within households they belong to.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 3 — Chores & Schedules
|
||||||
|
|
||||||
|
### Task 3.1 — Chore list (management)
|
||||||
|
- List all chores in the active household with: name, assignee, a human-readable schedule summary ("Recurs Daily at 8:00 AM", "One-off on Jul 20", "Sometime"), and a schedule-type badge.
|
||||||
|
- Provide Edit and Delete per chore, and a "New Chore" entry point.
|
||||||
|
- Screen: left panel of `chores.png`.
|
||||||
|
|
||||||
|
### Task 3.2 — Create / edit chore form
|
||||||
|
- Fields: chore name, assign-to (a specific member or "Anyone in household").
|
||||||
|
- Schedule-type selector: **One-off**, **Recurring**, **Sometime** (mutually exclusive).
|
||||||
|
- One-off → date, optional time.
|
||||||
|
- Recurring → period selector (Daily / Weekly / Monthly), start date, optional time-of-day. For weekly, allow choosing day(s) of week; for monthly, allow day-of-month.
|
||||||
|
- Sometime → no date inputs.
|
||||||
|
- "Send push reminder when due" toggle.
|
||||||
|
- Validate inputs per schedule type; show the relevant fields dynamically.
|
||||||
|
- Screen: right panel (edit form) of `chores.png`.
|
||||||
|
|
||||||
|
### Task 3.3 — Occurrence generation
|
||||||
|
- Generate occurrences from a chore's schedule so the Today/overdue views can list concrete dated items.
|
||||||
|
- Recurring chores should produce upcoming occurrences without unbounded growth (generate a rolling window and extend over time).
|
||||||
|
- Recompute when a chore's schedule is edited; handle deletion gracefully (past activity records should remain intact for history).
|
||||||
|
|
||||||
|
### Task 3.4 — Dashboard / "Today" view
|
||||||
|
- Show the active household name and today's date.
|
||||||
|
- Stat tiles: count of Overdue, Due Today, and Done This Week.
|
||||||
|
- "Overdue & Due Today" panel: list occurrences that are overdue or due today, each with assignee, due info, overdue emphasis, and a quick check-off control.
|
||||||
|
- "Completed Today" panel: today's completed/skipped activities with actor, time, and any note.
|
||||||
|
- Link to the full Activity Log.
|
||||||
|
- Screen: see `dashboard.png`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 4 — Activity Recording & History
|
||||||
|
|
||||||
|
### Task 4.1 — Record activity (complete / skip an occurrence)
|
||||||
|
- From a due/overdue occurrence, open a "Record Activity" dialog.
|
||||||
|
- Show which chore and which occurrence (date) is being acted on, plus assignee.
|
||||||
|
- Choose status: **Completed** or **Skipped**.
|
||||||
|
- Optional free-text note.
|
||||||
|
- "Notify household of this update" toggle.
|
||||||
|
- On save, create an Activity tied to that specific occurrence and update the dashboard state.
|
||||||
|
- Screen: see `record-activity.png`.
|
||||||
|
|
||||||
|
### Task 4.2 — Activity log (viewing history)
|
||||||
|
- A full, paginated log across the household: columns for Chore, Occurrence date, Member (avatar + name), Status badge, Note, and Recorded timestamp.
|
||||||
|
- Filters by member and by status (Completed / Skipped).
|
||||||
|
- Screen: see `activity-log.png`.
|
||||||
|
|
||||||
|
### Task 4.3 — Activity integrity rules
|
||||||
|
- Each activity applies to one specific occurrence (important for recurring chores).
|
||||||
|
- Prevent duplicate active records for the same occurrence unless the product allows re-recording (define: allow updating the latest record, keep history).
|
||||||
|
- Notes are optional and preserved for posterity even if the underlying chore is later edited or deleted.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 5 — PWA & Push Notifications
|
||||||
|
|
||||||
|
### Task 5.1 — Progressive Web App setup
|
||||||
|
- Add a web app manifest (name, icons, theme colors, standalone display) so the app is installable on mobile home screens.
|
||||||
|
- Add offline-capable shell behavior appropriate for the app (at minimum, graceful handling when offline).
|
||||||
|
- Ensure the app is responsive and usable on phone-sized screens (the mockups are desktop; provide mobile layouts).
|
||||||
|
|
||||||
|
### Task 5.2 — Push notification subscription
|
||||||
|
- Prompt users to enable push notifications (per device/browser).
|
||||||
|
- Store push subscriptions per user/device; allow disabling.
|
||||||
|
|
||||||
|
### Task 5.3 — Notification triggers
|
||||||
|
- **Overdue chore** — notify the assignee (or household, for "anyone" chores) when an occurrence becomes overdue.
|
||||||
|
- **Completed/skipped chore** — when a member records an activity with "notify household" enabled, notify other household members.
|
||||||
|
- **Due reminder** — for chores with "send push reminder when due", notify at the due time.
|
||||||
|
- Deduplicate and avoid notification spam (e.g., one overdue nudge per occurrence, sensible batching).
|
||||||
|
|
||||||
|
### Task 5.4 — Scheduled evaluation
|
||||||
|
- A recurring background process to evaluate occurrences, mark overdue states, fire due/overdue notifications, and roll the occurrence window forward.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestone 6 — Styling, Polish & Cross-Cutting
|
||||||
|
|
||||||
|
### Task 6.1 — Apply the NeoBrutalismCSS design system
|
||||||
|
- Use the CDN stylesheet across all screens; match the attached mockups (bold borders, hard drop shadows, uppercase Lexend Mega headings, the dotted cream background, and the yellow/green/blue/orange/red accent palette).
|
||||||
|
- Reusable components: top nav bar with active-state, stat tiles, list "item" rows, badges/pills, panels, tables, and the modal dialog.
|
||||||
|
|
||||||
|
### Task 6.2 — Empty, loading, and error states
|
||||||
|
- Design empty states (no chores yet, no members yet, no activity yet), loading indicators, and inline/error messaging consistent with the design.
|
||||||
|
|
||||||
|
### Task 6.3 — Validation & security cross-cuts
|
||||||
|
- Server-side validation on every form; never trust client input.
|
||||||
|
- Authorization checks on every household-scoped action.
|
||||||
|
- Hashed passwords, protected sessions, and safe handling of invite tokens.
|
||||||
|
|
||||||
|
### Task 6.4 — Seed / demo data (optional)
|
||||||
|
- Provide a way to seed a demo household with sample members, chores, and activity for testing and screenshots.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Suggested build order
|
||||||
|
1. Milestone 1 (Auth) → 2. Milestone 2 (Households) → 3. Milestone 3 (Chores/Schedules/Dashboard) → 4. Milestone 4 (Activity) → 5. Milestone 5 (PWA/Push) → 6. Milestone 6 (polish, applied throughout).
|
||||||
|
|
||||||
|
## Open product decisions to confirm before building
|
||||||
|
- Can any member manage (edit/delete) chores, or only the owner/creator?
|
||||||
|
- Can activity records be edited/undone after saving, or are they append-only?
|
||||||
|
- For "anyone" chores, does completing an occurrence clear it for everyone?
|
||||||
|
- Weekly/monthly recurrence granularity — is specific day-of-week / day-of-month needed, or is "every 7 / 30 days from start" sufficient?
|
||||||
|
- How far ahead should recurring occurrences be visible/generated?
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
Reference in New Issue
Block a user