# Vibn Product Roadmap & To-Do List

This document tracks the immediate next steps for the Vibn UI and project management features.

## 1. Complete the "Plan" UI
*Status: Pending*

The Plan UI needs to be the central hub where founders and AI agents collaborate on the product roadmap, user stories, and architecture.

**Key Tasks:**
- **Visual Design:** Implement the UI for viewing and editing the PRD (Product Requirements Document). 
- **Agent Integration:** Ensure the `Atlas` (PRD) and `PM` (Product Manager) agents can seamlessly update the plan and reflect changes in the UI in real-time.
- **Task Management:** Build out the interface for tracking actionable tasks (e.g., KanBan or List view) that the `Coder` agent can pick up and execute.
- **Database Sync:** Ensure all UI interactions correctly read/write to the `phase_data` or `plan` JSON structure in the Postgres database.

## 2. Build the "Messages/Inbox" UI
*Status: Pending*

Projects need a dedicated "Messages" tab to act as a unified inbox for all external communications, specifically emails sent by the AI or the platform.

**Key Tasks:**
- **Email History Table:** Create a Postgres table (e.g., `project_messages`) to log every email sent via the new Mailgun integration. The schema should include: `project_id`, `to`, `subject`, `body_text`, `body_html`, `sent_at`, and `status`.
- **Backend Logging:** Update the `app/api/mcp/route.ts` `email.send` tool to insert a record into this new table immediately after a successful Mailgun dispatch.
- **UI Implementation:** Build a clean Inbox UI within the Project Dashboard.
  - List view of all sent/received messages.
  - Detail view to read the actual email content (rendering the compiled HTML/MJML safely).
  - *(Future)* Webhook integration with Mailgun to receive replies and log them in this same UI.

## 3. Implement System-Wide Real-Time UI Updates
*Status: Pending*

**Key Tasks:**
- Implement the Postgres `LISTEN/NOTIFY` event bus (as defined in `REALTIME_UPDATES.md`).
- Build the Next.js Server-Sent Events (SSE) `/api/projects/[projectId]/stream` route.
- Wrap the Project layout with a `useProjectStream` hook so SWR automatically re-fetches when the background AI modifies the database (e.g., checking off tasks, editing the PRD).

## 4. Integrate Open-Source Analytics (Umami)
*Status: Pending*

Every project deployed by Vibn should automatically have privacy-first analytics injected and visible to the founder.

**Key Tasks:**
- **Infrastructure:** Deploy Umami via Coolify using Docker Compose (backed by the existing Postgres DB).
- **Automation:** Build a backend integration so when an AI ships a project, Vibn programmatically calls the Umami API to generate a unique `Website ID` for that project.
- **Code Injection:** Ensure the AI agent automatically injects the Umami `<script>` tag with the correct ID into the project's root `layout.tsx`.
- **UI Dashboard:** Add an "Analytics" tab to the project workspace that surfaces the Umami traffic metrics natively inside Vibn.