SvelteKit: API integration #8

Open
opened 2026-03-28 02:10:11 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Depends on daily-100 #7 (SvelteKit scaffold) and daily-100-api #1-#4 (all API endpoints).

Repo

forgejo_admin/daily-100

User Story

As a user
I want my checklist data to persist across sessions
So that my progress is saved and stats are accurate

Context

Replace mock data in SvelteKit components with real API calls to the FastAPI backend. GET/PUT /api/today for checklist state, GET /api/history for heat map data, GET /api/stats for stats cards and gamification header. Add loading states and error handling.

File Targets

Files the agent should modify or create:

  • src/lib/api.ts -- API client with typed fetch functions
  • src/routes/+page.svelte -- data fetching via load function
  • src/routes/+page.server.ts -- server-side load for initial data
  • src/lib/components/ChecklistItem.svelte -- call PUT on toggle
  • src/lib/components/HeatMap.svelte -- consume real history data
  • src/lib/components/StatsGrid.svelte -- consume real stats
  • src/lib/components/GamificationHeader.svelte -- consume real level/streak

Files the agent should NOT touch:

  • prototype/ -- reference only

Acceptance Criteria

  • Checklist toggles call PUT /api/today
  • Heat map renders from GET /api/history
  • Stats and level data from GET /api/stats
  • Loading states shown during fetch
  • Error states handled gracefully

Test Expectations

  • npm run build succeeds
  • Integration test with running API
  • Run command: npm run build

Constraints

  • Use SvelteKit load functions for SSR
  • API base URL configurable via environment variable
  • Handle network errors without crashing

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • daily-100 -- project
### Type Feature ### Lineage Depends on daily-100 #7 (SvelteKit scaffold) and daily-100-api #1-#4 (all API endpoints). ### Repo `forgejo_admin/daily-100` ### User Story As a user I want my checklist data to persist across sessions So that my progress is saved and stats are accurate ### Context Replace mock data in SvelteKit components with real API calls to the FastAPI backend. GET/PUT /api/today for checklist state, GET /api/history for heat map data, GET /api/stats for stats cards and gamification header. Add loading states and error handling. ### File Targets Files the agent should modify or create: - `src/lib/api.ts` -- API client with typed fetch functions - `src/routes/+page.svelte` -- data fetching via load function - `src/routes/+page.server.ts` -- server-side load for initial data - `src/lib/components/ChecklistItem.svelte` -- call PUT on toggle - `src/lib/components/HeatMap.svelte` -- consume real history data - `src/lib/components/StatsGrid.svelte` -- consume real stats - `src/lib/components/GamificationHeader.svelte` -- consume real level/streak Files the agent should NOT touch: - `prototype/` -- reference only ### Acceptance Criteria - [ ] Checklist toggles call PUT /api/today - [ ] Heat map renders from GET /api/history - [ ] Stats and level data from GET /api/stats - [ ] Loading states shown during fetch - [ ] Error states handled gracefully ### Test Expectations - [ ] `npm run build` succeeds - [ ] Integration test with running API - Run command: `npm run build` ### Constraints - Use SvelteKit load functions for SSR - API base URL configurable via environment variable - Handle network errors without crashing ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `daily-100` -- project
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/daily-100#8
No description provided.