Files
SanatiLeads/docs/phase-1-foundation.md
2026-02-04 11:18:33 +00:00

60 lines
2.7 KiB
Markdown

# Phase 1 — Foundation & Navigation Unification
## Goals
- Resolve the split navigation/layout systems and establish a single app shell.
- Align routing so all authenticated app routes share a consistent layout.
- Prepare the data model to store analysis and opportunities in Convex.
## Scope
- Choose a single sidebar layout system.
- Move or consolidate routes so `/app/dashboard`, `/app/search`, and other app pages live under the same layout.
- Remove unused layout/components or mark deprecated ones.
- Extend Convex schema to support analysis + opportunity storage.
- Add indices required for efficient queries.
## Detailed Tasks
1. **Layout decision & consolidation**
- Pick one layout approach:
- Option A: Use `(app)` group layout (`app/(app)/layout.tsx`) + `components/sidebar.tsx`.
- Option B: Use `app/dashboard/layout.tsx` + `components/app-sidebar.tsx`.
- Confirm all protected routes render inside the chosen layout.
- Remove or archive the unused layout and sidebar component to avoid confusion.
2. **Route structure alignment**
- Ensure `/app/dashboard`, `/app/search`, `/app/settings`, `/app/help` sit under the chosen layout.
- Update sidebar links to match actual routes.
- Confirm middleware protects all app routes consistently.
3. **Convex schema expansion (analysis/opportunities)**
- Add `analyses` table:
- `projectId`, `dataSourceId`, `createdAt`, `analysisVersion`, `productName`, `tagline`, `description`, `features`, `problemsSolved`, `personas`, `keywords`, `useCases`, `competitors`, `dorkQueries`.
- Add `opportunities` table:
- `projectId`, `analysisId`, `url`, `platform`, `title`, `snippet`, `relevanceScore`, `intent`, `status`, `suggestedApproach`, `matchedKeywords`, `matchedProblems`, `tags`, `notes`, `createdAt`, `updatedAt`.
- Indices:
- `analyses.by_project_createdAt`
- `opportunities.by_project_status`
- `opportunities.by_project_createdAt`
- Optional: `opportunities.by_project_url` for dedupe.
4. **Convex API scaffolding**
- Queries:
- `analyses.getLatestByProject`
- `opportunities.listByProject` (filters: status, intent, minScore, pagination).
- Mutations:
- `opportunities.upsertBatch` (dedupe by URL + project).
- `opportunities.updateStatus`.
## Dependencies
- None. This phase unblocks persistence and UI work.
## Acceptance Criteria
- All app routes share one layout and sidebar.
- Convex schema includes analysis + opportunities tables with indices.
- Basic Convex queries/mutations exist for later phases.
## Risks
- Choosing a layout path may require minor refactors to route locations.
## Notes
- Confirm with product direction which sidebar design to keep.