|
| 1 | +# Contributing to LifeOS |
| 2 | + |
| 3 | +Thanks for your interest! LifeOS is a self-hosted, single-admin personal tracker — small in scope on purpose. PRs and issues are welcome; please read this first to save us both time. |
| 4 | + |
| 5 | +## Scope — what's in / what's out |
| 6 | + |
| 7 | +**In scope** (PRs likely to be accepted): |
| 8 | + |
| 9 | +- Bug fixes (auth, sync, parsing, UI regressions) |
| 10 | +- Performance & a11y improvements |
| 11 | +- New exercise dataset translations / corrections |
| 12 | +- New `lib/ai/prompts.ts` improvements (better food/plan/program prompts) |
| 13 | +- Documentation, screenshots, deployment guides for other PaaS (Railway, Fly, Render, Hetzner Coolify, etc.) |
| 14 | +- Additional fal.ai endpoint integrations (e.g. swapping the default model, adding a new vision pipeline) |
| 15 | +- New chart types in `/analysis` |
| 16 | +- Whoop sync edge cases |
| 17 | + |
| 18 | +**Out of scope** (please open an issue / discussion first; will likely be declined as a PR): |
| 19 | + |
| 20 | +- Multi-tenant / multi-user auth — LifeOS is intentionally single-admin. If you need this, fork it. |
| 21 | +- Replacing fal.ai with another AI provider at the framework level. (Adding a *configurable* alternative behind the same `chat()` / `vision()` interface is fine; ripping fal out isn't.) |
| 22 | +- Switching the database away from Postgres. |
| 23 | +- Mobile native apps (iOS/Android shells). The PWA is intentionally web-first. |
| 24 | +- Major UI redesigns away from the Nothing-design aesthetic. |
| 25 | + |
| 26 | +If unsure, **open an issue before writing code**. Saves rejection cycles. |
| 27 | + |
| 28 | +## Dev setup |
| 29 | + |
| 30 | +```bash |
| 31 | +git clone https://github.com/egebese/lifeos.git |
| 32 | +cd lifeos |
| 33 | + |
| 34 | +cp .env.example .env |
| 35 | +# Fill in SESSION_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD, FAL_KEY |
| 36 | + |
| 37 | +docker compose up -d db |
| 38 | +pnpm install |
| 39 | +pnpm db:migrate |
| 40 | +pnpm bootstrap:admin |
| 41 | +pnpm seed:exercises |
| 42 | +pnpm dev |
| 43 | +``` |
| 44 | + |
| 45 | +You'll need a [fal.ai](https://fal.ai/dashboard/keys) key to test any AI feature. The free trial credits are enough for development — every call gets logged to the `ai_messages` table so you can audit usage. |
| 46 | + |
| 47 | +## Code conventions |
| 48 | + |
| 49 | +- **TypeScript strict.** No `any` unless absolutely necessary (and comment why). |
| 50 | +- **Server Components by default.** Drop to `"use client"` only when you need state, effects, or browser APIs. |
| 51 | +- **Drizzle for all DB access.** No raw SQL except in migrations. |
| 52 | +- **Zod schemas at API boundaries.** Look at `lib/ai/schemas.ts` for the pattern. |
| 53 | +- **No new env vars without a default + `.env.example` update.** |
| 54 | +- **AI calls go through `lib/ai/client.ts`.** Don't call `@fal-ai/client` directly from route handlers — the wrapper logs cost and errors to `ai_messages`. |
| 55 | +- **Mobile-first.** Test at 375px width before desktop. Use the existing `components/nothing/*` primitives where possible. |
| 56 | + |
| 57 | +## Before you push |
| 58 | + |
| 59 | +```bash |
| 60 | +pnpm lint |
| 61 | +pnpm typecheck |
| 62 | +pnpm build |
| 63 | +``` |
| 64 | + |
| 65 | +All three must pass. CI runs the same on PRs. |
| 66 | + |
| 67 | +## Commit / PR style |
| 68 | + |
| 69 | +- One concern per PR. A bug fix + a refactor + a new feature = three PRs. |
| 70 | +- Commit messages: imperative present tense — `add voice transcription endpoint`, not `added` / `adds`. |
| 71 | +- PR description: what changed, why, and **how you tested it** (screenshots for UI, curl/log snippets for API). |
| 72 | +- If you touched a fal.ai endpoint, mention the cost impact (rough $/call) in the PR. |
| 73 | + |
| 74 | +## Reporting bugs |
| 75 | + |
| 76 | +Open an issue with: |
| 77 | + |
| 78 | +1. What you did (step-by-step). |
| 79 | +2. What you expected. |
| 80 | +3. What actually happened. |
| 81 | +4. Environment: Node version, deploy target (Docker/Coolify/local), browser if UI. |
| 82 | +5. Relevant logs — `docker compose logs web` is your friend. |
| 83 | + |
| 84 | +**Do not include `FAL_KEY`, session cookies, or DB connection strings** in issues. Redact them. |
| 85 | + |
| 86 | +## Reporting security issues |
| 87 | + |
| 88 | +See [SECURITY.md](SECURITY.md). **Do not** open a public issue for security. |
| 89 | + |
| 90 | +## License |
| 91 | + |
| 92 | +By contributing you agree your contributions are MIT-licensed under the same terms as the rest of the project. |
0 commit comments