# 🚀 PROJECT TIA — COMPLETE SPRINT PLAN

## Plan Architecture

Total scope: 7 sprints + Sprint 0 (setup)
Sprint length: ~3-5 days each at full sprint mode
Total timeline: ~4-5 weeks to v1 launch
Task sizing: XS (15min) / S (1hr) / M (3hr) / L (6hr) / XL (full day, break it down)

## SPRINT 0: FOUNDATION INFRASTRUCTURE

Duration: 1 day (mostly manual setup)

**Goal:** Working dev environment, repo initialized, deploy pipeline proven with hello-world.

### Tasks

**Task 0.1: Local Environment Verification** ⚠️ Manual | XS
Check: node 20+, pnpm 8+, docker 24+, git

**Task 0.2: Initialize Repository** ⚠️ Manual | S
```bash
git clone ssh://git@git.manohargupta.com:2222/manohar/tia.git
cd tia
pnpm create next-app@latest . --typescript --tailwind --app --src-dir --import-alias "@/*" --use-pnpm
```

**Task 0.3: Add Core Dependencies** 🤖 Agent | S
Add: drizzle-orm, postgres, @auth/drizzle-adapter, next-auth@beta, framer-motion, date-fns, zod, @aws-sdk/client-s3, @aws-sdk/s3-request-presigner, openai, nanoid
Dev: drizzle-kit, @types/node, tsx

**Task 0.4: Set Up Local Postgres + Redis** 🤖 Agent | M
docker-compose.dev.yml with PostgreSQL 16 (pgvector) and Redis 7

**Task 0.5: Environment Variables Skeleton** ⚠️ Manual | XS
Create .env.example and .env.local with all env vars

**Task 0.6: Verify Deploy Pipeline** ⚠️ Manual | M
Connect to Dokploy, set up auto-deploy, verify tia.manohargupta.com works

**Task 0.7: Production Postgres on Dokploy** ⚠️ Manual | M
Create Postgres with pgvector on Dokploy

**Task 0.8: Create Dockerfile** 🤖 Agent | M
Multi-stage Dockerfile for Next.js production builds

---

## SPRINT 1: DATABASE FOUNDATION + AUTH

Duration: 4-5 days

**Goal:** Mama can sign up via magic link, RLS multi-tenancy works end-to-end.

### Tasks

1.1: Drizzle Configuration
1.2: Auth Schema (NextAuth tables)
1.3: Family + Members + Children Schema
1.4: Apply RLS Policies
1.5: Drizzle Client with Family Context
1.6: NextAuth v5 Setup with Magic Links
1.7: First-Time User Onboarding Flow
1.8: Add Second Member to Family

---

## SPRINT 2: AGE-AWARE FAST-LOG ENGINE

Duration: 4-5 days

**Goal:** Mama can log feeds, sleep, diapers from a contextual home screen. Offline-tolerant.

### Tasks

2.1: Logging Schema
2.2: TypeScript Types for Each Log Type
2.3: Server Action — Create Log Entry
2.4: Stage-Aware Fast-Log Configuration
2.5: Home Screen with Fast-Log UI
2.6: Offline Queue with localStorage
2.7: PWA Manifest + Service Worker

---

## SPRINT 3: MEDICAL VAULT

Duration: 5 days

**Goal:** Complete medical record-keeping with IAP vaccination tracker, growth charts, medication log.

### Tasks

3.1: IAP Vaccination Schedule Data
3.2: Vaccination Tracking Schema
3.3: Vaccination Onboarding Flow
3.4: Vaccination Main View
3.5: Growth Tracking + WHO Percentile Charts
3.6: Medication Log + Doses + Corrections
3.7: Safety Escalation Reference Card

---

## SPRINT 4: MEDIA PIPELINE + MEMORIES GALLERY

Duration: 5 days

**Goal:** Mama can upload photos that go directly to R2, get vision-tagged, and become searchable.

### Tasks

4.1: Cloudflare R2 Setup
4.2: Memories + Attachments Schema
4.3: Presigned URL Upload Flow
4.4: Thumbnail Generation
4.5: Vision AI Tagging Pipeline
4.6: Memories Gallery UI
4.7: Semantic Memory Search

---

## SPRINT 5: AI BRAIN

Duration: 4 days

**Goal:** Mama can ask questions in natural language, get answers via the right backend.

### Tasks

5.1: LiteLLM Client Wrapper
5.2: Intent Classifier
5.3: Structured Query Path with Function Calling
5.4: Memory Search Path
5.5: General Parenting Path with Guardrails
5.6: Medical Redirect Path
5.7: AI Doubt Box UI

---

## SPRINT 6: UI/UX POLISH

Duration: 4 days

**Goal:** App feels delightful to use. Pastel slam-book aesthetic. Time-of-day theme.

### Tasks

6.1: Design Tokens + Tailwind Config
6.2: Sun/Moon Theme Switcher
6.3: Reusable Bento Components
6.4: Polish Home Screen
6.5: Polish All Other Screens
6.6: PWA Icons + Splash Screens

---

## SPRINT 7: TELEGRAM ALERTS + LAUNCH PREP

Duration: 4 days

**Goal:** Critical alerts work via Telegram. Public product page launches. App ready for daily use.

### Tasks

7.1: Telegram Bot Setup
7.2: Scheduled Alerts via Cron
7.3: Public Product Page
7.4: PDF Export for Pediatrician
7.5: Backup Automation
7.6: Final Pre-Launch Checklist