4.5 KiB
4.5 KiB
Phase 0 - Groundwork and Dev Environment
Duration: 1-2 weeks Primary owner: Founder + coding assistant
1. Objective
Build a stable base so feature work can move fast without breaking:
- all required accounts are created
- local stack boots reliably
- repo structure and standards are in place
- CI checks run on every pull request
2. Prerequisites
- Read
docs/kalei-getting-started.md - Read
docs/kalei-system-architecture-plan.md
3. Outcomes
By the end of Phase 0 you will have:
- local Postgres and Redis running via Docker
- mobile app bootstrapped with Expo
- API service bootstrapped with Fastify
- initial DB migration system in place
- lint, format, and test commands working
- CI pipeline validating every PR
4. Deep Work Breakdown
4.1 Access and Account Setup
Task list:
- Set up Gitea (self-hosted or managed) for source control and CI.
- Set up open-weight model serving accounts and endpoints (Ollama local, vLLM target host).
- Create GlitchTip project for API and mobile error tracking.
- Create PostHog self-hosted project for product analytics.
- Set up DNS (PowerDNS self-hosted or managed DNS provider) and add domain.
- Confirm Apple Developer and Google Play Console access (required for app distribution).
Deliverables:
- shared credential inventory (local secure password manager)
- documented secret naming convention
4.2 Repository and Branching Standards
Task list:
- Define branch policy:
main, short-lived feature branches. - Define PR checklist template.
- Add CODEOWNERS or at least reviewer policy.
- Add issue templates for bug and feature requests.
Deliverables:
CONTRIBUTING.md.gitea/pull_request_template.md(or repository PR template equivalent).gitea/ISSUE_TEMPLATE/*(or repository issue template equivalent)
4.3 Local Development Environment
Task list:
- Install and verify Git, Node, npm, Docker, Expo CLI.
- Add Docker compose for Postgres + Redis.
- Create
.env.examplefor API and mobile. - Add one-command local start script.
Deliverables:
infra/docker/docker-compose.ymlservices/api/.env.exampleapps/mobile/.env.example- root
Makefileor npm scripts for local startup
4.4 API and Mobile Skeletons
Task list:
- Create Fastify app with health endpoint.
- Create Expo app with tabs template.
- Add API client module to mobile app.
- Show backend health status in app.
Deliverables:
- API running on local port
- mobile app able to read API response
4.5 Data and Migration Baseline
Task list:
- Choose migration tool (for example,
node-pg-migrate,drizzle, orknex). - Create first migration set for identity tables.
- Add migration run and rollback commands.
- Add seed command for local dev data.
Minimum initial tables:
- users
- profiles
- auth_sessions
- refresh_tokens
4.6 Quality and Automation Baseline
Task list:
- Add ESLint + Prettier for API and mobile.
- Add API unit test framework and one integration test.
- Configure Gitea Actions (or Woodpecker CI) for lint + test.
- Add commit hooks (optional but recommended) using
husky.
Deliverables:
- passing CI on every push/PR
- at least one passing API integration test
5. Suggested Day-by-Day Plan
Day 1:
- account setup
- tooling install
- repo folder scaffold
Day 2:
- docker compose and env files
- API skeleton with
/health
Day 3:
- Expo app setup
- mobile to API health call
Day 4:
- migration tooling and first migrations
- baseline seed script
Day 5:
- linting and tests
- CI setup
- first stable baseline commit
6. Validation Checklist
All items must be true:
docker composestarts Postgres and Redis with no errors.- API starts and
GET /healthreturns 200. - Mobile app loads and displays backend health.
- Migrations can run on clean DB and rollback at least one step.
- CI runs lint and tests successfully.
7. Exit Criteria
You can exit Phase 0 when:
- no manual setup surprises remain for a fresh machine
- all team members can run the stack locally in under 30 minutes
- baseline quality checks are automated
8. Platform exceptions
These are not open source, but required for shipping mobile apps:
- Apple App Store tooling and APIs
- Google Play tooling and APIs
9. Typical Pitfalls and Fixes
- Pitfall: unclear
.envexpectations.- Fix: complete
.env.examplefiles with comments.
- Fix: complete
- Pitfall: mobile app cannot reach local API on real device.
- Fix: use machine LAN IP, not localhost, for device testing.
- Pitfall: migration drift.
- Fix: never edit applied migration files; create a new migration.