feat: SvelteKit SPA rebuild — adapter-static + keycloak-js #36
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-app#36
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-wkq→ Phase 15 (Production Port — SPA Rebuild)Repo
forgejo_admin/westside-appUser Story
As Marcus (admin), coaches, and parents
I want a phone-first SPA that works on mobile and is Capacitor-ready
So that the app can serve web + future iOS from one codebase with real-time API data
Context
The current westside-app uses SSR (adapter-node + Auth.js + confidential Keycloak client). This architecture can't wrap in Capacitor for iOS. The playground (13 static HTML pages, Gate 1 phone-approved) is the locked design source of truth.
This is a full architecture migration — nuke
src/, fresh scaffold. Key decisions made:basketball-api.tail5b443a.ts.net<style>blocks — all CSS in globalapp.css, copied literally from playgroundThe mcd-tracker project validated this exact pattern: SvelteKit adapter-static + keycloak-js + Capacitor.
File Targets
Files to delete (old SSR architecture):
src/auth.js— Auth.js config (replaced by keycloak-js)src/hooks.server.js— server hooks (no server in SPA)src/routes/**/+page.server.js— server-side data loading (replaced by +page.ts / onMount)Files to create:
src/lib/keycloak.js— keycloak-js init, login, logout, token refresh, role detectionsrc/routes/+layout.svelte— keycloak-js init, auth guard, role-based navsrc/routes/+page.svelte— landing page (fromindex.html)src/routes/tryouts/+page.svelte— fromtryouts.htmlsrc/routes/register/+page.svelte— fromregister.htmlsrc/routes/signin/+page.svelte— keycloak.login() redirectsrc/routes/my-players/+page.svelte— fromparent.htmlsrc/routes/players/[id]/+page.svelte— fromplayer-profile.htmlsrc/routes/players/[id]/billing/+page.svelte— frombilling.htmlsrc/routes/teams/[id]/+page.svelte— fromteam.htmlsrc/routes/coach/+page.svelte— fromcoach.htmlsrc/routes/coaches/[id]/+page.svelte— fromcoach-profile.htmlsrc/routes/admin/+page.svelte— fromadmin.htmlsrc/routes/admin/players/+page.svelte— fromadmin-players.htmlsrc/routes/admin/teams/+page.svelte— fromadmin-teams.htmlsrc/app.css— literal copy fromwestside-playground/shared/app.cssFiles to modify:
package.json— swap@sveltejs/adapter-node→@sveltejs/adapter-static, remove@auth/sveltekit, addkeycloak-jssvelte.config.js— adapter-static with fallback for SPA routingFiles NOT to touch:
westside-playground/*— playground is read-only source of truth, never modified by this workAcceptance Criteria
npm run devstarts Vite dev server on port 5174npm run buildsucceeds and produces static output inbuild/<style>blocks in any .svelte file — all CSS in app.css+page.server.jsfiles anywhereTest Expectations
npm run buildcompletes without errors (adapter-static validation)npm run checkpasses (svelte-check type validation)npm run build && npm run checkConstraints
@api,@state,@interactivity,@variantscomment block — these are the spec for Svelte bindingsforgejo_admin/westside-playgroundto read source HTML filespal-e, client ID TBD (check existing clients or createwestside-spa)app.jslogic from playground translates to Svelte reactive statements and event handlers — do NOT import app.jsChecklist
npm run buildpassesnpm run checkpassesRelated
westside-basketball— projectphase-wkq-15-production-port— phase note with full architecture tablephase-wkq-10-playground— design source of truth (COMPLETED)sop-capacitor-mobile-lifecycle— Stage 2 rules (mechanical copy, no scoped styles)Scope Update: Dev Overlay Pattern
Decision: Instead of
tailscale serve --bg 5174for dev access, use a kustomize dev overlay inpal-e-deployments.What this means
The existing production pod already has Keycloak, Tailscale funnel, and networking configured. A dev overlay swaps:
npm run dev -- --host~/westside-appSame URL (
westsidekingsandqueens.tail5b443a.ts.net), same auth, same API connection. Edit a.sveltefile on the host → Vite picks it up → phone refreshes in under a second.Impact on this issue
pal-e-deployments, not this repoAdditional file targets (in pal-e-deployments)
forgejo_admin referenced this issue2026-03-17 08:10:00 +00:00