# KROW Project Plan & Task Breakdown

This document breaks down the technical roadmap into actionable tasks, assigned by role, ready to be converted into GitHub Issues.

---

## Milestone 1: Foundation & Dev Environment Setup

*Goal: Establish a fully functional, shared `dev` environment on GCP/Firebase and validate that all core components (Web, Mobile, Backend) can be built, deployed, and connected.*

### Infrastructure & Tooling (Primarily CTO)
- **Issue:** `[Infra] Setup Enpass for Team Credential Management`
  - **Description:** Configure the team's Enpass vault and establish the process for sharing secrets and service account keys.
- **Issue:** `[Infra] Create GCP/Firebase Projects (dev, staging, prod)`
  - **Description:** Set up the three distinct Google Cloud projects and associated Firebase projects. Enable required APIs (Auth, Cloud SQL, Data Connect).
- **Issue:** `[Infra] Create Multi-Env Makefile`
  - **Description:** Create the main `Makefile` to handle environment switching (`ENV=dev/staging`) and orchestrate all build/deploy tasks.
- **Issue:** `[Infra] Setup Shared Dev Database`
  - **Description:** Provision the initial Cloud SQL for PostgreSQL instance for the `dev` environment.

### Backend & Web (Dev 1)
- **Epic:** `[Onboarding] End-to-End Flow Validation with 'Event' Entity`
  - **Issue:** `[Backend] Define and Deploy 'Event' Schema`
    - **Description:** Translate the `Event` schema from the API specification into `.gql` files. Define the basic `listEvents` query and `createEvent` mutation. Use the `Makefile` to deploy this to the `dev` environment and validate that the `events` table is created in Cloud SQL.
  - **Issue:** `[Web] Generate TypeScript SDK for Dev Env`
    - **Description:** Configure and run the SDK generation command to create the TypeScript SDK pointing to the `dev` environment.
  - **Issue:** `[Web] Connect 'Events' Page to Dev Backend (PoC)`
    - **Description:** Modify the main web application's `Events.jsx` page. Replace the existing mock/Base44 data fetching with the new TanStack Query hooks from the generated SDK to display a list of events from our own `dev` backend. This validates the full end-to-end workflow on a real feature.

- **Epic:** `[Backend] KROW Schema Implementation`
  - **Issue:** `[Backend] Define GraphQL Schema for Remaining Core Entities`
    - **Description:** Translate `Staff`, `Vendor`, `User`, and other core schemas from the API specification into `.gql` files and deploy them.

### Mobile (Dev 2)
- **Epic:** `[Mobile] Analysis & Documentation`
  - **Issue:** `[Mobile-Doc] Analyze & Document Existing App Logic`
    - **Description:** Review the legacy Flutter codebases to identify and document key business logic and user flows.
  - **Issue:** `[Mobile-Doc] Create & Update Workflow Diagrams`
    - **Description:** Based on the analysis, create or update Mermaid diagrams for critical workflows and add them to the internal launchpad.

- **Epic:** `[Mobile] CI/CD & Skeleton App Setup`
  - **Issue:** `[Mobile-CI/CD] Configure CodeMagic & Firebase App Distribution`
    - **Description:** Set up CodeMagic and configure build workflows for iOS/Android with automated deployment to Firebase App Distribution.
  - **Issue:** `[Mobile-CI/CD] Initialize Skeleton Apps in Monorepo`
    - **Description:** Create new, clean Flutter projects for `client-app` and `staff-app` within the `mobile-apps` directory.
  - **Issue:** `[Mobile-CI/CD] Implement Initial CI/CD Pipeline`
    - **Description:** Create a "Hello World" version of the Staff app and validate that it can be automatically built and deployed to App Distribution.

- **Epic:** `[Mobile] Backend Integration Validation`
  - **Issue:** `[Mobile-Auth] Implement Firebase Auth Flow in Skeleton App`
    - **Description:** Add Firebase Authentication to the skeleton Staff app and ensure users can sign up/log in against the `dev` project.
  - **Issue:** `[Mobile-Backend] Generate Flutter SDK for Dev Env`
    - **Description:** Configure and run the SDK generation command to create the Flutter SDK for the `dev` environment.
  - **Issue:** `[Mobile-Backend] Create Proof-of-Concept Screen`
    - **Description:** Build a simple screen in the skeleton Staff app that, after login, fetches and displays a list of events from the `dev` backend using the new SDK.

---

## Milestone 2: Core Feature Implementation

*Goal: Achieve functional parity with the Base44 prototype across all platforms, using the shared `dev` backend.*

### Backend (Dev 1)
- **Epic:** `[Backend] Implement Full API Logic`
  - **Description:** Create all necessary GraphQL queries and mutations in Data Connect for all entities. Deploy them continuously to the `dev` environment.

### Web (Dev 1, with support from Dev 2)
- **Epic:** `[Web] Full Application Re-wiring`
  - **Description:** Systematically replace all data-fetching logic in the web app to use the TanStack Query hooks from the generated Data Connect SDK.

### Mobile (Dev 2)
- **Epic:** `[Mobile] Port Features to New Apps`
  - **Description:** Systematically port the features and UI from the legacy apps into the new, clean skeleton apps, connecting them to the Data Connect backend via the generated SDK.

---

## Milestone 3: Production Readiness & Go-Live

*Goal: Automate, secure, and deploy the entire platform to production.*

### Infrastructure & DevOps (CTO & Team)
- **Issue:** `[CI/CD] Configure Web App Deployment Pipeline`
  - **Description:** Set up a GitHub Actions pipeline to build and deploy the web app to Firebase Hosting (`staging` and `prod`).
- **Issue:** `[CI/CD] Finalize Production Mobile Deployment`
  - **Description:** Finalize the CodeMagic pipelines for deployment to TestFlight/Play Store production tracks.
- **Issue:** `[CI/CD] Configure Backend Deployment Pipeline`
  - **Description:** Automate the deployment of the Data Connect schema and operations.
- **Issue:** `[Data] Create & Test Initial Data Import Scripts`
  - **Description:** Write scripts to populate the production database with any necessary initial data.
- **Issue:** `[QA] Deploy to Staging & Perform E2E Testing`
  - **Description:** Use the `Makefile` (`make deploy ENV=staging`) to deploy the entire stack to the staging environment for full end-to-end testing.
- **Issue:** `[Ops] Final Production Deployment`
  - **Description:** Run the production deployment (`make deploy ENV=prod`) and execute data import scripts.
- **Issue:** `[Ops] Setup Monitoring & Alerting`
  - **Description:** Configure monitoring dashboards in Google Cloud for the database, API, and application performance.
