VitaForge is a premium, AI-enabled longevity and personalized nutrition platform that ingests wearable, lab, biometric, and lifestyle data to deliver explainable protocol guidance with clinical-grade confidence. This repository covers the entire MVP stack—from secure onboarding and sessions to deterministic protocol generation, trends/history storytelling, and demo personas tailored for pitch-ready storytelling.
apps/web/– Next.js App Router UI surfaces (landing, auth, onboarding, dashboard, today’s protocol, check-ins, biomarkers, trends, and admin/demo controls).src/– Shared domain models, UI primitives, and services for auth, onboarding, protocols, trends, demo personas, and integration placeholders.prisma/– PostgreSQL-ready schema, deterministic seed script (npm run seed), and client-ready types.docs/– Multi-page reference material covering architecture, domain models, the protocol engine, UX, local dev, and the roadmap.tests/– Vitest coverage that guards protocol heuristics, onboarding validation, trend aggregation, and demo persona sanity.
- Explainable guidance –
src/services/protocolEnginenormalizes payloads, evaluates heuristics (sleep, stress, protein/hydration behavior), and emits recommendations with rationale, assumptions, missing-data notes, and safety flags. - Longitudinal storytelling –
src/services/trendInsightsdelivers sleep, stress, recovery, adherence, biomarker, and derived optimization trends plus confidence narratives for investors. - Premium UX – Glassmorphic cards, considered typography, consistent spacing, and thoughtful empty/loading states across dashboard, trends, and protocol surfaces.
- Demo-ready data – Seeded personas cover executive stress, fitness recovery, and midlife longevity profiles with wearables, labs, check-ins, adherence logs, trends, and protocol plans that you can explore from
/admin/demo. - Future-proof integrations – Placeholder interfaces for Apple Health, Oura, Whoop, Garmin, Fitbit, labs, and genetics make it easy to plug real connectors later.
- Durable orchestration – Prisma-backed events/jobs describe every intake, ingestion, state-change, and notification opportunity while the
npm run jobs:runrunner and admin console surface retries, failures, and queue depth for credible demos.
npm install(ornpm cifor clean worktrees)npm run setup(generates Prisma + pushes the schema)npm run seednpm run devnpm run lintnpm run test
npm run reinstallwrapsclean:outputsandnpm installso you can refresh the repo-local cache without deletingnode_modules.npm run cimirrors GitHub Actions: it generates Prisma, lints, and runs Vitest in one command, using the repo-local SQLite (DATABASE_URL=file:./dev.db).npm run env-checkspots path issues (OneDrive, spaces, syncing) before you install, so you can fix the location before locks appear.- Windows/OneDrive users: pause file syncing before reinstalling, run
npm run clean:outputsto clear.next/.turbo/.npm-cache, and if locks persist removeapps/web/.nextmanually before rerunningnpm install. - The
.npmrcfile pins npm’s cache to./.npm-cache. Override withNPM_CONFIG_CACHEornpm --cache=./.npm-cacheif you prefer another location. Keeping the cache inside the repo avoids system-wide permission issues.
npm run db:push– push Prisma’s schema to whateverDATABASE_URLyou have configured (SQLite or Postgres); needed before seeding with new databases.npm run ci– runs Prisma generate, lint, and Vitest in one command; matches the GitHub Actions workflow.npm run jobs:run– claims pending background jobs (ingestion, protocol recalculations, admin snapshots) with the same handlers wired into the API and surfaces job outcomes in the console..npmrcpins npm’s cache to./.npm-cache, keeping installs inside the repo; override withNPM_CONFIG_CACHE/npm --cacheif you prefer another location.
- Copy
.env.exampleto.env.localand keep the values private. The app enforces required variables viasrc/lib/config.ts, and the same file exposes the demo-mode toggle (ENABLE_DEMO_MODE), log level, and session cookie settings (seedocs/LOCAL_DEV.md). - Prisma targets PostgreSQL out of the box, but you can point
DATABASE_URLat SQLite (file:./dev.db) for quick testing. Always run commands from the repository root so relative paths remain portable.
- Sessions live in
AuthSessionrows and are resolved viasrc/server/session.ts, which returns sanitizedSessionUserobjects (hashed passwords are never exposed, the role is explicit, and demo personas are flagged). Client routes like/admin,/api/checkin,/api/biomarkers, and/api/labs/parsenow always call this helper before mutating user state. - Operator/admin surfaces rely on
src/lib/access.tsfor gating, and demo persona switches respectENABLE_DEMO_MODE(otherwise only operators can impersonate demos). Audit records capture both the action and whether an operator or the demo flag triggered it. Seedocs/AUTH_SESSION.mdanddocs/TRUST_GOVERNANCE.mdfor details.
- Run
npm run seedto load the three curated personas (executive stress, fitness recovery, midlife longevity). The script wipes and recreates the demo data every time so you can reseed safely. - Visit
/admin/demoin the running app to view persona status, read caveats/missing-data notes, and switch your session into any persona. - Each persona ships with wearable snapshots, biomarker panels, trend snapshots, check-ins, adherence history, and deterministic protocol recommendations that align with their goals.
docs/ARCHITECTURE.mddocs/DOMAIN_MODEL.mddocs/PROTOCOL_ENGINE.mddocs/UX_OVERVIEW.mddocs/ROADMAP.mddocs/LOCAL_DEV.mddocs/UX_OVERVIEW.md(data-confidence storytelling, investor copykeepers, and premium landing iterations)docs/AUTH_SESSION.mddocs/CONNECTOR_ARCHITECTURE.mddocs/CONNECTORS.mddocs/LAB_GENETICS_INGESTION.mddocs/REOPT_NOTIFICATIONS.mddocs/ADMIN_ANALYTICS.md- Run
npm run clean:outputsto flush repo-local build artifacts (.next,.turbo,.npm-cache,dist,out), especially helpful on Windows/OneDrive before reinstalling dependencies. Node modules remain untouched. Documentation indocs/LOCAL_DEV.mdexplains the workflow and Windows recommendations.
- Next.js App Router + TypeScript + Tailwind + shadcn/ui
- Prisma + PostgreSQL-ready schema
- React Hook Form + Zod
- Recharts for charting
- Vitest for tests, ESLint + Prettier for quality