Skip to content

New frontend scaffold: Vite + React + TS app at /app/ with auth and shell (Step 1) - #2

Merged
Meerav29 merged 13 commits into
masterfrom
feat/web-scaffold
Oct 4, 2026
Merged

Meerav29 merged 13 commits into
masterfrom
feat/web-scaffold

Conversation

@Meerav29

@Meerav29 Meerav29 commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

Step 1 of the Somada modernization (docs/superpowers/plans/2026-10-03-step1-web-scaffold.md). Adds the new frontend in web/ (Vite 8, React 19, TypeScript strict, react-router 7, TanStack Query, Vitest 5), served at /app/ next to the untouched classic page at /. Builds on Step 0 (per-user data + authenticated API, already merged).

  • Auth: Supabase client built at runtime from /api/supabase_config (no build-time secrets); email/password and Google sign-in; local dev with no Supabase config runs unauthenticated (unconfigured); a failed config fetch is an error state, never authless.
  • Shell: protected routes, app shell (Dashboard / Insights / Settings), login page.
  • Dashboard placeholder: calls the authenticated /api/health, shows "N days of data" and the "sample data" banner when the server marks the demo dataset (is_demo).
  • Privacy hygiene: query cache cleared on sign-out; 4xx errors are not retried; sign-out falls back to local scope on network errors.
  • Types/API: HealthData matches the real parsers (nullable metrics, heart_rate_*); typed client with Bearer auth.
  • Deploy: scripts/build-site.mjs assembles public/ (classic page + icon at /, SPA at /app/); vercel.json builds it, excludes non-API files from the Python functions, and redirects /app to /app/. As a side effect, only index.html, icon.png and app/ are served now (the repo root is no longer served as static files).
  • CI/docs: new web job (lint, typecheck, tests, build); README, CLAUDE.md and spec updated.

NOT verified yet: Vercel deploy

The custom buildCommand / outputDirectory / functions.excludeFiles / /app redirect have never run on Vercel. Do not merge until the preview passes (merging to master deploys to production):

  1. Supabase -> Authentication -> URL Configuration: add https://somada.vercel.app/app/ and the preview URL pattern to Redirect URLs (Google sign-in).
  2. On the Vercel preview: / shows the classic page and /icon.png loads; /api/health is 401 without a token and 200 with one; /api/config and /api/supabase_config work; /app/ redirects to login, email sign-in lands on the dashboard; /app/insights works on a hard reload; bare /app redirects to /app/; the build log shows no oversized Python functions; the Vercel project Node version is 22.13+.
  3. Legacy email sign-in and upload still work.

Known follow-ups (not in this PR)

  • API returns the same 200 "No health data found" on a Supabase outage (Step 0 backend); fix with a 503 before any upload flow ships.
  • Pre-existing bug in the classic page's parser: worst_sleep is always 0 (separate task).
  • Deferred minors: error boundary / friendly network errors, route splitting, login redirect-back, CI typecheck dedupe.

Test plan

  • npm --prefix web test (64 passed), lint, typecheck, build
  • python -m pytest (54 passed)
  • Vercel preview checklist above

🤖 Generated with Claude Code

Meerav29 and others added 13 commits October 3, 2026 14:05
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nconfigured mode)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…p entry

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… 4xx errors

- Add ClearCacheOnSignOut component to clear cache when status changes to signedOut
- Create queryClient.ts with shouldRetry function that rejects 4xx errors immediately
- Update main.tsx to use createQueryClient with proper retry and refetch settings
- Prevents stale health data lingering after sign-out and delays expired-session alerts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…/app to /app/

Unverified until a Vercel preview deploy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… check, supabase client tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
somada Ready Ready Preview Oct 3, 2026 7:50pm UTC

@Meerav29
Meerav29 merged commit 209b819 into master Oct 4, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 2081acf7 Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant