Peptaide is a recording and analytics app for tracking peptide/medication administrations. It is built to make daily logging fast (keyboard-first on desktop, tap-light on mobile) while treating uncertainty as a first-class concept via Monte Carlo percentiles.
Scope disclaimer (non-negotiable): Peptaide can store "recommendations" you enter, but it must never present itself as medical guidance, optimization, or protocol advice.
- Log 5-10+ administrations/day quickly in a day-scoped "Today" grid.
- Record administered dose (canonical mg and/or mL when applicable; IU preserved as IU).
- Compute effective dose percentiles (p05/p50/p95) for systemic and optionally CNS compartments when the model coverage is present.
- Track cycles per substance with a gap-based "new cycle" suggestion and break computation.
- Manage inventory (orders -> vials), attribute cost to events, and view spend/runway rollups.
- Export all data and import it back (portable, no lock-in).
- Rely on database-enforced privacy via Supabase/Postgres Row Level Security (RLS) on user-owned tables.
- Not a medical device.
- Not protocol optimization, dosing advice, diagnosis, or "AI decides your dose".
web/: Next.js (App Router) + TypeScript web app.supabase/: SQL migrations, local Supabase config, and RLS probes/scripts.ExecPlan.md: the living implementation plan and current project status (authoritative for ongoing work).AGENTS.md: local agent/contributor instructions for working in this repo.
- Next.js App Router (currently Next.js 16.x)
- React (currently React 19.x)
- Supabase (Postgres + Auth + RLS) via
@supabase/ssr - Tailwind CSS
cmdkfor command palette navigation/actions- Vitest for unit tests
- Node.js (recommended: v20+)
- Supabase CLI (for local Postgres/Auth)
From the repository root:
supabase start
supabase statussupabase status prints the local API URL and anon key used by the web app.
If you pulled new migrations or changed SQL locally, you may need to re-apply the schema:
supabase db resetNote: supabase db reset destroys local data and re-applies all migrations.
Create/update web/.env.local:
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_ANON_KEY=...Local values come from supabase status.
cd web
npm install
npm run devThen open http://localhost:3000.
Start with /setup:
- Set profile defaults (timezone + units).
- Bulk-add substances, routes, and formulations.
- Create vials (or generate planned vials from orders).
- Create distributions and fill model gaps:
- base bioavailability specs (fraction distributions)
- device calibrations (volume per unit distributions)
- formulation modifier specs (multiplier distributions)
Then use:
/today: primary logging surface (grid; Enter-to-save; multi-line paste)./cycles: cycle list + detail tools (split at event; end/abandon; start cycle now)./inventory+/orders: vial inventory and order entry (with basic vial generation)./analytics: read-only rollups fromsecurity_invokerSQL views./settings: profile defaults + data portability (export/import + delete-my-data).
- "Bioavailability" is modeled as a fraction in
[0, 1]. - Enhancers/modifiers are modeled as multipliers
>= 0. - Composition is:
BA_total = clamp(BA_base * product(multipliers), 0, 1)effective_dose_mg = administered_dose_mg * BA_total
- IU inputs are preserved as IU. The MVP does not convert IU into mg/mL without a substance-specific rule.
The database enforces key correctness constraints (distribution parameterization, value bounds, and value_type compatibility) and RLS is the primary privacy boundary.
From web/:
npm run typecheck
npm test
npm run lint
npm run buildPeptaide exports and imports data as a ZIP bundle of CSV files (the importer expects the same format that /api/export generates).
Docs:
docs/SIMPLE_EVENTS_CSV_IMPORT.md: recommended for sparse spreadsheets (event log import).docs/IMPORT_ANALYSIS.md: table-by-table analysis of what external systems usually track, and how sparse imports map to Peptaide.docs/CSV_IMPORT_BUNDLE_V1.md: full-fidelity Peptaide-to-Peptaide import/export bundle format.
There is a scripted probe that asserts cross-user isolation in local Supabase:
supabase db reset
psql "$SUPABASE_DB_URL" -f supabase/scripts/rls_probe.sqlSUPABASE_DB_URL can be taken from supabase status for local dev.
- SQL migrations live in
supabase/migrations/. - After changing SQL locally, re-apply:
supabase db reset- Regenerate Supabase TS types:
supabase gen types typescript --local > web/src/lib/supabase/database.types.tsThe web app expects these environment variables in the deployed environment:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
Auth redirect URLs must also be configured in Supabase for the deployed origin.
See ExecPlan.md for the current deployment blockers and required evidence.
ExecPlan.mdis the living spec. Keep it accurate when making meaningful changes.- If you use
zsh, quote file paths containing(app)or[param]when running shell commands (to avoid glob expansion).