SvelteKit + Capacitor scaffold: 10 routes, keycloak-js auth, playground promotion #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-mcd-tracker→ Phase 7 (SvelteKit + Capacitor Frontend)Repo
forgejo_admin/mcd-tracker-appUser Story
As a user on my phone (web or iOS)
I want to use the MCD Tracker app with real data instead of hardcoded playground prototypes
So that I can actually track my BOGO codes, scan receipts, and redeem at the counter
Context
The playground prototype (12 pages at
playground.tail5b443a.ts.net/mcd-tracker/) is the design source of truth. This phase promotes it to a production SvelteKit app with Capacitor for iOS.Critical architecture decisions already made:
adapter-static+ssr: false(required for Capacitor). No+page.server.ts— all data loading is client-side viafetch()inonMount.keycloak-jsclient-side OIDC with PKCE (NOT Auth.js — Auth.js requires SSR). Public Keycloak clientmcd-tracker-app. Redirect URIs: Webhttps://mcd-tracker-app.tail5b443a.ts.net/*, iOScapacitor://localhost/*.https://mcd-tracker.tail5b443a.ts.net(FastAPI backend, already deployed with 13 endpoints + 144 tests)GET /stats(XP, levels) +redeemed_itemon redeem endpoint (PR #17 on mcd-tracker-api)Playground CSS is the source of truth. Copy
app.cssdirectly. Copy HTML into Svelte templates. Replace hardcoded data with{data.field}bindings. Do not redesign or reinterpret.Routes (10 total)
//signinkeycloak.login()redirect/registerkeycloak.register()redirect/homeGET /dashboard+GET /stats/locations/[id]GET /locations/{id}/slots+GET /locations/{id}/codes/scanGET /locations/nearby/scan/success/redeem/success/historyGET /receipts+GET /codes+GET /stats/history/[id]GET /codes/{id}with related receipt/location dataFile Targets
Files to create:
src/routes/+layout.svelte— keycloak-js init, auth guard, bottom navsrc/routes/+page.svelte— landing page (public, no auth required)src/routes/signin/+page.svelte—keycloak.login()redirect (one-liner, not a full page)src/routes/register/+page.svelte—keycloak.register()redirect (one-liner)src/routes/home/+page.svelte— location dashboard + XP bannersrc/routes/locations/[id]/+page.svelte— location detail + cashier overlaysrc/routes/scan/+page.svelte— 4-step wizardsrc/routes/scan/success/+page.svelte— save celebration + cashier overlaysrc/routes/redeem/success/+page.svelte— redeem celebration + item pickersrc/routes/history/+page.svelte— date-grouped timelinesrc/routes/history/[id]/+page.svelte— event detail + state-aware overlaysrc/app.css— direct copy from~/mcd-tracker-playground/app.csssrc/lib/keycloak.js— keycloak-js wrapper (init, login, register, updateToken, getToken)src/lib/api.js— fetch wrapper with Bearer token injection from keycloaksvelte.config.js— adapter-static, ssr: falsecapacitor.config.ts— Capacitor configuration (appId, appName, webDir: 'build')Dockerfile— nginx serving staticbuild/directory.woodpecker.yaml— test + build + kaniko push pipelineThe playground HTML lives at
~/mcd-tracker-playground/. Read each file and promote it.Acceptance Criteria
npm run buildsucceeds (no SSR errors with adapter-static)/) renders without auth/signintriggerskeycloak.login()redirect/registertriggerskeycloak.register()redirect/homefetches fromGET /dashboard+GET /stats/locations/{id}with real slot + code dataPATCH /codes/{id}/redeemwith optionalredeemed_itemfrom chip picker.woodpecker.yamlhas test + build-and-push stagesTest Expectations
npm run buildproduces static output inbuild/npx cap initsucceeds (Capacitor project initialized)npm run buildConstraints
app.csscopied verbatim from~/mcd-tracker-playground/app.css, no modificationsfetch()inonMount— NO+page.server.ts(SPA mode)keycloak-jsfor auth — NOT Auth.js (Auth.js requires SSR)Capacitor.isNativePlatform()for redirect URIshttps://mcd-tracker.tail5b443a.ts.netChecklist
Related
project-mcd-tracker— parent project~/mcd-tracker-playground/(12 HTML files +app.css)https://mcd-tracker.tail5b443a.ts.net(13 endpoints, 144 tests)project-capacitor-mobilenote in pal-e-docs (auth-decision section)