Skip to content
hilsbosPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Twenty-Two

A minimal, phone-first workout app for the Twenty-Two morning calisthenics program — push / legs / pull rotating Mon–Sat plus a Sunday core day, runnable anywhere in 22 minutes (the name is the dose).

  • React 19 + Vite + TypeScript (static build, no router/state/CSS frameworks)
  • Supabase (Postgres + magic-link auth + RLS) for accounts, logs, and friend presence
  • ADHD-first product spine: opens on today's workout, one-tap set logging, rolling 7-day consistency (no breakable streaks), friend presence (never reps)

Prerequisites

  • Node 20+ and npm
  • A Supabase project (free tier is fine)

1. Configure Supabase

  1. Apply the schema. Open the Supabase dashboard → SQL Editor, paste the contents of supabase/schema.sql, and run it. It is idempotent — safe to re-run. It creates the profiles, sessions, set_logs, and progression tables with full Row Level Security. On an existing deployment, also run anything new in supabase/migrations/ (each file is idempotent).

  2. Configure auth redirect URLs. Dashboard → Authentication → URL Configuration:

    • Site URL: your deployed app URL (e.g. https://example.com/twenty-two/).
    • Redirect URLs: add every origin+path the app is served from. Include:
      • http://localhost:5173 (local dev)
      • your production URL, e.g. https://example.com/twenty-two/

    Magic-link sign-in uses location.origin + location.pathname as the redirect, so the exact subpath must be allow-listed.

  3. Environment variables. Copy .env.example to .env.local and fill in the project URL and anon/publishable key (Project Settings → API). Never put the service_role key here.

    VITE_SUPABASE_URL=https://YOUR-PROJECT.supabase.co
    VITE_SUPABASE_ANON_KEY=your-anon-or-publishable-key
    

2. Install & run

npm install
npm run dev       # http://localhost:5173
npm run build     # typecheck (tsc) + vite build -> dist/
npm run preview   # serve the production build locally
npm test          # vitest run (pure-logic unit tests)

Icons

PWA icons are generated by a dependency-free Python script (standard library only — struct + zlib) that renders a lime "22" mark on the dark background:

python3 scripts/gen_icons.py

Output lands in public/icons/. An SVG favicon lives at public/favicon.svg.

Deploying

Production lives at https://shushu.be/twentytwo/ (S3 + CloudFront). Deploys are one command — build, tiered-cache upload, CDN invalidation:

./deploy.sh

Infra details (CloudFront function, OAC, scoped IAM deploy user, rollback): docs/infra.md.

Portable by design: Vite base is './' and every asset/manifest/icon path is relative, so the built dist/ works from any folder on any static host. Whatever URL serves it must be in the Supabase Redirect URLs list, or magic-link return will be rejected.

Project layout

public/            manifest, favicon, generated icons
scripts/           gen_icons.py (PNG generator), render-grid.tsx (illustration grid)
supabase/          schema.sql (idempotent, full RLS) + migrations/
docs/              infra.md, program-view-proposal.md, exercise-guide-grid.png,
                   legacy-reference-card.html (the original artifact)
deploy.sh          one-command production deploy
src/
  program.ts       the exact program config (rotation, exercises, paths)
  types.ts         shared TypeScript contracts
  lib/logic.ts     pure, unit-tested logic (dates, targets, consistency, etc.)
  lib/supabase.ts  client init from env
  lib/db.ts        typed data-access wrappers (no UI logic)
  screens/         Auth / Today / Week
  components/      FormSheet (exercise form-guide sheet)
  illustrations/   2-pose SVG guide per exercise + CONVENTIONS.md
  App.tsx          two-screen shell + auth gate

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages