docs: complete project research

This commit is contained in:
2026-04-02 15:30:56 +02:00
parent 8fdab4b796
commit 0b72f1c305
5 changed files with 1204 additions and 1010 deletions

View File

@@ -1,452 +1,545 @@
# Architecture Research
**Domain:** Personal finance dashboard UI — React SPA overhaul
**Researched:** 2026-03-16
**Confidence:** HIGH (existing codebase is fully inspected; patterns are grounded in Radix/shadcn/Recharts official docs)
**Domain:** Personal budget dashboard — v2.0 UX simplification with wizard setup, auto-budget creation, inline add-from-library, design system rework
**Researched:** 2026-04-02
**Confidence:** HIGH (based on full codebase inspection; all claims verified against source files)
---
## Standard Architecture
## Existing Architecture Baseline
### System Overview
This is a subsequent milestone. The section below describes what EXISTS today, then each sub-section documents exactly what changes and what stays the same.
The existing three-tier architecture (Pages → Hooks → Supabase) is sound and must be preserved. The UI overhaul introduces a new layer of **dashboard-specific view components** that sit between pages and the primitive shadcn/ui atoms. Nothing touches hooks or the library layer.
### Current System Layout
```
┌───────────────────────────────────────────────────────────────┐
Pages Layer
DashboardPage CategoriesPage BudgetDetailPage ...
(routing, data loading, layout composition)
───────────────────────────────────────────────────────────────┤
View Components Layer [NEW]
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ DashboardContent│ │CategorySection│ │ ChartPanel │
│ (hybrid layout) │ │(collapsible) │ │ (chart wrappers)│
└─────────────────┘ └──────────────┘ └─────────────────┘
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ SummaryStrip │ BudgetTable PageShell
│ (KPI cards row) │ │ (line items) │ │ (consistent
└─────────────────┘ └──────────────┘ │ header+CTA) │
└─────────────────┘
├───────────────────────────────────────────────────────────────┤
Primitive UI Layer (shadcn/ui)
Card Button Table Dialog Select Collapsible Badge ...
├───────────────────────────────────────────────────────────────┤
Hooks Layer [UNCHANGED]
useBudgets useBudgetDetail useCategories useAuth ...
───────────────────────────────────────────────────────────────┤
Library Layer [UNCHANGED] │
│ supabase.ts types.ts format.ts palette.ts utils.ts │
index.css (@theme tokens — EXTEND for new color tokens)
└───────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────
React 19 SPA (Vite + TypeScript)
Auth Layer App Layer (ProtectedRoute + AppLayout)
│ ┌───────────────┐ ┌─────────────────────────────────────────┐ │
│ LoginPage │ SidebarProvider > Sidebar > SidebarInset│
│ RegisterPage │ │ 6 nav items → 6 protected page routes │
└───────────────┘ └─────────────────────────────────────────┘
Pages (each uses PageShell + direct hook calls):
DashboardPage CategoriesPage TemplatePage BudgetListPage
BudgetDetailPage QuickAddPage SettingsPage
Hooks (TanStack Query v5, direct supabase-js client):
useAuth useCategories useTemplate useBudgets useQuickAdd
│ useMonthParam useBudgetDetail │
Design layer:
│ index.css @theme inline → OKLCH tokens → Tailwind 4 utility classes│
lib/palette.ts → categoryColors (CSS var references only)
shadcn/ui (radix-ui primitives + generated component files)
└─────────────────────────┬───────────────────────────────────────────
│ @supabase/supabase-js v2 (REST + RLS)
┌─────────────────────────▼───────────────────────────────────────────┐
Supabase (PostgreSQL 16 + Auth + Row Level Security)
│ Tables: profiles, categories, templates, template_items, │
│ budgets, budget_items, quick_add_items │
└─────────────────────────────────────────────────────────────────────┘
```
**The constraint is strict:** hooks and library are read-only during this milestone. All UI overhaul changes land in `src/pages/`, `src/components/`, and `src/index.css` only.
### Key Existing Patterns (Carry Forward Unchanged)
| Pattern | Location | Keep? |
|---------|----------|-------|
| PageShell header wrapper | `components/shared/PageShell.tsx` | YES |
| DashboardContent inner component keyed by budgetId | `DashboardPage.tsx` | YES — key prop pattern prevents stale state on month change |
| useMonthParam URL search param | `hooks/useMonthParam.ts` | YES |
| getOrCreateTemplate (auto-creates template row) | `hooks/useTemplate.ts` | YES |
| generateFromTemplate mutation | `hooks/useBudgets.ts` | YES — v2.0 triggers it automatically |
| Two-tier OKLCH color tokens (text ~0.55L, fill ~0.68L) | `index.css` | YES — values tuned, names unchanged |
| categoryColors CSS var references | `lib/palette.ts` | YES — names unchanged |
| Direction-aware diff (income under = bad, spending over = bad) | `BudgetDetailPage.tsx`, `CategorySection.tsx` | YES |
| TanStack Query cache invalidation per resource key | All mutation hooks | YES |
---
### Component Responsibilities
## v2.0 Architecture Changes
| Component | Responsibility | Typical Implementation |
|-----------|----------------|------------------------|
| `DashboardPage` | Find current month budget, render shell | Unchanged outer page; delegates to `DashboardContent` |
| `DashboardContent` | Hybrid layout orchestration | Calls `useBudgetDetail`; computes derived data with `useMemo`; renders SummaryStrip + charts + CategorySections |
| `SummaryStrip` | Three KPI cards (income, expenses, balance) | Grid of `StatCard` components; color-coded balance |
| `StatCard` | Single KPI display unit | shadcn Card with title, large number, optional trend indicator |
| `ChartPanel` | Houses all charts in responsive grid | Two-column grid on desktop: income bar chart left, expense donut right, spend horizontal bar full-width below |
| `IncomeBarChart` | Budgeted vs actual income vertical bar | Recharts `BarChart` wrapped in `ChartContainer` with `ChartConfig` |
| `ExpenseDonutChart` | Expense category breakdown donut | Recharts `PieChart` with `innerRadius`/`outerRadius` + custom legend |
| `SpendBarChart` | Horizontal budget vs actual by category type | Recharts `BarChart layout="vertical"` |
| `CategorySection` | Collapsible group for one category type | Radix `Collapsible.Root` wrapping a header row + `BudgetLineItems` |
| `CategorySectionHeader` | Always-visible row: type label, color dot, group totals, chevron | Trigger for the collapsible; shows budgeted/actual/diff inline |
| `BudgetLineItems` | Table of individual line items inside a section | shadcn `Table`; thin wrapper around existing `InlineEditCell` / `DifferenceCell` atoms |
| `PageShell` | Consistent page header with title + primary CTA | Reusable wrapper used by every page; enforces padding, heading size, CTA slot |
| `AppLayout` | Sidebar navigation shell | Minor visual refresh only; structure unchanged |
### 1. First-Run Detection and Wizard Routing
---
**Problem:** New users land on Dashboard with empty categories, no template, no budget. The blank state offers no guidance.
## Recommended Project Structure
**Solution:** A `useFirstRunState` hook detects first-run status. A `WizardRoute` guard in `App.tsx` redirects first-run users to `/setup` (a dedicated wizard page) before they can reach any other protected route.
The existing structure is well-organized. The overhaul adds a `dashboard/` subfolder and a `shared/` subfolder under components — no reorganization of hooks or lib.
**New hook — `src/hooks/useFirstRunState.ts`:**
```
src/
├── components/
│ ├── ui/ # shadcn primitives (do not modify)
│ │ └── collapsible.tsx # ADD — Radix Collapsible primitive
│ ├── dashboard/ # ADD — dashboard-specific view components
│ │ ├── DashboardContent.tsx # hybrid layout orchestrator
│ │ ├── SummaryStrip.tsx # KPI cards row
│ │ ├── StatCard.tsx # single KPI card
│ │ ├── ChartPanel.tsx # chart grid container
│ │ ├── IncomeBarChart.tsx # budgeted vs actual income bar
│ │ ├── ExpenseDonutChart.tsx # donut + legend
│ │ ├── SpendBarChart.tsx # horizontal budget vs actual
│ │ ├── CategorySection.tsx # collapsible category group
│ │ └── BudgetLineItems.tsx # line-item table inside section
│ ├── shared/ # ADD — cross-page reusable components
│ │ └── PageShell.tsx # consistent page header + CTA slot
│ ├── AppLayout.tsx # MODIFY — visual refresh only
│ └── QuickAddPicker.tsx # unchanged
├── pages/ # MODIFY — swap DashboardContent import; apply PageShell
│ ├── DashboardPage.tsx
│ ├── BudgetDetailPage.tsx
│ ├── BudgetListPage.tsx
│ ├── CategoriesPage.tsx
│ ├── TemplatePage.tsx
│ ├── QuickAddPage.tsx
│ ├── SettingsPage.tsx
│ ├── LoginPage.tsx
│ └── RegisterPage.tsx
├── hooks/ # UNCHANGED
├── lib/
│ ├── palette.ts # UNCHANGED — CSS vars already defined
│ └── ... # everything else unchanged
├── i18n/
│ ├── en.json # ADD new translation keys
│ └── de.json # ADD new translation keys
└── index.css # ADD semantic color tokens if needed
```
### Structure Rationale
- **`components/dashboard/`:** All dashboard-specific view components are co-located. They have no meaning outside the dashboard, so they do not belong in `shared/`. Avoids polluting the top-level components directory.
- **`components/shared/`:** `PageShell` is the one genuinely cross-page component introduced by this milestone. Keeping it separate signals that it is intentionally reusable, not page-specific.
- **`components/ui/collapsible.tsx`:** The Radix Collapsible primitive is not yet in the project (inspected file list confirms absence). It must be added via `npx shadcn@latest add collapsible` before building `CategorySection`.
---
## Architectural Patterns
### Pattern 1: Derived Data via `useMemo` in DashboardContent
**What:** All computed values — category group totals, chart data arrays, KPI numbers — are derived in one place (`DashboardContent`) using `useMemo`, then passed as plain props to presentational child components. Child components never call hooks or perform calculations themselves.
**When to use:** Any time a value depends on `items` array from `useBudgetDetail`. Centralizing derivation means one cache invalidation (after a budget item update) triggers one recalculation, and all children rerender from the same consistent snapshot.
**Trade-offs:** Slightly more props-passing verbosity. Benefit: children are trivially testable pure components.
**Example:**
```typescript
// DashboardContent.tsx
const { budget, items } = useBudgetDetail(budgetId)
const totals = useMemo(() => {
const income = items
.filter(i => i.category?.type === "income")
.reduce((sum, i) => sum + i.actual_amount, 0)
const expenses = items
.filter(i => i.category?.type !== "income")
.reduce((sum, i) => sum + i.actual_amount, 0)
return { income, expenses, balance: income - expenses + (budget?.carryover_amount ?? 0) }
}, [items, budget?.carryover_amount])
const groupedItems = useMemo(() =>
CATEGORY_TYPES.map(type => ({
type,
items: items.filter(i => i.category?.type === type),
budgeted: items.filter(i => i.category?.type === type).reduce((s, i) => s + i.budgeted_amount, 0),
actual: items.filter(i => i.category?.type === type).reduce((s, i) => s + i.actual_amount, 0),
})).filter(g => g.items.length > 0),
[items])
// Pass totals and groupedItems as props; child components are pure
// Returns { needsSetup: boolean, loading: boolean }
// needsSetup = true when: categories.length === 0 OR template_items.length === 0
// Uses existing useCategories() and useTemplate() — no new DB queries
export function useFirstRunState(): { needsSetup: boolean; loading: boolean }
```
### Pattern 2: Collapsible Category Sections via Radix Collapsible
**Route change — `src/App.tsx`:**
**What:** Each category group (income, bills, variable expenses, debt, savings, investment) is wrapped in a `Collapsible.Root`. The always-visible trigger row shows the category label, color dot, and group-level budget/actual/difference totals. The collapsible content reveals the individual line-item table.
```
// Add /setup route
// Add WizardRoute guard that wraps the existing ProtectedRoute subtree:
// if needsSetup && path !== "/setup" → redirect to /setup
// if !needsSetup && path === "/setup" → redirect to /
**When to use:** The dashboard hybrid view — users need the summary at a glance without scrolling through every line item. Opening a section is an explicit drill-down action.
<Route path="/setup" element={<ProtectedRoute><SetupWizardPage /></ProtectedRoute>} />
```
**Trade-offs:** Adds `open` state per section. Use `useState` per section (not global state — there are at most 6 sections). Do not persist open state in localStorage for v1; the sections should open fresh on each visit so the summary view is the default.
**Wizard state — local `useState` only in `SetupWizardPage`:**
**Example:**
```typescript
// CategorySection.tsx
import { Collapsible, CollapsibleContent, CollapsibleTrigger }
from "@/components/ui/collapsible"
import { ChevronDown } from "lucide-react"
import { useState } from "react"
interface CategorySectionProps {
type: CategoryType
budgeted: number
actual: number
items: BudgetItem[]
currency: string
}
export function CategorySection({ type, budgeted, actual, items, currency }: CategorySectionProps) {
const [open, setOpen] = useState(false)
const { t } = useTranslation()
return (
<Collapsible open={open} onOpenChange={setOpen}>
<CollapsibleTrigger asChild>
<button className="flex w-full items-center gap-3 rounded-lg border px-4 py-3 hover:bg-muted/40">
<span className="size-3 shrink-0 rounded-full"
style={{ backgroundColor: categoryColors[type] }} />
<span className="font-medium">{t(`categories.types.${type}`)}</span>
<span className="ml-auto tabular-nums text-sm text-muted-foreground">
{formatCurrency(actual, currency)} / {formatCurrency(budgeted, currency)}
</span>
<ChevronDown className={`size-4 transition-transform ${open ? "rotate-180" : ""}`} />
</button>
</CollapsibleTrigger>
<CollapsibleContent>
<BudgetLineItems items={items} currency={currency} type={type} />
</CollapsibleContent>
</Collapsible>
)
type WizardState = {
step: 1 | 2 | 3
selectedPresets: string[] // preset IDs chosen in step 1
amounts: Record<string, number> // presetId → budgeted amount (step 2)
}
```
### Pattern 3: shadcn ChartContainer + ChartConfig for All Charts
Wizard state is ephemeral. It lives in the page component and is discarded on unmount. No context, no global store.
**What:** Wrap every Recharts chart in shadcn's `ChartContainer` component. Define colors and labels in a `ChartConfig` object that references existing CSS variable tokens from `index.css` (`var(--color-income)`, `var(--color-bill)`, etc.). Do not hardcode hex values inside chart components.
**Completion flow:** `handleFinish()` in `SetupWizardPage` runs:
1. `useCategories().create` × N (create one category row per selected preset)
2. `useTemplate().createItem` × N (create template items, each linked to the new categories)
3. `navigate("/")` — DashboardPage loads, `useFirstRunState` returns `needsSetup=false`
**When to use:** All three chart types (bar, horizontal bar, donut). This ensures charts automatically theme with the design system and dark mode works at zero extra cost.
**Preset data — `src/data/presets.ts`:** Static array of common budget items (rent, salary, groceries, car insurance, etc.) with suggested amounts and category types. No DB table needed — this is compile-time data.
**Trade-offs:** Requires adding the shadcn `chart` component (`npx shadcn@latest add chart`). Minor wrapper overhead, but the CSS variable binding and tooltip consistency is worth it.
**No new DB migration.** Wizard writes to existing `categories` and `template_items` tables.
**New files:**
- `src/hooks/useFirstRunState.ts`
- `src/pages/SetupWizardPage.tsx`
- `src/components/wizard/WizardStep.tsx`
- `src/components/wizard/CategoryDefaults.tsx`
- `src/components/wizard/TemplateDefaults.tsx`
- `src/data/presets.ts`
**Modified files:**
- `src/App.tsx` — add `/setup` route + WizardRoute guard
---
### 2. Auto-Budget Creation on Month Visit
**Problem:** Visiting the dashboard for a new month shows an empty state with two manual buttons ("Create Budget", "Generate from Template"). This friction contradicts the "just works" goal.
**Solution:** Auto-trigger `generateFromTemplate` inside a `useEffect` in `DashboardPage` when no budget exists for the current month and the user's template has items.
**Integration point — `src/pages/DashboardPage.tsx`:**
Add `useTemplate()` call alongside the existing `useBudgets()` call. Add a `useEffect` with these guards:
**Example:**
```typescript
// IncomeBarChart.tsx
import { ChartContainer, ChartTooltip, ChartTooltipContent }
from "@/components/ui/chart"
import { BarChart, Bar, XAxis, YAxis, CartesianGrid } from "recharts"
const { items: templateItems } = useTemplate()
const hasTemplateItems = templateItems.length > 0
const isCurrentMonth = month === currentMonth // currentMonth from useMonthParam baseline
const attempted = useRef(false)
const chartConfig = {
budgeted: { label: "Budgeted", color: "var(--color-income)" },
actual: { label: "Actual", color: "var(--color-income)" },
} satisfies ChartConfig
// data: [{ month: "March", budgeted: 3000, actual: 2850 }]
export function IncomeBarChart({ data, currency }: Props) {
return (
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
<BarChart data={data}>
<CartesianGrid vertical={false} />
<XAxis dataKey="month" />
<YAxis tickFormatter={v => formatCurrency(v, currency)} />
<ChartTooltip content={<ChartTooltipContent />} />
<Bar dataKey="budgeted" fill="var(--color-income)" radius={4} />
<Bar dataKey="actual" fill="var(--color-income)" fillOpacity={0.6} radius={4} />
</BarChart>
</ChartContainer>
)
}
useEffect(() => {
if (
!loading &&
!currentBudget &&
hasTemplateItems &&
isCurrentMonth &&
!attempted.current &&
!generateFromTemplate.isPending
) {
attempted.current = true
generateFromTemplate.mutate({ month: parsedMonth, year: parsedYear, currency })
}
}, [loading, currentBudget, hasTemplateItems, isCurrentMonth])
```
### Pattern 4: PageShell for Consistent Page Headers
**Currency source:** The `generateFromTemplate` mutation currently accepts `currency` as a param. Pull the user's preferred currency from the profile via a `useProfile` hook or extend `useAuth` to expose it. If `useProfile` is not yet implemented, fall back to reading from the most recent budget's `currency` field, or default to the settings page value.
**What:** A `PageShell` component accepts `title`, `description` (optional), and `action` (optional ReactNode slot for a primary CTA button). Every page wraps its top section in `PageShell`. This enforces a consistent heading size, spacing, and CTA placement across the entire app refresh.
**No new API endpoint.** The `generateFromTemplate` mutation in `useBudgets.ts` already handles the full create + seed flow server-side. This is a pure frontend trigger change.
**When to use:** All 9 pages in the overhaul. Any new page added in future milestones should also use it.
**Edge cases handled by the guards:**
- Template has 0 items → `hasTemplateItems=false` → skip auto-create, show prompt to configure template
- Budget already exists → `!currentBudget=false` → skip
- Past/future month navigation → `isCurrentMonth=false` → skip (only auto-create for today's month)
- Multiple renders before mutation completes → `attempted` ref prevents double-fire
**Trade-offs:** Adds one wrapper per page. The benefit is that a single visual change to the page header propagates everywhere without hunting through 9 files.
**Modified files:**
- `src/pages/DashboardPage.tsx` — add useTemplate(), useEffect trigger, currency source
---
### 3. Inline Add-from-Category-Library (Replaces QuickAdd Page)
**Problem:** QuickAdd is a separate nav page (`/quick-add`), a separate table (`quick_add_items`), and a Popover on the Dashboard. Three disconnected surfaces for one concept. The mental model is unclear.
**Solution:** Replace the QuickAdd Popover with an `AddOneOffSheet` component (a shadcn Sheet/side panel) available directly on BudgetDetailPage and Dashboard. It shows the user's category list grouped by type. The user picks a category, enters an amount, and a `one_off` budget item is created. The `quick_add_items` table remains intact but is removed from the primary workflow.
**New component — `src/components/budget/AddOneOffSheet.tsx`:**
**Example:**
```typescript
// shared/PageShell.tsx
interface PageShellProps {
title: string
description?: string
action?: React.ReactNode
children: React.ReactNode
interface AddOneOffSheetProps {
budgetId: string
open: boolean
onOpenChange: (open: boolean) => void
}
// Uses: useCategories() + useBudgets().createItem
// On save: createItem.mutate({ budgetId, category_id, budgeted_amount, actual_amount, notes, item_tier: "one_off" })
```
export function PageShell({ title, description, action, children }: PageShellProps) {
return (
<div className="flex flex-col gap-6">
<div className="flex items-start justify-between gap-4">
<div>
<h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
{description && (
<p className="text-sm text-muted-foreground mt-1">{description}</p>
)}
</div>
{action && <div className="shrink-0">{action}</div>}
</div>
{children}
</div>
)
}
This replaces `QuickAddPicker.tsx` at both call sites. The existing `useBudgets().createItem` mutation is unchanged — it already inserts `item_tier: "one_off"` budget items.
**QuickAdd page fate:** Remove from `AppLayout.tsx` nav items array. Keep the route and page file in place (backwards compat, existing data). Do NOT drop the `quick_add_items` table or `useQuickAdd` hook.
**Modified files:**
- `src/components/AppLayout.tsx` — remove QuickAdd from `navItems` array
- `src/pages/DashboardPage.tsx` — replace `<QuickAddPicker>` with `<AddOneOffSheet>`
- `src/pages/BudgetDetailPage.tsx` — replace `<QuickAddPicker>` with `<AddOneOffSheet>`
**New files:**
- `src/components/budget/AddOneOffSheet.tsx`
**No DB migration needed.** `one_off` budget items already exist in `budget_items` with `item_tier = 'one_off'`.
---
### 4. Dashboard Simplification
**Problem:** The current dashboard renders three chart types (donut + two bar charts) in a 3-column grid plus collapsible sections. This is dense and the charts don't clearly reflect user-entered data. v2.0 goal: "this month's budget at a glance."
**Solution:** Remove the 3-column chart grid from `DashboardContent`. Keep `SummaryStrip` (3 KPI cards) and `CollapsibleSections`. The chart components stay in the codebase — they are correct — but are removed from the Dashboard layout.
**Modified files:**
- `src/pages/DashboardPage.tsx` — remove chart grid `<div>` and the three chart imports from `DashboardContent`
**Dashboard data correctness:** The aggregation logic (`totalIncome`, `totalExpenses`, `budgetedIncome`, `budgetedExpenses`) is already correct in `DashboardContent`. The perceived "data not reflecting input" issue is caused by the auto-create flow not existing yet — once a budget exists and items are populated, the existing calculations are accurate. No aggregation logic changes needed.
**Empty state after removing charts:** The removed chart area frees vertical space. Collapsible sections become the primary view. The `SummaryStrip` at the top provides the quick-glance summary. Consider adding a single "at a glance" progress indicator to `SummaryStrip` to compensate for the removed chart density.
---
### 5. Design System Token Rework
**Problem:** `--radius: 0.625rem` produces rounded corners everywhere. The palette has high chroma values that read as saturated rather than pastel.
**Solution:** Lower the radius token and tune OKLCH lightness/chroma in `index.css`. All shadcn/ui components reference `--radius` via `rounded-[--radius]` — a single value change propagates everywhere.
**The only changed file: `src/index.css`**
Key changes:
```css
/* Sharp edges */
--radius: 0.125rem; /* was 0.625rem */
/* Background: warmer, closer to pure white */
--color-background: oklch(0.99 0.003 260); /* was 0.98 0.005 260 */
/* Softer border */
--color-border: oklch(0.91 0.008 260); /* was 0.88 0.01 260 */
/* Category pastels: increase lightness slightly, keep chroma */
/* e.g. --color-income-fill: oklch(0.72 0.14 155) → 0.78 0.12 155 */
```
**What does NOT change:**
- Token names (e.g., `--color-income`, `--color-bill`) — `palette.ts` references these by name
- Two-tier pattern (text tokens at ~0.55L, fill tokens at ~0.680.78L)
- Category color identities (income=green, bill=orange-red, etc.)
- The `@theme inline` structure
**shadcn component customization:** Zero component-file changes required. Radius change propagates automatically. Color changes propagate via CSS var resolution.
---
## Updated System Layout (v2.0)
```
┌─────────────────────────────────────────────────────────────────────┐
│ React 19 SPA │
│ │
│ Auth Layer App Layer │
│ ┌───────────────┐ ┌─────────────────────────────────────────┐ │
│ │ LoginPage │ │ WizardRoute (NEW) │ │
│ │ RegisterPage │ │ └─ ProtectedRoute + AppLayout (MOD) │ │
│ └───────────────┘ │ Sidebar (5 nav items, -QuickAdd) │ │
│ └─────────────────────────────────────────┘ │
│ │
│ New route /setup: │
│ SetupWizardPage (NEW) → 3 steps → writes categories + template │
│ │
│ Modified pages: │
│ DashboardPage (MOD: auto-create, -charts, AddOneOffSheet) │
│ BudgetDetailPage (MOD: AddOneOffSheet replaces QuickAddPicker) │
│ │
│ Unchanged pages: │
│ CategoriesPage TemplatePage BudgetListPage SettingsPage │
│ QuickAddPage (hidden from nav, route kept) │
│ │
│ New components: │
│ wizard/WizardStep wizard/CategoryDefaults wizard/TemplateDefaults│
│ budget/AddOneOffSheet │
│ │
│ New hooks: │
│ useFirstRunState │
│ │
│ New data: │
│ src/data/presets.ts (static, no DB) │
└─────────────────────────┬───────────────────────────────────────────┘
│ @supabase/supabase-js v2 (unchanged)
┌─────────────────────────▼───────────────────────────────────────────┐
│ Supabase (unchanged schema, no new migrations) │
│ All new features write to existing tables │
└─────────────────────────────────────────────────────────────────────┘
```
---
## Data Flow
### Dashboard Read Flow
## Component Boundary Map (v2.0)
```
DashboardPage renders
useBudgets() → finds current month budget → passes budgetId prop
DashboardContent mounts
useBudgetDetail(budgetId) → TanStack Query cache or Supabase fetch
↓ data arrives
useMemo recalculates: totals, groupedItems, chartData
Props flow DOWN to pure presentational children:
SummaryStrip(totals)
ChartPanel(chartData, currency)
├── IncomeBarChart(barData)
├── ExpenseDonutChart(pieData)
── SpendBarChart(horizontalData)
CategorySection[] (groupedItems, per-type items)
── BudgetLineItems(items, currency)
App.tsx
├── /login → LoginPage
├── /register → RegisterPage
├── /setup → ProtectedRoute > SetupWizardPage (NEW)
│ ├── WizardStep (NEW)
├── step 1: CategoryDefaults (NEW) — checkboxes from presets.ts
│ └── step 2: TemplateDefaults (NEW) — amount inputs per selected preset
└── /* → WizardRoute > ProtectedRoute > AppLayout (MODIFIED: -QuickAdd nav)
├── / → DashboardPage (MODIFIED)
│ ├── MonthNavigator
│ ├── DashboardContent (MODIFIED: no chart grid)
│ │ ├── SummaryStrip (unchanged)
│ │ ├── CollapsibleSections (unchanged)
│ │ └── AddOneOffSheet (NEW, replaces QuickAddPicker)
├── /categories → CategoriesPage (unchanged)
── /template → TemplatePage (unchanged)
├── /budgets → BudgetListPage (unchanged)
── /budgets/:id → BudgetDetailPage (MODIFIED)
│ └── AddOneOffSheet (NEW, replaces QuickAddPicker)
├── /quick-add → QuickAddPage (hidden from nav, route kept)
└── /settings → SettingsPage (unchanged)
```
### Budget Item Edit Flow (unchanged, flows back up)
---
## Data Flow Changes
### First-Run + Wizard Completion Flow
```
InlineEditCell: user types new actual_amount
New user lands on any protected route
onCommit → updateItem.mutateAsync({ id, budgetId, actual_amount })
WizardRoute: useFirstRunState() → needsSetup=true
Supabase updates budget_items row
redirect /setup
onSuccess: queryClient.invalidateQueries(["budgets", budgetId, "items"])
SetupWizardPage renders (step 1)
User checks preset categories (Rent, Salary, Groceries, ...)
↓ [Next]
step 2: User adjusts amounts per selected category
↓ [Finish] → handleFinish()
useBudgetDetail re-fetches items
useCategories().create × N → INSERT categories (N rows)
↓ await
useTemplate().createItem × N → INSERT template_items (N rows)
↓ await
navigate("/")
DashboardContent useMemo recalculates all derived values
ALL children rerender with consistent new data
DashboardPage: useFirstRunState() → needsSetup=false
Auto-create effect fires (see below)
```
### State Management (what lives where)
### Auto-Budget Creation Flow
| State | Location | Why |
|-------|----------|-----|
| Budget and items data | TanStack Query cache | Server state, must survive component unmounts |
| Collapsible open/closed | `useState` in each `CategorySection` | Purely local UI state; 6 booleans maximum |
| Chart tooltip hover | Recharts internal | Library-managed interaction state |
| Dialog open/closed | `useState` in page components | Unchanged from current pattern |
| Currency, locale | `Profile` via Supabase → hooks | Read from `budget.currency`; no separate state |
```
DashboardPage mounts (month = "2026-04", current month)
useBudgets() → budgets list → currentBudget = undefined
useTemplate() → items → hasTemplateItems = true
useEffect fires:
!loading && !currentBudget && hasTemplateItems && isCurrentMonth && !attempted
generateFromTemplate.mutate({ month: 4, year: 2026, currency: "EUR" })
Supabase:
1. INSERT budgets (start_date=2026-04-01, end_date=2026-04-30)
2. SELECT template_items WHERE template_id = user's template
3. INSERT budget_items × N (actual_amount=0 per item)
onSuccess: invalidate ["budgets"], ["budgets", id], ["budgets", id, "items"]
DashboardPage rerenders: currentBudget = new budget
DashboardContent mounts (keyed by budgetId)
SummaryStrip + CollapsibleSections render with template-populated data
```
### Inline Add-One-Off Flow
```
DashboardPage or BudgetDetailPage
"Add one-off" button → AddOneOffSheet opens (Sheet side panel)
useCategories() provides category list (grouped by type)
User picks category, enters amount, optional notes
[Add] → useBudgets().createItem.mutate({
budgetId,
category_id,
budgeted_amount: amount,
actual_amount: amount, // one-off: budget = actual at time of entry
notes,
item_tier: "one_off"
})
onSuccess: invalidate ["budgets", budgetId, "items"]
Sheet closes → item appears in appropriate CollapsibleSection
```
---
## Scaling Considerations
## New vs Modified File Summary
This is a personal finance app for a single authenticated user at a time. Scale is not a concern for rendering. The relevant concern is **perceived performance** on the dashboard when `items` is large (100+ line items).
### New Files
| Scale | Architecture Adjustment |
|-------|--------------------------|
| <50 items (normal) | No optimization needed — current useMemo pattern is fast |
| 50-200 items | useMemo already handles this — O(n) passes are negligible |
| 200+ items | Consider React.memo on CategorySection to skip unchanged sections; still no virtualization needed |
| Dashboard load time | TanStack Query 5-min staleTime means instant rerender on navigate-back; no change required |
| File | Purpose |
|------|---------|
| `src/hooks/useFirstRunState.ts` | Detect first-run: categories=0 OR template_items=0 |
| `src/data/presets.ts` | Static preset category list with suggested amounts |
| `src/pages/SetupWizardPage.tsx` | Multi-step first-run wizard (local state, 3 steps) |
| `src/components/wizard/WizardStep.tsx` | Step wrapper with step indicator / progress |
| `src/components/wizard/CategoryDefaults.tsx` | Preset category checkbox picker (step 1) |
| `src/components/wizard/TemplateDefaults.tsx` | Amount inputs per selected preset (step 2) |
| `src/components/budget/AddOneOffSheet.tsx` | Sheet-based one-off item adder (replaces QuickAddPicker) |
### Modified Files
| File | What Changes |
|------|-------------|
| `src/App.tsx` | Add `/setup` route; add WizardRoute guard |
| `src/components/AppLayout.tsx` | Remove QuickAdd from `navItems` array |
| `src/pages/DashboardPage.tsx` | Add useTemplate(); add auto-create useEffect; remove chart grid; swap AddOneOffSheet for QuickAddPicker |
| `src/pages/BudgetDetailPage.tsx` | Swap AddOneOffSheet for QuickAddPicker |
| `src/index.css` | Lower `--radius`; tune OKLCH pastel token values |
| `src/i18n/en.json` | Add wizard i18n keys; remove/rename quick-add nav key |
| `src/i18n/de.json` | Same additions as en.json (bilingual requirement) |
### Unchanged Files (confirmed)
`useBudgets.ts`, `useTemplate.ts`, `useCategories.ts`, `useQuickAdd.ts`, `useAuth.ts`, `useMonthParam.ts`, `lib/types.ts`, `lib/palette.ts`, `lib/format.ts`, `lib/supabase.ts` — all hooks and library files are read-only for this milestone.
---
## Anti-Patterns
## Build Order (Dependency-Aware)
### Anti-Pattern 1: Deriving Chart Data Inside Chart Components
Phase dependencies must be respected. Build bottom-up.
**What people do:** Put `items.filter(...).reduce(...)` directly inside `IncomeBarChart` or `ExpenseDonutChart`, passing the raw `items` array from `useBudgetDetail` as a prop.
**Phase 1: Design Tokens (no deps)**
- `src/index.css` — lower `--radius`, refine OKLCH pastel values
- Verify all 9 existing pages render correctly; no logic changes
- Fast and reversible — do this first to establish visual baseline
**Why it's wrong:** Each chart component recalculates from scratch. If `items` reference changes (after a mutation), all three charts recalculate independently. Chart components become impure, harder to test, and cannot be reused with different data shapes without changing their internals.
**Phase 2: Preset Data + First-Run Hook (no deps)**
- `src/data/presets.ts` — static data, no imports needed
- `src/hooks/useFirstRunState.ts` — depends on existing `useCategories` + `useTemplate`; no UI yet
**Do this instead:** Derive all chart data in `DashboardContent` with `useMemo`. Pass prepared `barData`, `pieData`, `horizontalData` arrays to each chart. Charts receive typed data arrays and render only.
**Phase 3: Setup Wizard (depends on Phase 2)**
- `src/components/wizard/WizardStep.tsx` — pure presentational
- `src/components/wizard/CategoryDefaults.tsx` — depends on presets.ts
- `src/components/wizard/TemplateDefaults.tsx` — depends on presets.ts
- `src/pages/SetupWizardPage.tsx` — assembles wizard components + useFirstRunState + mutation hooks
- `src/App.tsx` — wire `/setup` route + WizardRoute guard
**Phase 4: Auto-Budget Creation (depends on Phase 3 — template must be populatable)**
- `src/pages/DashboardPage.tsx` — add `useTemplate()` import + auto-create `useEffect`
- Test: wizard → dashboard → budget auto-creates → SummaryStrip shows template data
**Phase 5: Inline Add-One-Off + Dashboard Simplification (depends on Phase 4)**
- `src/components/budget/AddOneOffSheet.tsx` — depends on `useCategories` + `useBudgets` (both existing)
- `src/pages/DashboardPage.tsx` — remove chart grid; wire AddOneOffSheet
- `src/pages/BudgetDetailPage.tsx` — wire AddOneOffSheet
- `src/components/AppLayout.tsx` — remove QuickAdd nav item
---
### Anti-Pattern 2: Hardcoding Colors Inside Chart Components
## Anti-Patterns to Avoid
**What people do:** Paste hex values like `fill="#4ade80"` into `<Bar>` and `<Cell>` components to match the design.
### Anti-Pattern 1: Global State for Wizard
**Why it's wrong:** The existing `index.css` already defines category colors as OKLCH CSS variables (`--color-income`, `--color-bill`, etc.) and `palette.ts` maps them to `var(--color-income)` etc. Hardcoding breaks dark mode adaptation, creates a second source of truth, and means a palette change requires editing multiple files.
**What people do:** Store wizard state in a React context, Zustand store, or TanStack Query mutation cache.
**Why it's wrong:** Wizard runs once, on first login. Global state persists unnecessarily and creates cleanup complexity.
**Do this instead:** Local `useState` in `SetupWizardPage`. When the page unmounts (after `navigate("/")`), state is automatically cleaned up.
**Do this instead:** Always reference `categoryColors[type]` from `palette.ts` (which returns the CSS variable string) for both chart fills and UI color dots. For shadcn `ChartContainer`, pass `color: categoryColors[type]` in the `ChartConfig` object.
### Anti-Pattern 2: Auto-Create Without Template Guard
**What people do:** Trigger `generateFromTemplate` whenever `!currentBudget`, regardless of template state.
**Why it's wrong:** If a user skips the wizard or has an empty template, an empty budget gets silently created. This is worse than the empty state — it looks like a bug, not a fresh start.
**Do this instead:** Guard with `hasTemplateItems && isCurrentMonth`. Show a helpful CTA to configure the template if template is empty.
### Anti-Pattern 3: Dropping the quick_add_items Table
**What people do:** Add a migration to drop `quick_add_items` when the QuickAdd nav item is removed.
**Why it's wrong:** Existing users have data there. The DB migration is irreversible. The table costs nothing to keep.
**Do this instead:** Remove the nav item and surface only. Leave the table, `useQuickAdd` hook, and `/quick-add` route in place. Schedule a cleanup migration in a future milestone after confirming no users rely on it.
### Anti-Pattern 4: Renaming Design Token CSS Variables
**What people do:** Rename tokens during the design rework (e.g., `--color-income``--category-color-income`) to make the naming more semantic.
**Why it's wrong:** `palette.ts` references token names as strings: `var(--color-income)`. All chart components use `var(--color-income-fill)`. Renaming causes silent CSS failures — no TypeScript error, no build error, just missing colors.
**Do this instead:** Change only the VALUES of existing tokens. Add new token names only for net-new concepts.
### Anti-Pattern 5: Wizard as Modal Overlay
**What people do:** Show the wizard as a Dialog or Sheet over the main app layout on first load.
**Why it's wrong:** No URL, so refresh drops the user back to the start or the main app with incomplete setup. Focus management in a full-screen modal is complex. Back button behavior is broken.
**Do this instead:** Dedicated `/setup` route. `WizardRoute` handles redirect logic. The browser URL reflects wizard state, refresh works, and no special cleanup is needed.
### Anti-Pattern 6: Adding useEffect Dependencies by Feel
**What people do:** Add `generateFromTemplate` itself to the `useEffect` deps array.
**Why it's wrong:** Mutation objects from TanStack Query are re-created on every render, causing the effect to re-run in a loop.
**Do this instead:** Use a `useRef` guard (`attempted.current`) and gate on stable primitive values (`!loading`, `!currentBudget`, `hasTemplateItems`). Do not include the mutation object in the dependency array.
---
### Anti-Pattern 3: One Monolithic DashboardContent Component
## Supabase / DB Notes (v2.0)
**What people do:** Add all new dashboard sections — summary cards, three charts, six collapsible sections, QuickAdd button — directly into one large `DashboardContent.tsx` that becomes 400+ lines.
**No new migrations required.** All v2.0 features write to existing tables:
**Why it's wrong:** The existing `DashboardContent` is already 200 lines with just two charts and progress bars. A full hybrid dashboard with three chart types and six collapsible sections will exceed 600 lines inline, making it impossible to review, test, or modify individual sections without reading the whole file.
| Feature | Writes To | Via |
|---------|-----------|-----|
| Wizard | `categories`, `template_items` | existing `useCategories().create`, `useTemplate().createItem` |
| Auto-budget | `budgets`, `budget_items` | existing `useBudgets().generateFromTemplate` |
| Inline one-off | `budget_items` | existing `useBudgets().createItem` |
| Design tokens | — | CSS only |
**Do this instead:** Extract into the component tree defined above. `DashboardContent` orchestrates layout and owns derived data. Each distinct visual section (`SummaryStrip`, `ChartPanel`, `CategorySection`) is its own file. The rule: if a block of JSX has a distinct visual purpose, it gets its own component.
The `quick_add_items` table becomes read-only from the primary UI flow. No rows deleted, no schema change.
---
### Anti-Pattern 4: Using shadcn Accordion Instead of Collapsible for Category Sections
## Integration Points: New vs Existing
**What people do:** Reach for the `Accordion` component (which is already in some shadcn setups) to build collapsible category sections because it looks similar.
**Why it's wrong:** Accordion by default enforces "only one open at a time" (type="single") or requires explicit `type="multiple"` with `collapsible` prop to allow free open/close. For budget sections, users may want to compare two categories side-by-side with both open simultaneously. Using individual `Collapsible` per section gives full independent control without fighting Accordion's root-state coordination.
**Do this instead:** Use Radix `Collapsible` (shadcn wrapper) on each `CategorySection` with independent `useState`. Six independent booleans are trivially managed.
---
### Anti-Pattern 5: Modifying Hooks or Supabase Queries
**What people do:** Add derived fields or aggregations to the `useBudgetDetail` return value, or add new Supabase query fields, because it seems convenient during the UI overhaul.
**Why it's wrong:** Explicitly out of scope (PROJECT.md: "No Supabase schema changes — UI-only modifications"). Any hook changes risk breaking `BudgetDetailPage` and other consumers. The data model is sufficient — all needed aggregations can be computed with `useMemo` from the existing `items` array.
**Do this instead:** Keep hooks read-only. All computation lives in the presentation layer via `useMemo`.
---
## Integration Points
### External Services
| Service | Integration | Notes |
|---------|-------------|-------|
| Supabase | Unchanged — hooks layer handles all DB calls | No new RPC calls, no schema changes |
| Recharts | Chart primitives — wrap with `ChartContainer` | Requires adding shadcn `chart` component |
| Radix UI | `Collapsible` primitive — add via shadcn CLI | Not yet in project; must be added before CategorySection work |
| i18next | All new UI text needs keys in `en.json` and `de.json` | Add keys before rendering any new text; no runtime fallback acceptable |
### Internal Boundaries
| Boundary | Communication | Notes |
|----------|---------------|-------|
| `DashboardContent` ↔ chart components | Props only — typed data arrays + currency string | Charts are pure; they do not call hooks |
| `DashboardContent``CategorySection` | Props only — grouped items, budgeted/actual totals, currency, mutation handlers | Mutation handlers passed down from `DashboardContent` which owns `useBudgets()` mutations |
| `CategorySection``BudgetLineItems` | Props only — items array, currency, type | `BudgetLineItems` is a thin table wrapper; all mutations are callbacks from parent |
| `PageShell` ↔ all pages | Props (title, action slot, children) | No state shared; purely compositional |
| `index.css` @theme tokens ↔ components | CSS variables via `var(--color-X)` and `palette.ts` | Single source of truth for all color; never duplicate in component style props |
---
## Build Order Implications
Components have dependencies that dictate implementation order:
1. **`components/ui/collapsible.tsx`** — Add via `npx shadcn@latest add collapsible`. Required by `CategorySection`. Do first.
2. **`components/ui/chart.tsx`** — Add via `npx shadcn@latest add chart`. Required by all chart components. Do first.
3. **`shared/PageShell.tsx`** — No dependencies. Build early; apply to all pages as each is refreshed.
4. **`StatCard` + `SummaryStrip`** — Only depends on `formatCurrency` and Tailwind. Build second after primitives.
5. **Chart components** (`IncomeBarChart`, `ExpenseDonutChart`, `SpendBarChart`) — Depend on `ChartContainer`. Build after step 2.
6. **`ChartPanel`** — Composes the three chart components. Build after step 5.
7. **`BudgetLineItems`** — Refactored from existing `BudgetDetailPage` table code; existing `InlineEditCell` and `DifferenceCell` are reusable as-is.
8. **`CategorySection`** — Depends on `Collapsible` primitive and `BudgetLineItems`. Build after steps 1 and 7.
9. **`DashboardContent`** — Orchestrates everything. Build last, wiring together all children. Replace the existing `DashboardContent` function in `DashboardPage.tsx`.
10. **Non-dashboard page refreshes** — Apply `PageShell` + visual refresh to remaining 7 pages. Independent of dashboard work; can be done in any order.
| New Feature | Existing Hooks/Mutations Used | New Additions |
|-------------|------------------------------|---------------|
| First-run wizard | `useCategories().create`, `useTemplate().createItem` | `useFirstRunState`, `presets.ts`, wizard components |
| Auto-budget creation | `useBudgets().generateFromTemplate` (already exists) | `useEffect` trigger in DashboardPage, `hasTemplateItems` guard |
| Inline one-off add | `useBudgets().createItem` (already exists), `useCategories()` | `AddOneOffSheet` component |
| Dashboard simplification | `useBudgetDetail`, `useMonthParam`, `SummaryStrip`, `CollapsibleSections` | Remove 3-column chart grid from DashboardContent |
| Design tokens | All existing components consume tokens automatically | Token value adjustments in `index.css` only |
---
## Sources
- Radix UI Collapsible: https://www.radix-ui.com/primitives/docs/components/collapsible (HIGH confidence — official docs)
- shadcn/ui Chart component: https://ui.shadcn.com/docs/components/radix/chart (HIGH confidence — official docs)
- shadcn/ui Accordion: https://ui.shadcn.com/docs/components/radix/accordion (HIGH confidence — official docs)
- Tailwind CSS v4 @theme tokens: https://tailwindcss.com/docs/theme (HIGH confidence — official docs)
- React useMemo: https://react.dev/reference/react/useMemo (HIGH confidence — official docs)
- Existing codebase: inspected `src/` fully — `DashboardPage.tsx`, `BudgetDetailPage.tsx`, `CategoriesPage.tsx`, `AppLayout.tsx`, `palette.ts`, `types.ts`, `index.css`, `useBudgets.ts` (HIGH confidence — primary source)
- Full codebase inspection (April 2026):
- `src/App.tsx`, `src/components/AppLayout.tsx`
- `src/pages/DashboardPage.tsx`, `src/pages/TemplatePage.tsx`, `src/pages/BudgetDetailPage.tsx`
- `src/hooks/useTemplate.ts`, `src/hooks/useBudgets.ts`, `src/hooks/useQuickAdd.ts`, `src/hooks/useMonthParam.ts`
- `src/components/QuickAddPicker.tsx`, `src/components/shared/PageShell.tsx`
- `src/lib/types.ts`, `src/lib/palette.ts`
- `src/index.css`, `src/i18n/en.json`
- `supabase/migrations/002_categories.sql` through `005_quick_add.sql`
- Confidence: HIGH — all claims are grounded in verified source code, not assumptions
---
*Architecture research for: SimpleFinanceDash UI overhaul — React + Tailwind + shadcn/ui + Recharts*
*Researched: 2026-03-16*
*Architecture research for: SimpleFinanceDash v2.0 — wizard setup, auto-budget, inline add, design rework*
*Researched: 2026-04-02*

View File

@@ -1,16 +1,24 @@
# Feature Research
**Domain:** Personal finance budget dashboard (UI presentation layer overhaul)
**Researched:** 2026-03-16
**Confidence:** HIGH — grounded in competitor analysis (YNAB, Empower), industry design guides, and direct codebase inspection
**Domain:** Personal budget app — wizard-driven setup, auto-budget creation, simplified monthly tracking UX
**Researched:** 2026-04-02
**Confidence:** MEDIUM — grounded in competitor analysis (YNAB, Monarch, EveryDollar, Actual Budget, Quicken Simplifi, Copilot) and UX/fintech design literature. Some specifics are inferred from behavioral patterns; no first-party user testing data.
---
## Context
This research covers the **presentation layer** only. Backend schema and data model are frozen. The question is: what UI/UX features make a personal finance dashboard feel polished rather than basic, and which of those apply to this project's existing data model (income, bills, variable expenses, debt, savings, investments — budgeted vs actual)?
This research covers v2.0 UX Simplification. The existing app already has all the data infrastructure — categories (6 types), template system, monthly budget generation, quick-add library, dashboard with charts. The problem is cognitive: too many disconnected concepts, friction in getting a budget running, and no guided experience for new users.
The existing stack is React 19 + Tailwind CSS 4 + Recharts + shadcn/ui. All chart capabilities already exist in Recharts; this research identifies how to use them well.
The research question: **How do personal budget apps handle first-run wizard setup, auto-creation from template, and simplified monthly views?** What is table stakes, what differentiates, and what should be avoided?
Existing features that remain and are not re-researched here:
- Category CRUD
- Template item management
- Budget detail with inline editing
- Charts (donut, bar, horizontal bar)
- Collapsible dashboard sections
- Settings (locale, currency)
---
@@ -18,23 +26,18 @@ The existing stack is React 19 + Tailwind CSS 4 + Recharts + shadcn/ui. All char
### Table Stakes (Users Expect These)
Features users assume exist. Missing these = product feels incomplete.
Features users assume exist. Missing these = product feels incomplete or broken.
| Feature | Why Expected | Complexity | Notes |
|---------|--------------|------------|-------|
| Summary KPI cards at the top | Every finance dashboard leads with top-line numbers (income, total spend, balance). Users scan these first — it's the entry point to understanding the month. | LOW | Already exists but needs richer visual treatment: larger numbers, colored icons, clearer hierarchy |
| Green/red semantic color coding for over/under budget | Finance convention: green = on track, red = over budget. Violating this creates cognitive friction. | LOW | Already exists on progress bars and difference cells; must be consistent across all new chart types |
| Donut/pie chart for expense category breakdown | Standard visualization for "how is spending distributed." Users expect to see the breakdown at a glance. | LOW | Existing pie is plain; needs inner radius (donut), center total label, and richer color fills |
| Budget vs actual per category | The core comparison every budget tool offers. Users come here specifically to compare what they planned to what they actually spent. | MEDIUM | Existing progress bars satisfy this minimally; new grouped/horizontal bar charts will fulfill it properly |
| Inline value editing on budget detail | Users need to log actuals inline — no one wants a separate form for every line item. | LOW | Already implemented in BudgetDetailPage as InlineEditCell; keep and refine |
| Loading state that reflects page structure | If the page renders blank or flashes, users distrust the data or think it's broken. | LOW | Currently returns `null` during load — skeleton cards matching the final layout are expected |
| Empty state with actionable guidance | A blank dashboard for a new month should tell the user what to do next, not just show nothing. | LOW | Currently shows plain muted text; needs a CTA card pattern |
| Tabular-numeral formatting throughout | Financial amounts must use tabular (monospaced number) alignment so columns read correctly. | LOW | Already applied via `tabular-nums`; extend to all new components |
| Color-coded category identity | Users build a mental map: bills are orange, savings are blue. Consistent color per category type is required everywhere — charts, tables, badges. | LOW | Palette already defined in `index.css` and `palette.ts`; extend consistently to new components |
| Collapsible / grouped sections per category type | Budget detail and dashboard both group items by type. Users expect to expand/collapse groups, especially with many line items. | MEDIUM | BudgetDetailPage already groups by type; dashboard needs collapsible inline sections as new feature |
| Month navigation on the dashboard | Users want to check a prior month without navigating away. "Looking at last month" is a top-3 use case for any budget tool. | MEDIUM | Not in current dashboard (auto-resolves current month only); needs month selector |
| Totals row / footer per section | Standard pattern from spreadsheets. Each category group needs a sub-total visible without counting rows. | LOW | Already in BudgetDetailPage table footer; needs equivalent on dashboard sections |
| Consistent design language across all pages | Auth pages, settings, categories, and budget list must feel like the same product as the dashboard. Inconsistency signals amateur work. | HIGH | Currently only dashboard is styled; all other pages need the same card/color/typography treatment |
| Wizard-style first-run setup | Every modern app (YNAB, EveryDollar, Monarch) guides new users through initial setup — no blank-slate drop. Blank-state is a known retention killer for budget apps. | MEDIUM | Multi-step flow: income → recurring items → review. Must be skippable per step. |
| Pre-filled category items with common defaults | Users expect "rent," "groceries," "car insurance" to already be there — not to type everything from scratch. YNAB's Beginner Template and Quicken Simplifi both provide starter category lists. | LOW | Pre-seed the wizard with a curated list of ~15-20 common items grouped by type. User selects/deselects, edits amounts. |
| Auto-created budget on first month visit | After setup, users expect a budget to exist for the current month without a separate "generate budget" step. The manual trigger pattern is a v1-era pattern that creates friction. Quicken Simplifi does this with its Spending Plan. | MEDIUM | Trigger auto-generation server-side when a user visits the current month and no budget exists. |
| Ability to skip setup and start minimal | Power users and returning users want to start blank or skip ahead. Forcing everyone through a wizard is patronizing. | LOW | Each wizard step needs a "Skip" option. Entire wizard skippable via "I'll set this up later." |
| Inline add-from-library on the budget view | Users expect to add a one-off expense from their familiar item list without navigating away. The current separate Quick-Add page is a disconnect. Spendee and Actual Budget surface this inline. | MEDIUM | Replace Quick-Add page with an inline panel/sheet triggered from the budget view. Category + item picker, amount field, confirm. |
| Monthly budget shows budgeted vs actual, grouped | The core interaction loop: open budget, see what's in each category, enter actuals. Every app (YNAB, EveryDollar, Actual Budget) organizes this as grouped rows with a budgeted amount and an actuals field. | LOW | Already exists in the current BudgetDetailPage. Table stakes means this must work correctly and clearly — not changed, just verified. |
| Dashboard = this month's budget at a glance | Users want to open the app and immediately know their status: income, spending, balance. Not a chart gallery. Monarch and Copilot both lead with a "current month" summary card. | LOW | Dashboard must surface current month's data prominently — summary cards first, then detail. Already partially true; needs data correctness fix. |
| Empty state with clear call to action | If no template is set up, the app must explain what to do — not just show a blank page. "Set up your budget template" with a single action button. | LOW | Applies to: empty template page, empty budget view, empty dashboard. |
### Differentiators (Competitive Advantage)
@@ -42,16 +45,12 @@ Features that set the product apart. Not required, but valued.
| Feature | Value Proposition | Complexity | Notes |
|---------|-------------------|------------|-------|
| Grouped bar chart: income budgeted vs actual | Directly answers "Did I earn what I expected this month?" in a single visual. Most basic dashboards skip this, showing only expense charts. | MEDIUM | Recharts `BarChart` with two `Bar` components (budgeted / actual); use category colors |
| Horizontal bar chart: spend by category type (budget vs actual) | Lets users scan over-budget categories at a glance. Horizontal orientation makes labels readable without rotation. | MEDIUM | Recharts `BarChart layout="vertical"` with `XAxis type="number"` and `YAxis type="category"` |
| Donut chart with center total label | Center label turns the chart from decorative into informational — shows total spend while the ring shows distribution. YNAB and Empower both do this. | LOW | Recharts `Label` component inside `Pie` using `viewBox` coordinates for positioned text |
| Active sector hover highlight on donut | Hovering a slice expands it slightly and shows the category name + amount in a tooltip. Feels interactive and polished vs a static chart. | LOW | Recharts `activeShape` with expanded `outerRadius` — supported natively |
| Variance indicator (delta arrows) | Show "▲ 12% over" or "▼ 5% under" beside actual amounts on summary cards and section headers. Transforms raw numbers into directional insight. | LOW | Computed from budgeted/actual; render as small colored badge or arrow icon |
| Accent-colored card borders / icon containers | Rich visual style: each category section gets its palette color as a left border accent or icon container fill. Breaks the sea-of-grey-cards look. | LOW | Tailwind `border-l-4` or `bg-[color]/10` container with category CSS variable |
| Section collapse persisted in localStorage | Remembering which sections are open avoids users re-expanding the same sections every visit. Small touch that signals quality. | LOW | Simple `useState` + `localStorage` read/write; wrap in a `useCollapse` hook |
| Carryover amount visible on dashboard | The budget model already tracks `carryover_amount`. Showing it alongside the available balance makes the "running total" story clear. | LOW | Surface as a fourth summary card or sub-label on the balance card |
| Skeleton loading that mirrors the real layout | Animated skeleton cards/charts during load feel like the app is fast and predictable. Blank screens feel broken. | LOW | shadcn/ui `Skeleton` component already available; wrap summary cards and chart containers |
| Page header with budget month name | Every page in the app should show context: "March 2026 Budget." Users confirm they're looking at the right period immediately. | LOW | Format `budget.start_date` as "Month YYYY" in the page heading |
| Smart amount suggestions during wizard setup | Rather than blank amount fields, prefill with sensible defaults (e.g., $1,500 for rent, $400 for groceries) that users can override. Reduces the "I don't know what to put here" paralysis. Most apps leave this blank. | LOW | Can be static defaults (not AI). Store suggested amounts per item type in a constant/config. User edits freely. |
| "Start from your income" wizard framing | Frame setup as: "First, how much do you earn each month?" then "Here are common expenses people like you track." Income-first anchoring mirrors zero-based budgeting mental model (YNAB's core concept) and makes subsequent amounts feel grounded. | LOW | First wizard step = income amount. Subsequent steps show remaining balance updating as items are added — "you have $X left to allocate." |
| Running balance display during wizard | As the user adds items in the wizard, show "Remaining to allocate: $X" updating live. Makes it immediately obvious if they're over-allocating. This is YNAB's core interaction loop, applied to setup. | LOW | Derived from: income total minus sum of bill/expense/debt/saving/investment items. Frontend computation only. |
| Persistent sidebar "this month" widget on dashboard | A small always-visible card showing remaining balance for the month, top 2-3 categories near limit, and a "View full budget" link. Eliminates the need to navigate away to check status. Copilot uses this pattern. | MEDIUM | Requires current month budget query always running. Can be a sticky sidebar panel on the dashboard page rather than a global element. |
| Auto-create silently, notify only on first creation | First-time users see a brief notification "Your March budget was created from your template." Subsequent months: silently created, no notification. This is the right default — zero friction for users who've set up their template. | LOW | Backend: check if budget for current month exists on page load; create if not. Frontend: show a toast only if a new budget was just created. |
| Template edit directly accessible from monthly view | If a user wants to permanently change a recurring item (e.g., rent went up), they should be able to jump to the template from the budget view without hunting through the nav. | LOW | An "Edit template" link on the budget page or a per-item "Save to template" action. Single nav jump, no modal complexity. |
### Anti-Features (Commonly Requested, Often Problematic)
@@ -59,91 +58,87 @@ Features that seem good but create problems in this context.
| Feature | Why Requested | Why Problematic | Alternative |
|---------|---------------|-----------------|-------------|
| Trend / multi-month charts | Users always ask "can I see my spending over 6 months?" | Requires multi-budget data aggregation, a new query shape, and a new chart layout — out of scope for a UI-only overhaul. Adding it half-baked is worse than not adding it. | Explicitly defer to a future milestone. Put a placeholder card with "Coming soon" if needed. |
| Dark mode toggle | Professional apps always have a dark mode. | Tailwind CSS 4 dark mode via class strategy is possible, but requires auditing every component's contrast, chart colors, and skeleton states. Doing it properly doubles testing surface. The OKLCH color system is set up with dark mode in mind, but no dark palette is currently defined. | Define as a future phase deliverable. Keep the existing light-only approach consistent and polished first. |
| Real-time sync / live updates | "What if two tabs are open?" | No backend changes allowed this milestone. Supabase realtime would require schema changes and subscription setup. The current TanStack Query polling pattern is sufficient. | Rely on query invalidation on mutation — already in place. |
| Drag-to-reorder line items | Power users want custom sort order | Category `sort_order` field exists, but updating it requires PATCH calls and animation logic. No backend changes in scope. | Keep current `sort_order` from DB; do not expose drag handles this milestone. |
| Glassmorphism / heavy blur effects | Trendy, visually striking | `backdrop-blur` on many elements is GPU-heavy and can degrade performance on lower-end machines. Also risks reducing text readability on charts. Misapplied, it obscures data rather than enhancing it. | Use solid cards with subtle colored-border accents instead. Reserve `backdrop-blur` for a single hero element if at all. |
| AI / natural language budget insights | Feels modern, seen in apps like Copilot | Requires an AI backend, a new API integration, and user data being sent to a third-party service — none of which are part of a UI-only overhaul. | Surface static insights from computed data instead: "You spent 15% more on bills than budgeted this month." Computed in the frontend, no AI needed. |
| Infinite scroll on budget list | "I have many months of budgets" | Adds complexity to the budget list query and requires scroll position management. The budget list is unlikely to have more than 24 entries in a year of use. | Standard paginated or full list with a search/filter input is sufficient. |
| AI-suggested amounts based on spending history | "Smart defaults should learn from me over time" | Requires enough historical data (users don't have it at setup), an ML model or LLM call, and privacy tradeoffs. The payoff is low when static defaults work fine for first-run. | Static curated defaults per item type. After 3+ months of use, a "Review your template" prompt is sufficient. |
| Mandatory wizard (no escape) | "Force users to complete setup so they have a working budget" | Patronizing for returning users; creates frustration for users who want to explore before committing. YNAB's old onboarding got negative feedback for being too locked-in; they added a flexible checklist in Oct 2025 for this reason. | Skippable wizard with a prominent resume-later CTA. Show a "Complete setup" banner if template is empty. |
| Auto-sync with bank accounts | "Automatically populate actuals from transactions" | Plaid/bank integrations add significant infrastructure cost, security scope, and maintenance burden. Out of scope for a self-hosted personal tool. | Manual actual entry (inline editing, already implemented) with optional import as a future feature. |
| Complex wizard with 6+ steps | "Guide the user through every aspect of budgeting" | Drop-off increases sharply with each step beyond 3. Users who see step 4 of 7 abandon setup entirely. | Max 3 steps: (1) Income, (2) Recurring items, (3) Review + confirm. Everything else is editable post-setup. |
| Per-item recurrence configuration in wizard | "Let users set whether each item is weekly, monthly, etc." | Adds decision burden during setup. The app model is monthly budgeting — every item is implicitly monthly. Edge cases (weekly, biweekly) should be post-setup configuration. | Monthly-only assumption during wizard. Users can edit frequency on the template page after setup. |
| Gamification / streaks for budget tracking | "Engage users to check in daily" | Budget apps that add gamification often feel gimmicky for a personal finance tool. The target user is tracking a spreadsheet replacement — they want data, not achievements. | Progress indicators (spent X% of budget) provide motivation without game mechanics. |
| Duplicate "Quick Add" page alongside inline add | "Keep the existing page and add inline too" | Two ways to do the same thing creates confusion about which to use. The standalone Quick Add page has no added value over an inline approach. | Replace entirely with inline add-from-library on the budget view. Remove the nav link for the old Quick Add page. |
---
## Feature Dependencies
```
Donut Chart with Center Label
└──requires──> Category color system (already exists)
└──requires──> Recharts Label component in Pie (Recharts native)
Wizard Setup
└──requires──> Pre-seeded library items (common defaults in DB or seed data)
└──requires──> Template CRUD (already exists)
└──produces──> Populated template (unlocks auto-creation)
└──enhances──> Smart amount suggestions (display layer only)
└──enhances──> Running balance during wizard (computed from income + items)
Horizontal Bar Chart (budget vs actual by type)
└──requires──> Category color system (already exists)
└──requires──> Grouped data by category type (already in DashboardContent)
Auto-Budget Creation
└──requires──> Populated template (wizard must complete, or manual template setup)
└──requires──> Backend trigger logic (check if budget for month exists; create if not)
└──produces──> Current month budget (unlocks simplified budget view)
└──enhances──> Silent creation toast (frontend notification, optional)
Grouped Bar Chart (income budget vs actual)
└──requires──> Income items filtered from BudgetItems (already in DashboardContent)
Simplified Budget View (inline add from library)
└──requires──> Current month budget exists (auto-creation must fire first)
└──requires──> Category library with quick-add items (already exists as quick_add_items table)
└──replaces──> Standalone Quick Add page (remove from nav)
└──enhances──> Budget detail (adds inline picker panel alongside existing inline editing)
Collapsible Dashboard Sections
└──requires──> Category group data (already derived)
└──enhances──> Section collapse persistence (localStorage)
└──enhances──> Totals row per section (already exists in BudgetDetailPage)
Dashboard = This Month at a Glance
└──requires──> Current month budget exists (auto-creation must fire first)
└──requires──> Budget data correctness fix (tracked separately)
└──depends-on──> Simplified budget view (users need to be able to add actuals quickly)
Skeleton Loading
└──requires──> Final layout structure (must design layout first)
└──depends-on──> Summary cards layout (build cards first, then wrap in Skeleton)
Month Navigation on Dashboard
└──requires──> Budgets list query (already in useBudgets)
└──conflicts──> Auto-resolve current month (replace with explicit selection)
Consistent Design Language (all pages)
└──depends-on──> Dashboard redesign being finished first (establishes the design token/component pattern)
└──applies-to──> LoginPage, RegisterPage, CategoriesPage, TemplatePage, BudgetListPage, BudgetDetailPage, QuickAddPage, SettingsPage
Variance Indicators (delta arrows)
└──requires──> budgeted_amount and actual_amount both available (already on BudgetItem)
└──enhances──> Summary cards (add % change sub-label)
└──enhances──> Collapsible section headers (show group variance at a glance)
Template Edit from Budget View
└──requires──> Template page (already exists)
└──enhances──> Simplified budget view (provides escape hatch to change recurring items)
```
### Dependency Notes
- **Skeleton loading requires final layout:** Don't implement skeleton states until the target card/chart layout is finalized — skeleton shape must mirror real content shape.
- **All-pages redesign depends on dashboard:** The dashboard establishes the color system application patterns (accent borders, card styles, typography scale) that all other pages will inherit.
- **Month navigation conflicts with auto-resolve:** The current pattern auto-finds the budget for the current calendar month. Adding a selector means the dashboard must hold local `selectedBudgetId` state rather than computing it.
- **Donut center label requires Recharts Label:** shadcn/ui's chart system supports this natively via the `Label` component inside `Pie` using `viewBox` coordinates. No new library needed.
- **Wizard depends on pre-seeded library:** The wizard presents pre-filled common items. These must exist in the database (or a constants file) before the wizard can show them. This is the foundational data concern for v2.0.
- **Auto-creation depends on template having content:** If the user skips the wizard entirely, auto-creation generates an empty budget (no items). The UI must handle this gracefully — show empty-state with "Set up your template" CTA.
- **Inline add replaces Quick Add page:** This is a replacement, not an addition. The Quick Add page should be removed from the nav. The backend endpoint it uses can be repurposed or kept as the inline add trigger.
- **Dashboard correctness is a prerequisite:** The "dashboard = this month at a glance" feature is only meaningful if the data it displays is accurate. Data correctness fix must happen before or alongside the dashboard simplification.
---
## MVP Definition
This is a UI overhaul milestone, not a greenfield product. "MVP" here means: what must ship for the redesign to feel complete and polished?
This is v2.0 of an existing working app. "MVP" here means: what is the minimum set of changes that delivers the simplified UX without regressions?
### Launch With (v1 — Dashboard Overhaul)
### Launch With (v2.0 — Core UX Simplification)
- [ ] Summary cards with richer visual treatment (larger numbers, semantic color on balance, variance badge) — foundation of the dashboard
- [ ] Donut chart with center total label and active sector hover — replaces existing flat pie
- [ ] Horizontal bar chart (budget vs actual by category type) — new chart, satisfies the key "am I on track" question
- [ ] Grouped bar chart (income budget vs actual) — completes the three-chart suite from the reference
- [ ] Collapsible inline sections per category group on dashboard (with line items + group totals) — replaces current progress bars
- [ ] Skeleton loading states for cards and charts — removes the jarring blank-then-rendered experience
- [ ] Month navigation control (budget period selector) on dashboard — without this the dashboard is locked to current month only
- [ ] Wizard-style template setup — 3-step flow: income → common items (pre-filled, editable) → review — skippable
- [ ] Pre-seeded library with ~15-20 common items grouped by category type (rent, car insurance, groceries, utilities, car payment, etc.)
- [ ] Smart amount defaults in wizard (static sensible values per item — not AI)
- [ ] Running balance during wizard (income minus sum of selected items)
- [ ] Auto-create current month budget from template on first visit (backend trigger, silent)
- [ ] Toast notification on first auto-creation only ("Your April budget was created from your template")
- [ ] Inline add-from-library on the budget view (replaces Quick Add page)
- [ ] Remove Quick Add from navigation
- [ ] Dashboard summary cards correctly reflect current month budget data
- [ ] Empty state CTAs for: empty template, empty dashboard, empty budget
### Add After Dashboard Phase (v1.x — Full App Polish)
### Add After Core Ships (v2.x)
- [ ] Consistent card/color design applied to BudgetDetailPage — users navigate here from the dashboard; it must match
- [ ] Consistent design applied to BudgetListPage — entry point from nav, feels disconnected from dashboard without polish
- [ ] Consistent design applied to CategoriesPage and TemplatePage — setup pages; lower urgency but visible gap
- [ ] Consistent design applied to LoginPage and RegisterPage — first impression; polish matters
- [ ] Consistent design applied to QuickAddPage and SettingsPage — utility pages; can ship slightly after core flows
- [ ] Section collapse state persisted to localStorage — nice-to-have UX polish
- [ ] "Edit template" shortcut from budget view — once core flow is working, add the escape hatch
- [ ] Persistent "this month" summary widget on dashboard — adds value once data is correct
- [ ] "Complete setup" banner for users who skipped wizard but have empty template
- [ ] Wizard resume-later state (save partial wizard progress) — only needed if drop-off is observed
### Future Consideration (v2+)
### Future Consideration (v3+)
- [ ] Trend charts over multiple months — deferred explicitly in PROJECT.md out-of-scope
- [ ] Dark mode — foundational work (OKLCH variables) exists but needs full audit and dark palette definition
- [ ] AI-derived spending insights — requires backend changes; no scope here
- [ ] Drag-to-reorder categories — requires sort_order mutation support
- [ ] Income-based spending recommendations (percentages by category type)
- [ ] "Review your template" prompt after 3 months of use
- [ ] CSV/bank import for actuals — mentioned as future feature in PROJECT.md
- [ ] Recurring transaction automation — mentioned as future in PROJECT.md
---
@@ -151,94 +146,116 @@ This is a UI overhaul milestone, not a greenfield product. "MVP" here means: wha
| Feature | User Value | Implementation Cost | Priority |
|---------|------------|---------------------|----------|
| Summary cards — richer visual treatment | HIGH | LOW | P1 |
| Donut chart with center label + active hover | HIGH | LOW | P1 |
| Horizontal bar chart (spend vs budget by type) | HIGH | MEDIUM | P1 |
| Grouped bar chart (income budget vs actual) | HIGH | MEDIUM | P1 |
| Collapsible dashboard sections with line items | HIGH | MEDIUM | P1 |
| Skeleton loading states | MEDIUM | LOW | P1 |
| Month navigation on dashboard | HIGH | MEDIUM | P1 |
| Consistent design on BudgetDetailPage | HIGH | MEDIUM | P1 |
| Consistent design on BudgetListPage | MEDIUM | LOW | P2 |
| Variance indicators (delta arrows/badges) | MEDIUM | LOW | P2 |
| Accent-colored category section borders | MEDIUM | LOW | P2 |
| Carryover amount visible on dashboard | MEDIUM | LOW | P2 |
| Consistent design on auth/settings/utility pages | LOW | MEDIUM | P2 |
| Section collapse persisted in localStorage | LOW | LOW | P3 |
| Empty state with action guidance | MEDIUM | LOW | P2 |
| Wizard setup (3-step, skippable) | HIGH | MEDIUM | P1 |
| Pre-seeded library items (15-20 defaults) | HIGH | LOW | P1 |
| Smart amount defaults in wizard | MEDIUM | LOW | P1 |
| Running balance during wizard | HIGH | LOW | P1 |
| Auto-create budget on month visit | HIGH | MEDIUM | P1 |
| Dashboard data correctness fix | HIGH | MEDIUM | P1 |
| Inline add-from-library on budget view | HIGH | MEDIUM | P1 |
| Remove Quick Add page from nav | MEDIUM | LOW | P1 |
| Empty state CTAs (template, dashboard, budget) | MEDIUM | LOW | P1 |
| Silent creation with first-time toast | MEDIUM | LOW | P2 |
| "Edit template" link from budget view | MEDIUM | LOW | P2 |
| Persistent "this month" dashboard widget | MEDIUM | MEDIUM | P2 |
| "Complete setup" banner for empty template | LOW | LOW | P2 |
| Wizard resume-later persistence | LOW | MEDIUM | P3 |
**Priority key:**
- P1: Must have for the overhaul to feel complete
- P2: Should have; include in same milestone if effort allows
- P3: Nice to have; add as polish after core delivery
- P1: Must ship for v2.0 to feel complete
- P2: Should have; include if effort allows
- P3: Nice to have; future consideration
---
## Competitor Feature Analysis
| Feature | YNAB | Empower (formerly Personal Capital) | Our Approach |
|---------|------|--------------------------------------|--------------|
| Summary KPI cards | Yes — "Available" balance prominent | Yes — net worth headline | 3 cards: Income / Expenses / Balance |
| Budget vs actual bars | Yes — horizontal category bars with color (green/yellow/red) | Cash flow bars | Horizontal bar chart per category type |
| Donut / pie chart | No (YNAB uses different visualization) | Yes — allocation donut for investments | Donut with center total, colored by category type |
| Collapsible grouped sections | Yes — master categories expand to show sub-categories | No — flat list | Collapsible per category type (income, bills, etc.) |
| Inline editing | Yes — click amount to edit | No | Keep existing InlineEditCell pattern, refine styling |
| Color-coded categories | Yes — status colors (green/yellow/red) | Category colors for accounts | Per-type semantic color (income=green, debt=red/pink, etc.) |
| Month/period navigation | Yes — budget period selector in sidebar | Yes — date range selector | Month selector on dashboard |
| Skeleton loading | Yes — YNAB shows skeleton on load | Yes | Skeleton cards + chart placeholders |
| Variance / delta indicators | Yes — shows "over by $X" inline | Yes — shows gain/loss % | Variance badge on summary cards and section headers |
| Feature | YNAB | Monarch Money | EveryDollar | Quicken Simplifi | Our Approach |
|---------|------|---------------|-------------|------------------|--------------|
| First-run wizard | Flexible checklist (Oct 2025 update); Beginner Template to import categories | Guided category setup on signup; AI auto-categorizes after account link | Wizard-style setup; named "best for newbies" | Template import + Spending Plan auto-setup | 3-step wizard: income → items → review |
| Pre-filled defaults | Beginner Template with common categories (mortgage, groceries, vacation) | Default category list; user trims | Pre-loaded category list | Category templates to import | ~15-20 curated items, editable in wizard |
| Auto-budget creation | Manual monthly allocation required ("assign every dollar") | Spending Plan auto-projects from past data + recurring detected | Manual each month; no auto-create | Spending Plan auto-calculates and updates | Auto-create from template on month visit; silent |
| Add expense inline vs separate | Inline per category row; no separate page | Inline transaction entry | Separate transaction entry form | Inline via Spending Plan category rows | Inline panel on budget view; Quick Add page removed |
| Dashboard focus | "To be budgeted" balance + category status | Monthly spending summary + goals | Zero-based plan + remaining | Spending Plan summary + bills calendar | Summary cards (income/expense/balance) + current month budget |
| Skippable setup | Yes (since Oct 2025 checklist) | Yes | Limited | Yes | Yes — every step skippable |
---
## Chart Design Notes (Recharts-Specific)
## Wizard Flow Design Notes
These translate research findings into concrete implementation guidance for the Recharts stack.
Based on research into YNAB, EveryDollar, and UX onboarding best practices, the recommended wizard structure is:
**Donut chart:**
- Use `innerRadius={60}` to `innerRadius={72}` for a modern ring look (not too thin)
- Place center total using `<Label>` with `content` prop inside `<Pie>` using `viewBox` cx/cy coordinates
- Use `activeShape` with `outerRadius + 10` for hover expansion
- Add `isAnimationActive` to respect `prefers-reduced-motion`
- Legend as a separate `<ul>` below the chart (not Recharts built-in legend) for full styling control
**Step 1 — Income**
- Single question: "What's your monthly take-home income?"
- Single number input + currency formatting
- Skip option: "I'll add this later"
- Sets the anchor for running balance in step 2
**Horizontal bar chart (budget vs actual by type):**
- `<BarChart layout="vertical">` with `<XAxis type="number">` and `<YAxis type="category">`
- Two `<Bar>` components — one for budgeted (muted/secondary color) and one for actual (category color)
- Set `barSize` to keep bars compact; use `barCategoryGap` for breathing room
- `<LabelList position="right">` for actual amounts visible on bar ends
- Never start X axis at a non-zero value
**Step 2 — Recurring Items**
- Pre-loaded list of common items grouped by type (bills, variable expenses, debts, savings, investments)
- Each item has a checkbox (on by default for high-likelihood items, off for lower-likelihood)
- Editable amount field per item (prefilled with static sensible default)
- Running balance updates live: "Remaining to allocate: $X"
- "Add custom item" inline for items not in the list
- Skip option: "I'll set this up manually"
**Grouped bar chart (income budget vs actual):**
- Standard `<BarChart>` with `layout="horizontal"` (default)
- Two `<Bar>` groups: budgeted (muted fill) and actual (category color)
- `<CartesianGrid vertical={false}>` to reduce visual noise
- Custom `<ChartTooltip>` showing both values with currency formatting
**Step 3 — Review**
- Summary of selected items by group
- Total income, total allocated, remaining
- "Create my template" CTA — writes to the template table
- "Go back" link to step 2
**Color system:**
- All charts must consume CSS variables from the existing OKLCH palette (`var(--color-income)`, etc.)
- Never hardcode hex values in chart components — use the `categoryColors` map from `palette.ts`
- Green/red semantic colors for over/under-budget states must be distinct from category colors
**Post-wizard:**
- Auto-create current month budget from template (immediate)
- Show toast: "Your [Month] budget has been created"
- Land on budget view for current month
**Confidence:** MEDIUM — pattern validated by YNAB (beginner template import), EveryDollar (wizard-style), and UX onboarding research. 3-step max is validated by drop-off research (complexity above 3 steps correlates with abandonment).
---
## Inline Add-From-Library Design Notes
The existing Quick Add page uses a library of one-off items (`quick_add_items` table). In v2.0, this interaction moves inline to the budget view.
**Recommended pattern (based on fintech UX research):**
- Trigger: "Add item" button in each category section header on the budget view
- Mechanism: A slide-in panel or modal sheet (not a full page navigation)
- Contents: Category pre-selected (from which section was clicked); searchable list of library items for that category type; amount field; description field
- On confirm: Item added to budget for the month, totals update immediately
- On dismiss: Panel closes, no navigation
**Why panel/sheet over modal:**
- Modals block background context; users lose their place in the budget
- A slide-in sheet (shadcn/ui Sheet component) keeps the budget visible alongside the picker
- Smashing Magazine (2026): "modals work for quick confirmations; sheets work for contextual data entry tasks"
**Why not keep the separate Quick Add page:**
- Two surfaces for the same action creates confusion (which should I use?)
- The separate page breaks the flow — user must navigate away, losing their place
- Inline keeps the budget view as the single place for monthly budget work
---
## Sources
- [Fintech design guide with patterns that build trust — Eleken (2026)](https://www.eleken.co/blog-posts/modern-fintech-design-guide)
- [Finance Dashboard Design Best Practices — F9 Finance](https://www.f9finance.com/dashboard-design-best-practices/)
- [Budget vs Actual Dashboard — Bold BI](https://www.boldbi.com/dashboard-examples/finance/budget-vs-actual-dashboard/)
- [7 Essential Financial Charts for Personal Finance Visualization — Syncfusion](https://www.syncfusion.com/blogs/post/financial-charts-visualization)
- [Fintech dashboard design — Merge Rocks](https://merge.rocks/blog/fintech-dashboard-design-or-how-to-make-data-look-pretty)
- [Dashboard Design UX Patterns Best Practices — Pencil & Paper](https://www.pencilandpaper.io/articles/ux-pattern-analysis-data-dashboards)
- [shadcn/ui Charts — Donut with center text, Bar charts](https://ui.shadcn.com/charts)
- [Bar Charts Best Practices — Nastengraph / Medium](https://nastengraph.medium.com/bar-charts-best-practices-5e81ebc7b340)
- [Best Color Palettes for Financial Dashboards — Phoenix Strategy Group](https://www.phoenixstrategy.group/blog/best-color-palettes-for-financial-dashboards)
- [The Role of Color Theory in Finance Dashboard Design — Extej / Medium](https://medium.com/@extej/the-role-of-color-theory-in-finance-dashboard-design-d2942aec9fff)
- [Skeleton loading screen design — LogRocket](https://blog.logrocket.com/ux-design/skeleton-loading-screen-design/)
- [Empty state UX examples — Eleken](https://www.eleken.co/blog-posts/empty-state-ux)
- [YNAB / Mint / Empower comparison — The State of Personal Finance Apps 2025](https://bountisphere.com/blog/personal-finance-apps-2025-review)
- [Recharts documentation — recharts.org](https://recharts.github.io/en-US/api/Bar/)
- [YNAB Beginner Template and category setup](https://www.ynab.com/templates)
- [YNAB new flexible checklist for mobile (Oct 2025)](https://www.ynab.com/whats-new)
- [YNAB vs Copilot AI comparison 2025 — ZenFinanceAI](https://zenfinanceai.com/ynab-vs-copilot-ai/)
- [Monarch Money budget creation documentation](https://help.monarch.com/hc/en-us/articles/360048883631-Creating-Your-Budget-in-Monarch)
- [Monarch vs EveryDollar comparison — BudgetCoachUSA](https://budgetcoachusa.com/monarch-vs-everydollar/)
- [Top Personal Finance Apps with Customizable Budget Categories 2026 — Quicken](https://www.quicken.com/blog/top-personal-finance-apps-with-customizable-budget-categories/)
- [Best Budget Apps 2026 — NerdWallet](https://www.nerdwallet.com/finance/learn/best-budget-apps)
- [Best Budget Apps 2026 — Engadget](https://www.engadget.com/apps/best-budgeting-apps-120036303.html)
- [How Great Budget App Design Increases User Retention — Onething Design](https://www.onething.design/post/budget-app-design)
- [UX Onboarding Best Practices 2025 — UX Design Institute](https://www.uxdesigninstitute.com/blog/ux-onboarding-best-practices-guide/)
- [Budget App Design Tips from Fintech Experts — Eleken](https://www.eleken.co/blog-posts/budget-app-design)
- [Modal vs. Separate Page: UX Decision Tree — Smashing Magazine](https://www.smashingmagazine.com/2026/03/modal-separate-page-ux-decision-tree/)
- [Actual Budget — self-hosted open source](https://actualbudget.org/)
- [App Onboarding Guide 2026 — UXCam](https://uxcam.com/blog/10-apps-with-great-user-onboarding/)
- [Fintech App Top 20 Financial UX Dos and Don'ts — UXDA](https://theuxda.com/blog/top-20-financial-ux-dos-and-donts-to-boost-customer-experience)
---
*Feature research for: SimpleFinanceDash UI overhaul — presentation layer*
*Researched: 2026-03-16*
*Feature research for: SimpleFinanceDash v2.0 — wizard setup, auto-budget creation, simplified monthly tracking UX*
*Researched: 2026-04-02*

View File

@@ -1,182 +1,202 @@
# Pitfalls Research
**Domain:** Personal finance dashboard UI overhaul (React SPA)
**Researched:** 2026-03-16
**Confidence:** HIGH (most findings verified against official docs, Recharts issues tracker, and Tailwind v4 official docs)
**Domain:** Adding wizard setup, auto-budget creation, design system rework, and page consolidation to an existing personal budget app (React + Supabase + TanStack Query)
**Researched:** 2026-04-02
**Confidence:** HIGH (based on direct codebase analysis + known patterns for wizard state, auto-creation concurrency, and design system rework in existing apps)
---
## Critical Pitfalls
### Pitfall 1: Recharts Re-renders Every Parent State Change
### Pitfall 1: Duplicate Budget Creation on Concurrent Auto-Create Calls
**What goes wrong:**
The existing `DashboardPage.tsx` computes `pieData` and `progressGroups` directly in the render body — no `useMemo`. Every unrelated state change (e.g., a tooltip hover, a loading flag flip, QuickAddPicker opening) re-runs these array transforms and causes Recharts to diff its entire virtual DOM tree. Adding two more charts (bar chart, horizontal bar) multiplies this cost by 3x. With a large budget, each O(n) filter+reduce runs six times per render for each chart type.
The v2.0 goal is "auto-create this month's budget on first visit." The current `generateFromTemplate` mutation in `useBudgets.ts` has no deduplication guard — it creates a budget row unconditionally. If the dashboard mounts, checks for a current-month budget, finds none, and fires the auto-create, there is a race: if the component re-renders (e.g., auth state settles, React Strict Mode double-invokes effects) or the user has two tabs open, two budget rows get created for the same month. Both have the same `start_date`/`end_date` and `user_id`, but different UUIDs. There is no unique constraint on `(user_id, start_date)` in the current `004_budgets.sql` migration.
**Why it happens:**
The existing single-chart dashboard is fast enough that the missing memoization is invisible. During the overhaul, three chart instances are added to the same render tree, and the dashboard becomes visually complex enough that parent re-renders happen more frequently (collapsible state toggles, hover events on multiple chart tooltips).
Auto-create logic placed in a React component or effect reacts to data absence, but TanStack Query's `enabled` flag and mutation guards don't prevent double-invocation in Strict Mode or multi-tab scenarios. The "check then create" pattern is an inherently non-atomic operation in the current client-side architecture.
**How to avoid:**
- Wrap all chart data derivations in `useMemo` with explicit deps arrays:
```tsx
const pieData = useMemo(() =>
EXPENSE_TYPES.map(type => { ... }).filter(d => d.value > 0),
[items, t]
)
```
- Wrap formatter callbacks passed to `<Tooltip formatter={...}>` in `useCallback`. New function references on every render force Recharts to re-render tooltip internals.
- Extract each chart into its own memoized sub-component (`React.memo`) so only the chart whose data changed re-renders.
- Create a category index Map once (in a hook or useMemo) and look up by key rather than `.filter()` per item across three charts.
- Add a database unique constraint: `UNIQUE (user_id, start_date)` on the `budgets` table via a new migration. This makes duplicate creation fail at the DB level rather than silently succeeding.
- In the auto-create logic, use an upsert (INSERT ... ON CONFLICT DO NOTHING) rather than a plain INSERT, so concurrent calls are idempotent.
- Use TanStack Query's mutation state to gate the auto-create: only fire if `mutation.isIdle` and no existing budget is found, never fire inside a `useEffect` without a ref guard.
- After auto-create, immediately invalidate the budgets list query so the new budget is fetched in the same round-trip.
**Warning signs:**
- React DevTools Profiler shows `DashboardContent` re-rendering on tooltip mouseover
- Multiple chart tooltips fighting each other (Recharts issues #281 / #1770)
- "ResizeObserver loop limit exceeded" console errors when multiple `ResponsiveContainer` instances mount simultaneously
- Two budget entries appear for the same month on the BudgetListPage after first visit
- `console.error` shows a Supabase `23505 unique_violation` if the constraint is added and the race is triggered
- Dashboard shows "Budget already exists" error toasts intermittently on page load
**Phase to address:** Dashboard redesign phase (charts implementation)
**Phase to address:** Auto-budget creation phase — add the DB constraint first, implement upsert-based creation second. Do not build the auto-create UI trigger before the constraint exists.
---
### Pitfall 2: CSS Variable Scope — Recharts Cannot Read Tailwind `@theme inline` Variables
### Pitfall 2: Wizard State Lost on Browser Back/Refresh — No Persistence Strategy
**What goes wrong:**
The existing `palette.ts` already uses `var(--color-income)` etc. as chart fill values. This works correctly because Tailwind v4's `@theme inline` inlines these as true CSS custom properties on `:root`. However, the risk is subtle: if any chart color is set via a Tailwind utility class string (e.g., `fill-[var(...)]`) rather than through the `style` prop or a direct CSS variable reference, Recharts SVG elements — which render outside the standard DOM paint context — may not resolve them correctly in all browsers.
Additionally, dark mode: the current CSS has no dark-mode overrides for `--color-income` through `--color-investment`. If the overhaul adds a dark mode toggle, all chart colors will remain light-mode pastel on dark backgrounds, creating very poor contrast.
A multi-step wizard (step 1: pick categories, step 2: set amounts, step 3: confirm) built with local React state (`useState`) loses all progress if the user navigates away, refreshes, or presses the browser back button. For a setup wizard that may have 35 steps and requires selecting 1020 template items with amounts, this is a critical UX failure on first run. The user loses all work and must restart from step 0.
**Why it happens:**
Tailwind v4's `@theme inline` block defines variables at `:root` scope, but the dark mode variant uses `.dark` class scoping. Theme variables defined only in `@theme inline` are not automatically duplicated under `.dark {}`. Dark-mode overrides for semantic colors (background, foreground) exist in shadcn's generated block, but category colors were custom-added without dark variants.
The natural implementation is `const [step, setStep] = useState(0)` and `const [selections, setSelections] = useState([])` inside the wizard component. React state is ephemeral — it does not survive unmount. This works fine for modals but fails for a first-run setup wizard that the user may pause mid-way.
**How to avoid:**
- Pass all Recharts color values via JavaScript (the `fill={categoryColors[type]}` pattern is correct — maintain it).
- If dark mode is added in the overhaul: add a `.dark {}` block in `index.css` that overrides `--color-income`, `--color-bill`, etc. with darker/brighter variants appropriate for dark backgrounds.
- Never attempt to pass Tailwind utility class strings as Recharts `fill` props. Recharts `Cell`, `Bar`, `Line` props require resolved color values (hex, oklch string, or `var()` reference).
- Test chart colors in both light and dark modes before marking a phase complete.
- Persist wizard state to `localStorage` keyed by user ID (e.g., `wizard_state_${userId}`) — read on mount, write on every step change, clear on completion/skip.
- Use a simple serializable state shape: `{ step: number, selections: { categoryId, amount, tier }[] }`.
- On wizard mount: check localStorage first; if partial state exists, resume from the saved step with a "Continue where you left off" prompt.
- On wizard completion or explicit skip: clear the localStorage key.
- Do NOT use URL params to store full wizard state (too much data); use URL only to track the current step number (e.g., `?setup-step=2`) for browser back/forward support.
**Warning signs:**
- Chart fills show as `oklch(...)` literal text in DOM attributes instead of resolved colors
- Colors are invisible or white-on-white on one theme variant
- Browser DevTools shows SVG `fill` as unresolved `var(--color-income)` with no computed value
- Wizard always starts at step 1 even after the user had reached step 3
- User reports losing selected categories after an accidental page reload
- No `localStorage` keys being set/read during wizard interaction
**Phase to address:** Design token / theming phase (early); dashboard charts phase (verification)
**Phase to address:** Wizard setup phase — define the persistence strategy before building any step components. The storage format must be finalized before the first step is wired.
---
### Pitfall 3: Collapsible Sections Causing Layout Shift and CLS Jank
### Pitfall 3: Design Token Rework Breaks Existing Pages Silently
**What goes wrong:**
The planned hybrid dashboard includes collapsible inline sections for each category group (income, bills, variable expenses, debt, savings). If these are implemented by toggling `display: none` / `display: block` or by animating the `height` CSS property from `0` to `auto`, the result is either: (a) instant snap with no animation, or (b) jank where the browser triggers full layout recalculations on every animation frame. With five collapsible sections and charts above them, collapsing a section causes the charts to resize (their `ResponsiveContainer` detects parent width change), triggering a cascade of resize events.
The v2.0 design system rework changes CSS variables in `index.css` (border-radius tokens from rounded to sharp, color palette from current OKLCH pastels to sharper/clearer ones, spacing adjustments). Because every existing page consumes these global tokens, any change to `--radius`, `--background`, `--foreground`, `--border`, or the six category color variables cascades to all 9 pages simultaneously. Changing `--radius` from `0.5rem` to `0px` sharps every Button, Card, Input, and Badge across the app in one line — but it also breaks charts (Recharts SVG `rx` attributes don't follow CSS variables) and any component that had visual design crafted around rounded corners.
**Why it happens:**
Animating `height` from `0` to `auto` is a known browser limitation — you cannot CSS-transition to `height: auto`. Common naive workarounds (JavaScript measuring `scrollHeight` on every frame) cause layout thrashing. Radix UI's `Collapsible` component handles this correctly via CSS custom properties for height, but requires the `data-state` attribute pattern and the correct CSS transition on the inner `CollapsibleContent` element.
The current system uses shadcn/ui's CSS variable convention which is explicitly global-scope. Every component that uses `rounded-lg` (which resolves to `var(--radius)`) will change simultaneously. Pages that were "done" in v1.0 become visually broken the moment a global token changes.
**How to avoid:**
- Use Radix UI `Collapsible` (already available via shadcn) — it sets `--radix-collapsible-content-height` as a CSS variable during open/close, enabling smooth CSS-only transition:
```css
[data-state='open'] > .collapsible-content {
animation: slideDown 200ms ease-out;
}
[data-state='closed'] > .collapsible-content {
animation: slideUp 200ms ease-out;
}
@keyframes slideDown {
from { height: 0 }
to { height: var(--radix-collapsible-content-height) }
}
```
- Add `debounce={50}` to all `ResponsiveContainer` instances to prevent rapid resize recalculations when parent containers animate.
- Use `padding` instead of `margin` inside collapsible children — margin collapsing causes jump artifacts on some browsers.
- Never animate `height`, `padding`, or `margin` directly with JavaScript setInterval; use CSS animations or Radix primitives.
- Before touching any tokens, audit which existing pages use `--radius`, `--border`, and `--background` implicitly (via Tailwind utilities like `rounded-md`, `border`, `bg-background`). This is every page.
- Change tokens in isolation with a visual regression pass on ALL 9 pages before touching any page's component code. The token change should be one commit; the per-page fixup should be separate commits.
- For the category color variables (`--color-income` through `--color-investment`), verify Recharts SVG fills still resolve after the change — these are passed as `fill={var(--color-income)}` in JS and require testing in both the browser DOM and printed output.
- Do not land the token rework mid-phase alongside page component changes — treat it as its own atomic commit.
**Warning signs:**
- Charts visually "snap" to a narrower width and back when a section above them is toggled
- Frame rate drops to under 30fps when expanding/collapsing sections (visible in DevTools Performance panel)
- `ResizeObserver loop limit exceeded` errors spike after section toggle
- Auth pages (login/register) have wrong border-radius after a `--radius` token change
- Chart SVG fills appear correct in DevTools computed styles but wrong visually on screen
- Any page that was marked "done" in v1.0 shows new visual regressions after token PR merges
**Phase to address:** Dashboard collapsible sections phase
**Phase to address:** Design system foundation phase — the first phase of v2.0. Token rework must land before any page is rebuilt. Requires an explicit visual regression check of all existing pages immediately after the token commit.
---
### Pitfall 4: Color Accessibility Failures in Financial Semantic Colors
### Pitfall 4: Quick-Add Page Removal Breaks Existing User Data and Nav References
**What goes wrong:**
The most dangerous pattern in the existing dashboard is using pure green / red to signal positive / negative balance:
```tsx
const balanceColor = availableBalance >= 0
? "text-green-600 dark:text-green-400"
: "text-red-600 dark:text-red-400"
```
And in the progress bar:
```tsx
const barColor = group.overBudget
? "bg-red-500 dark:bg-red-400"
: "bg-green-500 dark:bg-green-400"
```
The `quick_add_items` table and `QuickAddPage` exist in production. Existing users have data in this table (names, icons, sort_order). If the page is simply removed from routing and the nav (deleting `<Route path="quick-add" />` and the nav item in `AppLayout.tsx`) without a data migration or a clear deprecation path, those users:
1. Lose access to their quick-add items (no UI)
2. Have orphaned `quick_add_items` rows in the database that no longer serve any purpose
3. May hit broken bookmarks or history entries for `/quick-add`
Pure green (#00FF00) has a contrast ratio of only 1.4:1 against white — catastrophically below WCAG AA's 4.5:1 minimum for text. Even `green-600` (#16a34a) must be verified. Additionally, pie chart adjacent slice colors must maintain 3:1 contrast against each other (WCAG 2.1 SC 1.4.11 Non-text Contrast) — the existing six category colors are all similar lightness (OKLCH L ≈ 0.650.72), meaning they may be hard to distinguish for colorblind users or when printed.
The new v2.0 model replaces quick-add with "add one-offs from category library directly in budget detail." This is a different data shape — category library items are categories, not quick_add_items. If a user had quick-add items that conceptually map to categories, that mapping is lost.
**Why it happens:**
Designers focus on making the palette "look rich" during an overhaul without running contrast checks. The redesign goal is "rich, colorful visual style" — this is a direct risk factor for accessibility regressions. Color-alone encoding (green = good, red = bad) violates WCAG 1.4.1 Use of Color, which requires that color not be the sole means of conveying information.
Page removal feels like a simple delete-the-route operation. The data persistence and existing user considerations are invisible during development because the developer's test account may have no quick-add data.
**How to avoid:**
- Run every text color against its background through a WCAG contrast checker (target 4.5:1 for normal text, 3:1 for large text and UI components). Use the Tailwind oklch values — compute with tools like https://webaim.org/resources/contrastchecker/
- For semantic colors (balance positive/negative, over-budget): supplement color with an icon or text label, not color alone. Example: a checkmark icon + green for positive balance; an exclamation icon + red for over-budget.
- For pie/donut chart slices: ensure adjacent colors have at least 3:1 contrast, or add a visible stroke separator (1px white/black stroke between slices provides a natural contrast boundary).
- For the 6 category colors: vary hue and lightness, not just hue. Consider making the OKLCH lightness values more spread (e.g., 0.55 to 0.80 range) so colors are distinguishable at reduced color sensitivity.
- Do not rely on `dark:text-green-400` having passed contrast automatically — verify each dark mode color pair independently.
- Audit: Does any existing user data in `quick_add_items` map to something meaningful in the new model? If quick-add items are just named shortcuts and the new model uses categories instead, the migration path is: surface existing quick-add items in the new "category library" flow, or clearly communicate to users that this data is being retired.
- For the route: add a redirect `<Route path="quick-add" element={<Navigate to="/budgets" replace />} />` rather than leaving `/quick-add` as a 404. This handles bookmarks and history.
- Remove the nav link in `AppLayout.tsx` at the same time as the redirect is added — never before.
- Add a DB migration only if you decide to drop or repurpose the `quick_add_items` table. If keeping the table dormant, document why. If dropping it, confirm no FK references exist (none in the current schema — `budget_items` does not reference `quick_add_items`).
**Warning signs:**
- All six category pie slices are clearly distinguishable to the developer but indistinguishable when the browser's "Emulate vision deficiency" filter is applied in DevTools
- Running `window.getComputedStyle` on a colored element and checking its OKLCH L value — if multiple semantic colors cluster at the same lightness, colorblind users see identical grays
- Developer tests removal on a fresh account with no quick-add data, misses the issue
- Browser history entries for `/quick-add` result in a blank or redirect-looping page
- `useQuickAdd` hook is still imported somewhere but the page is gone, causing a dead import
**Phase to address:** Design token / visual language phase (establish accessible palette before building components); then verify in each component phase
**Phase to address:** Page consolidation phase (when BudgetDetailPage gets inline add-from-library). Remove the page only after the replacement flow is functional and tested with existing user data.
---
### Pitfall 5: i18n Key Regressions When Renaming or Adding UI Sections
### Pitfall 5: Auto-Budget Creation Ignores User Currency Setting
**What goes wrong:**
The current translation files (`en.json`, `de.json`) have flat keys per page section. The overhaul adds new dashboard sections (bar chart, horizontal bar chart, collapsible income/bill/expense groups, richer donut legend). Each new label, section header, tooltip, and ARIA label needs a corresponding key in both files. During rapid UI iteration, developers commonly add `t("dashboard.incomeSection")` to the JSX, forget to add it to `de.json`, and only notice when the German locale shows the raw key string — or worse, the i18next fallback silently shows the English value and the German regression goes undetected.
The current `generateFromTemplate` mutation in `useBudgets.ts` accepts `currency?: string` with a default of `"EUR"`. If the auto-create logic fires without reading the user's profile `currency` field first, every auto-created budget will be denominated in EUR regardless of the user's settings. A user who has set their currency to USD or GBP in Settings will get EUR-denominated budgets. The `formatCurrency` calls will then display amounts in the wrong currency until the user manually edits the budget.
**Why it happens:**
`i18next` with `fallbackLng: 'en'` (the existing config) silently falls back to English when a German key is missing. There is no visible failure. The project has no i18n linting step and no build-time key extraction check. The `debug: false` production config makes this invisible.
The auto-create is triggered by checking if a budget exists for the current month and calling `generateFromTemplate({ month, year })` — the `currency` parameter is optional and defaults silently. During development on a EUR-default account, this works fine and the bug is invisible.
**How to avoid:**
- When adding a new UI section, add its keys to **both** `en.json` and `de.json` in the same commit — never split across commits.
- Use `i18next-cli` or `i18next-scanner` (npm package) to extract all `t("...")` call keys from source and diff against the JSON files. Run this as a pre-commit check or part of the build.
- In development, consider setting `debug: true` in `i18n.ts` — i18next logs `missingKey` warnings to console for every untranslated key in the non-fallback language.
- Use a TypeScript-typed i18n setup (e.g., `i18next-typescript`) so that `t("dashboard.nonExistentKey")` produces a type error at compile time.
- Before marking any phase complete, manually switch locale to German and click through every changed screen.
- The auto-create trigger must first load the user's profile (from the `profiles` table, `currency` column) and pass that value explicitly: `generateFromTemplate({ month, year, currency: profile.currency })`.
- The `useProfile` or `useAuth` hook should be resolved before the auto-create mutation fires. Use TanStack Query's `enabled` flag to chain the dependency: only auto-create when both the budgets list AND the profile are loaded.
- Add an assertion in the mutation: if `currency` is undefined, throw rather than silently default.
**Warning signs:**
- German UI text contains raw dot-notation strings (e.g., `dashboard.barChart.title`)
- `console.warn` messages containing `i18next::translator: missingKey de`
- `de.json` has fewer top-level keys than `en.json` after a phase's changes
- Auto-created budgets always show EUR symbol even when user has set USD in Settings
- The profile `currency` is not read anywhere in the auto-create code path
- Test passes for EUR users only; USD/GBP users never tested
**Phase to address:** Every phase that adds new UI text; establish the key-parity check process in the first phase of the overhaul
**Phase to address:** Auto-budget creation phase — the profile dependency must be resolved as part of the auto-create implementation, not as a follow-up fix.
---
### Pitfall 6: Design Inconsistency Across Page Refreshes (The "Island Redesign" Problem)
### Pitfall 6: Wizard Creates Categories and Template Items Without Idempotency — Re-run Corrupts Data
**What goes wrong:**
The overhaul covers all pages, but if phases are structured page-by-page, early pages get the richest design attention and later pages get inconsistency or fatigue-driven shortcuts. The most common failure mode: the dashboard uses a specific card style (colored header accent, icon in corner), but the Categories page — redesigned two weeks later — uses a subtly different card variant. Buttons on the Budget Detail page use different spacing than on the Template page. The result is a design that looks cohesive in screenshots of individual pages but feels broken when navigating between them.
The setup wizard pre-fills common items (rent, groceries, car insurance, etc.) and on completion creates: (a) category rows in `categories`, (b) template_items in `template_items`. If the user runs the wizard, quits mid-way, then re-runs it, or if the wizard's "complete" step fires twice due to a network retry, duplicate categories and template items are created. The `categories` table has no unique constraint on `(user_id, name)`. The user ends up with "Rent" appearing twice as a category and twice as a template item.
**Why it happens:**
There is no design system enforced at the component level. shadcn/ui components are used directly in pages without project-specific wrappers. When the overhaul introduces new visual patterns (e.g., a colored icon badge, a section divider style), they are implemented inline in the first page that needs them and then drift in subsequent pages as developers make minor "feels close enough" adaptations.
Wizard completion is typically a single "save all" mutation. If the user navigates back to step 1 and completes again, or if a network error causes a retry, the entire creation sequence runs again. Category creation has no deduplication.
**How to avoid:**
- Before redesigning any pages, establish a small shared component library of new visual primitives (e.g., `<SectionHeader>`, `<StatCard>`, `<CategoryBadge>`) with fixed prop interfaces. All page redesigns consume these components — they never re-implement them inline.
- Define the full color palette and spacing scale in the first phase, not incrementally. The `index.css` `@theme` block is the single source of truth — no hardcoded hex values anywhere else.
- Create a visual spec (even a quick screenshot grid) of what each page will look like before coding begins, so inconsistencies are caught at design time not code review time.
- In code review: any new Tailwind classes that don't use design tokens (e.g., `text-[#6b21a8]`, `p-[13px]`) should be flagged as violations.
- Add a database unique constraint on `categories (user_id, name)` (or at minimum check for existence before insert). Use upsert for category creation in the wizard flow.
- Gate the wizard's final "create" step behind a `isFirstRun` flag stored in the user's `profiles` table (e.g., a `setup_completed` boolean). Once `true`, the wizard's create mutation is a no-op.
- Use a two-phase completion approach: "Preview what will be created" → "Confirm" — this prevents accidental double-submission.
- If using localStorage for wizard state, clear it atomically when the server-side creation succeeds, not before.
**Warning signs:**
- Two pages use different visual patterns for "section with a list of items" (one uses a table, one uses cards)
- Color values appear as raw hex or oklch literals in component files instead of semantic tokens
- shadcn Card component is used in 3 different ways across 3 pages (no wrapper abstraction)
- Running the wizard twice results in duplicated category rows in the Categories page
- Template page shows duplicate items with identical names
- A Supabase unique constraint error on `categories` fires if the constraint is added after the wizard is built
**Phase to address:** Design foundation phase (first phase of overhaul) before any page work begins
**Phase to address:** Wizard setup phase — idempotency requirements must be specified as acceptance criteria before any wizard mutation code is written.
---
### Pitfall 7: CSS Variable Scope Rework Breaks Recharts SVG Fill Resolution
**What goes wrong:**
v1.0 established that category colors are passed to Recharts as CSS variable references resolved in JavaScript (`var(--color-income)` etc. via `categoryColors` in `palette.ts`). If the v2.0 design token rework renames these variables (e.g., from `--color-income` to `--category-income`, or changes the OKLCH values such that the Recharts SVG `fill` attributes show visually different colors than intended), charts break silently — the SVG renders but fills are wrong.
Additionally, Recharts SVG elements operate outside the standard CSS cascade for some browsers. If OKLCH values are changed to be very light (high L) in pursuit of "clearer pastels," SVG fills may become nearly invisible on white chart backgrounds because SVG doesn't inherit `background` opacity in the same way HTML elements do.
**Why it happens:**
Design token rework focuses on HTML components and Tailwind utility class output. Recharts SVG fills are wired through `palette.ts` as literal CSS variable strings — not Tailwind classes — so they are easy to miss in a token audit.
**How to avoid:**
- After any `index.css` token change, explicitly open the dashboard and inspect all three charts (donut, bar, horizontal bar) to verify fill colors match intention.
- Keep `palette.ts` as the single source of truth for chart colors — do not duplicate color definitions in component files.
- If renaming CSS variable names (not just changing values), grep the entire codebase for the old variable name before deleting it.
- Test chart fill visibility against the new `--background` value — lighter backgrounds require slightly more saturated or darker chart fills to maintain visibility.
**Warning signs:**
- Chart fills appear white or very faint after a design token change
- `palette.ts` still references `--color-income` after a rename to `--category-income`
- Charts look correct in Storybook/isolation but wrong on the actual dashboard
**Phase to address:** Design system foundation phase (when tokens change) AND dashboard phase (verification).
---
### Pitfall 8: "Template Empty" Edge Case Breaks Auto-Budget and New-User Wizard
**What goes wrong:**
The auto-budget creation flow depends on the template having items. The current `generateFromTemplate` code handles an empty template gracefully — it creates an empty budget. But the v2.0 UX intent is that visiting the dashboard for the first time should show a useful budget, not an empty one. If the wizard is bypassed (user skips setup), or if wizard completion fails silently, the auto-created budget has zero items, and the dashboard shows nothing meaningful.
A second edge case: a user who completed v1.0 setup manually (has categories + template items) visits v2.0 for the first time. The wizard should not re-run — but if the "has template items" check is the gate, and they had template items before, the wizard is skipped, and the auto-create fires correctly. If that check is wrong (e.g., checking `template.name === "My Monthly Template"` instead of `template_items.length > 0`), existing users get redirected into the wizard.
**Why it happens:**
The first-run detection logic is complex: it must distinguish between (a) brand new user with no data, (b) existing user who set up manually in v1.0, (c) user who started wizard but didn't finish, (d) user who completed wizard. Each case needs different behavior and the logic branches are easy to conflate.
**How to avoid:**
- Define the first-run gate explicitly using the `profiles.setup_completed` boolean (recommended in Pitfall 6) — this is the single authoritative signal, not inferred from data shape.
- For existing v1.0 users: write a migration or a one-time check that sets `setup_completed = true` for any user who already has template items. This prevents the wizard from showing for users who have already configured their template.
- Test all four user cases explicitly before shipping the wizard.
**Warning signs:**
- Existing users (who set up in v1.0) see the setup wizard on their next login
- New users who skip the wizard get a blank dashboard with no explanation
- The `setup_completed` flag is never set to `true` for existing users via migration
**Phase to address:** Wizard setup phase — the first-run gate and existing-user migration must be defined as part of the wizard's acceptance criteria, not as an afterthought.
---
@@ -184,12 +204,13 @@ There is no design system enforced at the component level. shadcn/ui components
| Shortcut | Immediate Benefit | Long-term Cost | When Acceptable |
|----------|-------------------|----------------|-----------------|
| Inline chart data transforms in render | Faster to write | Re-renders on every state change; adding more charts multiplies the cost | Never — always `useMemo` for chart data |
| Hardcoded color classes `text-green-600` for semantic states | Familiar Tailwind pattern | Dark mode variants need to be manually maintained in two places; fails contrast checks | Only for truly non-semantic colors (e.g., a green checkmark icon that is always green) |
| Copying shadcn component patterns across pages without abstraction | Faster per-page development | Design drift guarantees inconsistency; changes to shared patterns require hunting all usages | MVP only, with explicit note to abstract before more pages are built |
| Adding English i18n keys without German equivalent | Unblocks development | Silent regression in German locale; accumulates debt that is hard to audit later | Never in this project — add both languages in the same commit |
| Using `ResponsiveContainer` without `debounce` | Default behavior, no extra code | Multiple containers trigger simultaneous resize cascades when sections open/close | Acceptable for single-chart pages; set `debounce={50}` on all multi-chart layouts |
| Implementing collapsible with `display: none` toggle | Simplest implementation | No animation; abrupt layout shift; screen readers cannot detect intermediate states | Never for primary dashboard sections; acceptable for debug/dev-only UI |
| No `UNIQUE (user_id, start_date)` constraint on `budgets` — skip the migration | Saves one migration | Duplicate budgets on concurrent auto-create; data corruption that is painful to clean | Never — add the constraint before any auto-create code ships |
| Auto-create logic in a `useEffect` | Familiar React pattern | Double-invocation in Strict Mode, fires on re-render, race conditions | Never for write operations; use TanStack Query `useQuery` with `initialData` or a mutation gated on query result |
| Wizard state in component `useState` only | Simplest to write | Lost on refresh; user frustration on first run | Only for wizards that complete in under 30 seconds and have no network steps |
| Skipping the `profiles.setup_completed` flag and inferring first-run from data shape | No migration needed | Complex conditional logic; wrong inference for edge-case users; breaks if data shape changes | Never — explicit flag is always more reliable than inferred state |
| Removing `/quick-add` route without a redirect | One less route to maintain | Broken bookmarks, broken history, 404 for any hardcoded link | Never — always add a redirect when removing a route |
| CSS token rework and page component rework in the same PR | Ships faster | Impossible to attribute regressions; review is overwhelming; rollback is all-or-nothing | Never for design-system-wide token changes — tokens must land as their own commit |
| Using the `quick_add_items` table schema for the new category library | Reuses existing table and hooks | Conflates two different concepts; data model becomes unclear; future features referencing categories become harder | Only if category library is purely a UI concern with no persistence — but it needs persistence, so use categories table |
---
@@ -197,11 +218,13 @@ There is no design system enforced at the component level. shadcn/ui components
| Integration | Common Mistake | Correct Approach |
|-------------|----------------|------------------|
| Recharts + Tailwind CSS variables | Passing Tailwind utility strings (e.g., `"text-blue-500"`) as chart `fill` or `stroke` props | Pass `var(--color-income)` or a resolved hex/oklch string via JS. Recharts SVG does not process Tailwind class strings. |
| Recharts + `ResponsiveContainer` | Placing `ResponsiveContainer` inside a flex/grid parent without an explicit height | The container measures `0px` height. Always wrap in a `<div style={{ height: 240 }}>` or give the parent an explicit height class. |
| shadcn `Collapsible` + Recharts | Placing charts inside collapsible sections without `debounce` | When the collapsible opens, the chart container resizes and triggers `ResizeObserver` rapidly. Add `debounce={50}` to `ResponsiveContainer`. |
| Tailwind v4 `@theme inline` + dark mode | Defining category colors only in `@theme inline` without a `.dark {}` override block | Category colors remain light-mode pastels on dark backgrounds. Define dark variants in a `.dark {}` block in `index.css`. |
| i18next + new UI sections | Adding `t("new.key")` JSX without adding the key to `de.json` | Silently falls back to English in German locale. Always update both files simultaneously. |
| Supabase + auto-create budget | Plain INSERT in a client-side effect, no deduplication | Use INSERT ... ON CONFLICT DO NOTHING with a unique constraint on `(user_id, start_date)` |
| TanStack Query + auto-create mutation | Firing mutation inside `useEffect` with data dependency | Use `useQuery` to check existence, then fire mutation via user action or a stable effect with ref guard |
| localStorage + wizard state | Storing state without user-scoping — one user's wizard state leaks to another on shared device | Key all localStorage entries with `${userId}` prefix |
| Supabase RLS + category library pre-population | Inserting pre-filled categories from client-side wizard without user_id | `user_id` must be set to `auth.uid()` on all inserts; Supabase RLS policy will reject rows with wrong user_id |
| Recharts + new design tokens | Assuming token rename in `index.css` auto-updates SVG fill values | `palette.ts` references CSS variable names explicitly — any rename requires updating `palette.ts` too |
| React Router + wizard steps | Using browser back button to go "back" in wizard while step is tracked only in state | Use URL search params (`?step=2`) so browser back/forward navigate wizard steps correctly |
| TanStack Query + profile currency dependency | Auto-create fires before profile query resolves; uses default currency | Use `enabled: profileLoaded && budgetMissing` to chain query dependencies |
---
@@ -209,11 +232,20 @@ There is no design system enforced at the component level. shadcn/ui components
| Trap | Symptoms | Prevention | When It Breaks |
|------|----------|------------|----------------|
| Unmemoized chart data on a multi-chart dashboard | Tooltip hover causes all three charts to re-render simultaneously; visible lag | `useMemo` for all data transforms, `useCallback` for formatter props, `React.memo` on chart sub-components | Noticeable with 50+ budget items; subtle with 1020 |
| O(n) category lookup per budget item across 3 charts | CPU spike when dashboard loads; slow initial paint | Build a `Map<id, Category>` once in the hook layer, O(1) lookup in components | Becomes visible at ~100 budget items |
| Multiple `ResponsiveContainer` without `debounce` | Rapid resize loop on section toggle; "ResizeObserver loop" errors | Add `debounce={50}` to all `ResponsiveContainer` instances on the dashboard | Any time two or more containers are mounted simultaneously |
| Animating collapsible height with JavaScript | Dropped frames during expand/collapse; chart reflow cascade | Use Radix `Collapsible` with CSS `@keyframes` on `--radix-collapsible-content-height` | Every interaction on the dashboard |
| TanStack Query unbounded cache growth | Long browser session consumes excessive memory | Set `gcTime` and `staleTime` on QueryClient config | After ~30 minutes of active use without page reload |
| Wizard pre-populates 20+ categories in one bulk insert without optimistic UI | Wizard "complete" step hangs for 23 seconds; no feedback to user | Show a loading state immediately; use `mutate` with `onMutate` for optimistic feedback | Every user on wizard completion |
| Auto-create budget fires on every dashboard mount during loading state | Multiple budget rows created; duplicate toasts; TanStack Query cache stale | Gate auto-create on `budgets.isSuccess` (not `isLoading`), and use a ref to prevent repeat fires | Any fast page navigation that remounts the dashboard |
| Category library rendered as a flat list with 50+ items and no virtualization | Picker feels slow and sluggish when inline in BudgetDetailPage | Virtualize the list with TanStack Virtual or paginate by category type | Not an issue at 10 items; noticeable at 30+; problematic at 50+ |
| Re-fetching template items on every wizard step navigation | Network calls on every back/forward in wizard; slow perceived performance | Cache template items in TanStack Query with a long `staleTime`; prefetch on wizard mount | Noticeable on slow connections even with 5 template items |
---
## Security Mistakes
| Mistake | Risk | Prevention |
|---------|------|------------|
| Wizard inserts categories without user_id from auth.uid() | Categories created with wrong or null user_id bypass RLS or are inaccessible | Always derive user_id from `supabase.auth.getUser()` inside the mutation; never pass it from client state |
| Setup wizard marks `setup_completed = true` client-side before DB write succeeds | User appears "set up" but has no data if the write fails; auto-create never triggers again | Mark `setup_completed = true` only in the mutation's `onSuccess` callback |
| Exposing wizard pre-fill library (category names + amounts) as a static client bundle | Not a critical risk for personal finance app, but hardcoded amounts (e.g., "Groceries: $500") are visible in source | Acceptable for this use case; note it is not PII |
---
@@ -221,25 +253,27 @@ There is no design system enforced at the component level. shadcn/ui components
| Pitfall | User Impact | Better Approach |
|---------|-------------|-----------------|
| Color as the only signal for budget overrun (red progress bar) | Colorblind users cannot distinguish over-budget from on-track | Add an icon (exclamation mark) or text indicator alongside the color change |
| Hiding line items behind collapsible sections with no affordance | Users don't discover that sections are expandable; they think the dashboard is incomplete | Use an explicit chevron icon with visible state change; consider first-time-open hint |
| Chart tooltips showing raw numbers without currency formatting | Users see "1234.5" instead of "$1,234.50" — especially jarring in a financial app | Always pass `formatCurrency(value, currency)` in the Recharts `formatter` prop |
| Summary cards showing totals without context (no comparison to last month or budget) | Numbers without context are harder to interpret; users don't know if $1,200 expenses is good or bad | Show budget vs actual delta or a "vs budget" sub-label on cards |
| Five-section collapsible dashboard that defaults to all-collapsed | Users land on a nearly empty dashboard and are confused | Default the primary sections (income, bills) to open on first load |
| Progress bar clamped to 100% without showing actual overage amount | Users cannot see how much they are over budget from the bar alone | Show the actual percentage (e.g., "132%") in the label even when the bar is clamped |
| Wizard with "skip" that results in empty dashboard | User skips setup, sees blank dashboard, doesn't know why nothing is there | If user skips, show a non-empty empty state with a clear "Set up your template" CTA |
| Auto-created budget with no items (empty template) silently creates an empty budget | Dashboard appears to "work" but shows zeros; user confused why their categories aren't there | Check if template has items before auto-creating; if not, show a "complete your template setup" prompt |
| Removing quick-add nav item without explanation | Users who relied on quick-add can't find the feature; assume it's broken | Add a deprecation note or in-app transition message ("Quick-add is now available inline in your budget") |
| Wizard "back" button erases selections made in the later step | User goes back to change one thing and loses all subsequent work | Wizard back/forward must preserve all step state, not reset forward steps |
| Auto-created budget uses wrong month if user's timezone differs from server | User visiting on Dec 31 in UTC+11 gets a January budget auto-created | Derive month from the client's local timezone, not the server's |
| Category library in BudgetDetailPage shows all categories including types that contradict the budget context | Income categories shown when adding a one-off expense item; confusing | Filter the inline picker by relevant category types for the context (expense-only for one-off adds) |
---
## "Looks Done But Isn't" Checklist
- [ ] **Charts:** Verify all three chart types (donut, bar, horizontal bar) render correctly when `items` is empty — Recharts renders a blank SVG that can overlap other content if dimensions are not handled
- [ ] **Dark mode:** Switch to dark theme (if implemented) and verify all category colors, chart fills, and semantic state colors (green/red) have sufficient contrast — light-mode testing only is the most common gap
- [ ] **German locale:** Navigate every redesigned page in German and verify no raw key strings appear — `de.json` parity check
- [ ] **Collapsible sections:** Toggle each collapsible section open and closed rapidly three times — verify no layout shift in charts above/below, no "ResizeObserver loop" errors in console
- [ ] **Empty states:** Load the dashboard with a budget that has zero actual amounts — verify charts handle `pieData.length === 0` and empty bar data without rendering broken empty SVGs
- [ ] **Long category names:** Enter a category named "Wiederkehrende monatliche Haushaltsausgaben" (long German string) — verify it doesn't overflow card boundaries or truncate without tooltip
- [ ] **Currency formatting:** Verify EUR formatting (€1.234,56) and USD formatting ($1,234.56) both display correctly in chart tooltips and summary cards when locale is switched in Settings
- [ ] **Responsive at 1024px:** View the dashboard at exactly 1024px viewport width — the breakpoint where desktop layout switches — verify no horizontal overflow or chart sizing issues
- [ ] **Auto-create:** Verify that visiting the dashboard twice in quick succession (e.g., double-clicking the nav link) creates exactly one budget, not two — check the budgets list after each scenario
- [ ] **Auto-create currency:** Create a test account with currency set to USD in Settings, then visit the dashboard — verify the auto-created budget shows USD, not EUR
- [ ] **Wizard re-run:** Complete the wizard on a fresh account, then manually navigate back to the wizard URL — verify it does not create duplicate categories
- [ ] **Existing user path:** Log in with an account that has v1.0 template items configured — verify the wizard does NOT appear, the existing template is preserved, and a budget is auto-created correctly
- [ ] **Wizard refresh:** Start the wizard, reach step 3, refresh the browser — verify state is restored from localStorage and the wizard resumes at step 3
- [ ] **Quick-add redirect:** Navigate directly to `/quick-add` after the page is removed — verify a redirect to `/budgets` (or equivalent) occurs, not a blank page or 404
- [ ] **Empty template budget:** Remove all items from the template, then navigate to the dashboard — verify no crash, a meaningful empty state is shown, and no empty budget is silently created
- [ ] **Token rework regression:** After changing `--radius` or category color tokens, navigate through all 9 pages (dashboard, categories, template, budget list, budget detail, settings, login, register, and any wizard page) — verify no visual regressions
- [ ] **German locale wizard:** Complete the entire wizard flow in German locale — verify no raw translation keys appear and all pre-filled item names are localized
- [ ] **Design consistency:** Navigate between the newly redesigned pages and the pages not yet touched in the current phase — verify no jarring visual inconsistencies at page transitions
---
@@ -247,12 +281,12 @@ There is no design system enforced at the component level. shadcn/ui components
| Pitfall | Recovery Cost | Recovery Steps |
|---------|---------------|----------------|
| Chart re-render performance discovered in production | LOW | Add `useMemo` wrappers to chart data transforms; wrap chart components in `React.memo`; requires no visual changes |
| Color accessibility failures discovered post-launch | MEDIUM | Audit all semantic color uses with WCAG checker; update `index.css` CSS variable values; may require minor component changes for icon-supplement approach |
| i18n key regressions across multiple pages | MEDIUM | Run `i18next-scanner` to enumerate all missing German keys; systematically add translations; no code changes needed |
| Design inconsistency across pages after all pages are shipped | HIGH | Requires extracting shared component abstractions retroactively and refactoring all pages — avoid by establishing components in first phase |
| `height: 0 → auto` collapsible causing jank discovered mid-phase | LOW | Replace toggle logic with Radix `Collapsible` and add CSS keyframe animation — isolated to the collapsible component, no broader refactor needed |
| `ResponsiveContainer` ResizeObserver loop in multi-chart layout | LOW | Add `debounce={50}` prop to each `ResponsiveContainer` — one-line fix per chart instance |
| Duplicate budgets from concurrent auto-create | MEDIUM | Write a cleanup query to find duplicate `(user_id, start_date)` pairs and delete the empty duplicates; add the unique constraint; patch the auto-create to use upsert |
| Wizard created duplicate categories | MEDIUM | Deduplicate categories by `(user_id, name)` — merge any budget_items or template_items pointing to the duplicate, then delete the duplicate category rows |
| `setup_completed` flag never set for v1.0 users — wizard shows on login | LOW | Write a Supabase migration that sets `setup_completed = true` for any user with `template_items.count > 0`; deploy before releasing v2.0 |
| Token rework broke 3 pages discovered post-merge | MEDIUM | Revert the token commit if pages are too broken to patch quickly, or fix page-by-page with a visual regression pass; establish page-level snapshot tests |
| Quick-add route removed without redirect — users hitting 404 | LOW | Add `<Route path="quick-add" element={<Navigate to="/budgets" replace />} />` — one-line fix; deploy immediately |
| Auto-budget uses wrong currency for existing users | LOW | Add a one-time correction query: update budgets created since v2.0 launch that have EUR currency to the user's profile currency where they differ; patch the auto-create to read profile currency |
---
@@ -260,36 +294,28 @@ There is no design system enforced at the component level. shadcn/ui components
| Pitfall | Prevention Phase | Verification |
|---------|------------------|--------------|
| Recharts re-render on every parent state change | Dashboard charts phase — add memoization before wiring data | React DevTools Profiler: chart sub-components should not appear in flame graph on tooltip hover |
| CSS variable scope / dark mode chart color gaps | Design tokens phase (first) | Inspect SVG `fill` in DevTools; toggle dark mode and visually verify all chart colors resolve |
| Collapsible layout shift and ResizeObserver cascade | Dashboard collapsible sections phase | Toggle all sections rapidly; check console for ResizeObserver errors; check DevTools Performance for layout thrash |
| Color accessibility failures | Design tokens phase — define accessible palette upfront | Run each color pair through WCAG contrast checker; use DevTools "Emulate vision deficiency" filter |
| i18n key regressions | Every phase — enforce dual-language commit rule from the start | Run `i18next-scanner` before marking any phase complete; switch to German locale and navigate all changed pages |
| Design inconsistency across page refreshes | Design foundation phase — create shared components before any page work | Code review: flag any Tailwind color/spacing classes that are not semantic tokens; check that all pages use shared `<SectionHeader>` / `<StatCard>` etc. |
| Duplicate budget creation on concurrent auto-create | Auto-budget creation phase — add DB unique constraint before any auto-create code | Verify `(user_id, start_date)` unique constraint exists in migration; test double-navigation scenario |
| Wizard state lost on refresh | Wizard setup phase — define localStorage persistence strategy in design | Refresh browser at step 3; verify wizard resumes at step 3 |
| Design token rework breaks existing pages | Design system foundation phase — token commit is isolated and followed by full-app visual pass | All 9 pages visually checked after every token change |
| Quick-add removal breaks nav/bookmarks | Page consolidation phase — redirect added in same commit as route removal | Navigate to `/quick-add` directly; verify redirect |
| Auto-budget ignores user currency | Auto-budget creation phase — profile dependency in auto-create spec | Test with USD-configured account; verify budget currency |
| Wizard creates duplicate categories on re-run | Wizard setup phase — idempotency specified as acceptance criteria | Run wizard twice; verify no duplicates in Categories page |
| CSS variable rename breaks Recharts fills | Design system foundation phase — grep for all variable references before rename | Open dashboard after any token rename; inspect all chart fills |
| Empty template edge case shows empty dashboard | Auto-budget + wizard phases — explicit first-run gate with `setup_completed` | Test "skip wizard" path; verify empty state shown, not silent empty budget |
| First-run gate triggers for existing v1.0 users | Wizard setup phase — migration to set `setup_completed` for users with existing template items | Log in with a v1.0 account; verify wizard is skipped |
---
## Sources
- [Recharts performance guide (official)](https://recharts.github.io/en-US/guide/performance/)
- [Recharts deep-compare issue #281](https://github.com/recharts/recharts/issues/281)
- [Recharts ResizeObserver loop issue #1770](https://github.com/recharts/recharts/issues/1770)
- [Recharts ResponsiveContainer API](https://recharts.github.io/en-US/api/ResponsiveContainer/)
- [Improving Recharts performance (Belchior)](https://belchior.hashnode.dev/improving-recharts-performance-clp5w295y000b0ajq8hu6cnmm)
- [Tailwind v4 dark mode docs](https://tailwindcss.com/docs/dark-mode)
- [shadcn/ui Tailwind v4 guide](https://ui.shadcn.com/docs/tailwind-v4)
- [Tailwind v4 migration breaking changes discussion](https://github.com/tailwindlabs/tailwindcss/discussions/16517)
- [shadcn theming with Tailwind v4 and CSS variables (Goins)](https://medium.com/@joseph.goins/theming-shadcn-with-tailwind-v4-and-css-variables-d602f6b3c258)
- [WCAG 2.1 SC 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html)
- [WCAG SC 1.4.3 Contrast Minimum](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html)
- [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/)
- [Radix UI Collapsible primitive](https://www.radix-ui.com/primitives/docs/components/collapsible)
- [i18next missing key detection discussion](https://github.com/i18next/i18next/discussions/2088)
- [Fintech dashboard design (Merge Rocks)](https://merge.rocks/blog/fintech-dashboard-design-or-how-to-make-data-look-pretty)
- [Dashboard UX design principles (Smashing Magazine)](https://www.smashingmagazine.com/2025/09/ux-strategies-real-time-dashboards/)
- Existing codebase analysis: `src/pages/DashboardPage.tsx`, `src/lib/palette.ts`, `src/index.css`, `.planning/codebase/CONCERNS.md`
- Direct codebase analysis: `src/hooks/useBudgets.ts` (generateFromTemplate), `src/hooks/useTemplate.ts` (getOrCreateTemplate), `supabase/migrations/004_budgets.sql`, `supabase/migrations/005_quick_add.sql`, `src/lib/types.ts`, `src/App.tsx`, `src/components/AppLayout.tsx`
- TanStack Query mutation patterns: known double-invocation behavior in React 18 Strict Mode (`useEffect` firing twice)
- Supabase upsert documentation: INSERT ... ON CONFLICT DO NOTHING / DO UPDATE pattern
- React Router v6 redirect patterns for deprecated routes
- localStorage-based wizard state persistence: common pattern in onboarding flow implementations
- PostgreSQL unique constraint behavior on concurrent inserts
---
*Pitfalls research for: SimpleFinanceDash UI overhaul (React + Recharts + Tailwind v4 + shadcn/ui)*
*Researched: 2026-03-16*
*Pitfalls research for: SimpleFinanceDash v2.0 — wizard setup, auto-budget creation, design system rework, page consolidation*
*Researched: 2026-04-02*

View File

@@ -1,234 +1,277 @@
# Stack Research
**Domain:** Personal finance dashboard UI overhaul — React SPA
**Researched:** 2026-03-16
**Domain:** Personal finance dashboard — v2.0 wizard setup, auto-budget creation, sharp pastel design system
**Researched:** 2026-04-02
**Confidence:** HIGH
---
## Context: What Already Exists
## Context: What Already Exists (Do Not Re-Research)
This is a subsequent-milestone research document. The stack is **locked**. The project uses:
Actual installed versions from `package.json` (not the prior research document, which had aspirational versions):
| Package | Installed Version | Status |
|---------|------------------|--------|
| React | 19.2.4 | Locked |
| Vite | 8.0.0 | Locked |
| Package | Actual Installed Version | Notes |
|---------|-------------------------|-------|
| React | ^19.2.4 | Locked |
| Vite | ^8.0.0 | Locked |
| TypeScript | ~5.9.3 | Locked |
| Tailwind CSS | 4.2.1 | Locked |
| Recharts | **3.8.0** | Locked — already on latest |
| Radix UI (via `radix-ui`) | 1.4.3 | Locked |
| Lucide React | 0.577.0 | Locked |
| next-themes | 0.4.6 | Locked |
| TanStack Query | 5.90.21 | Locked |
| Tailwind CSS | ^4.2.1 | Locked |
| Recharts | **2.15.4** | Locked — NOT 3.x (prior research was wrong) |
| radix-ui | ^1.4.3 | Unified post-June 2025 package |
| lucide-react | ^0.577.0 | Locked |
| next-themes | ^0.4.6 | Locked |
| TanStack Query | ^5.90.21 | Locked |
| react-router-dom | ^7.13.1 | Locked |
| sonner | ^2.0.7 | Locked |
| @supabase/supabase-js | ^2.99.1 | Backend is Supabase, not custom Go |
| i18next + react-i18next | ^25.8.18 / ^16.5.8 | Locked |
The `index.css` already defines a complete OKLCH `@theme inline` color system with category-specific colors (`--color-income`, `--color-bill`, etc.) and chart colors (`--color-chart-1` through `--color-chart-5`). The project uses the `radix-ui` unified package (post-June 2025 migration).
**Backend reality check:** Despite the milestone context referencing "Go 1.25 backend", the project is a Supabase-backed React SPA. There is no Go source code. All backend work happens via Supabase migrations (SQL) and the `@supabase/supabase-js` client. This is authoritative — verified from `package.json` and `supabase/migrations/`.
**No new frameworks or backend dependencies.** This research covers only what to add or lean into for the UI overhaul.
**Form handling reality check:** Current forms (login, register, template items) use vanilla `useState` + `React.FormEvent`. No react-hook-form or zod are installed.
**Design token reality check:** `--radius: 0.625rem` is applied globally and is the source of the "clunky rounded" look. Sharp redesign requires overriding this token.
---
## Recommended Stack: Additions and Patterns
## New Dependencies Required
### shadcn/ui Components to Add
### 1. react-hook-form + zod — Wizard Form Validation
The project has shadcn/ui components already (card, button, input, etc.) but is missing two critical primitives for the redesign.
The wizard-style template setup requires multi-step form state that persists across steps, per-step validation before advancing, and type-safe schema enforcement. Vanilla `useState` breaks down across 4+ wizard steps with interdependent validation.
| Component | Install Command | Purpose | Why |
|-----------|----------------|---------|-----|
| `chart` | `npx shadcn@latest add chart` | `ChartContainer` + `ChartTooltipContent` wrappers | Provides theme-aware chart wrappers that read from CSS variables. Eliminates boilerplate for consistent chart theming across all chart types. Copy-paste into `src/components/ui/chart.tsx`. |
| `accordion` | `npx shadcn@latest add accordion` | Collapsible category sections on dashboard | Built on Radix UI Accordion primitive. WAI-ARIA compliant, keyboard navigable, supports `type="multiple"` to keep multiple groups open. |
| `collapsible` | `npx shadcn@latest add collapsible` | Single collapsible toggle pattern | Alternative to Accordion when only one independent section needs to expand/collapse (simpler than full Accordion). |
**Use react-hook-form 7.72.0 + zod 4.3.6 + @hookform/resolvers 5.2.2.**
**CRITICAL: Recharts v3 + shadcn chart.tsx compatibility.** The project is on Recharts 3.8.0. The official shadcn/ui chart PR (#8486) for Recharts v3 support is not yet merged (as of March 2026). After running `npx shadcn@latest add chart`, the generated `chart.tsx` may need manual fixes:
| Package | Version | Purpose | Why |
|---------|---------|---------|-----|
| `react-hook-form` | 7.72.0 | Multi-step form state, per-field validation | Industry standard for React forms; tiny bundle (9.3kb); uncontrolled inputs avoid re-render storms across wizard steps |
| `zod` | 4.3.6 | Schema validation with TypeScript inference | Zod 4 is stable (released 2025, latest 4.3.6); 14x faster than v3; subpath exports `zod/v4` enable coexistence if needed |
| `@hookform/resolvers` | 5.2.2 | Bridge between zod schemas and react-hook-form | v5.2.2 supports both Zod v3 and v4 with automatic runtime detection |
1. The `ChartContainer` may log `"width(-1) and height(-1) of chart should be greater than 0"` warnings — fix by adding `initialDimension={{ width: 320, height: 200 }}` to the `ResponsiveContainer` inside `chart.tsx`.
2. If TypeScript errors appear on `TooltipProps`, update the import to use `TooltipProps` from `recharts` directly.
3. Community-verified workaround exists in shadcn-ui/ui issue #9892.
**Zod v4 import note:** Use `import { z } from "zod"` (root export maps to v4) unless you need v3 compatibility, then use `import { z } from "zod/v4"` explicitly. The `zodResolver` from `@hookform/resolvers/zod` handles both transparently.
**Confidence: HIGH** — PR #8486 and issue #9892 are the authoritative sources; the fix is a small patch to one file.
**Known issue:** @hookform/resolvers 5.2.1+ has reported edge-case type errors with specific Zod v4 configurations (GitHub issue #813). Use `5.2.2` (published ~February 2026) which addresses this. If type errors appear, verify the import path is `@hookform/resolvers/zod` not a sub-subpath.
**Confidence: HIGH** — Versions verified via npm search results (react-hook-form 7.72.0 published April 2026; zod 4.3.6; @hookform/resolvers 5.2.2). Integration pattern is the standard shadcn/ui documented approach.
---
### Core Charting Patterns (Recharts 3.8.0)
### 2. Wizard/Stepper UI — Custom Component (No External Library)
No new charting libraries are needed. Recharts 3.8.0 is the current stable release and supports all required chart types natively. Three chart types are needed for the dashboard redesign:
shadcn/ui does not include a stepper or wizard component in its official core library. The discussion thread #1422 requesting it has been open for years. However, shadcn/ui's blocks library now includes stepper patterns (as of March 2026 update) built purely with shadcn/ui `Button`, `Badge`, and Tailwind — **no external npm package needed**.
**1. Donut Chart (expense category breakdown)**
**Recommendation: Build a custom `<WizardStepper>` component from shadcn/ui primitives.**
This approach:
- Requires zero new npm packages
- Matches the existing design system exactly (token-driven styling)
- Is 5080 lines of TypeScript — not complex
- Avoids third-party stepper library churn (none are dominant; most are abandoned within 1-2 years)
Pattern:
```tsx
// Already in use. Enrich by:
// - Increasing innerRadius to ~60, outerRadius to ~100 for visual weight
// - Adding paddingAngle={3} for visible segment separation
// - Using stroke="none" (replaces removed blendStroke in v3)
// - Rendering a center label via custom activeShape or absolute-positioned div
<PieChart>
<Pie
data={pieData}
dataKey="value"
cx="50%"
cy="50%"
innerRadius={60}
outerRadius={100}
paddingAngle={3}
stroke="none"
>
{pieData.map((entry) => (
<Cell key={entry.type} fill={categoryColors[entry.type]} />
))}
</Pie>
<Tooltip content={<ChartTooltipContent />} />
</PieChart>
```
// src/components/shared/WizardStepper.tsx
// Steps indicator: array of step objects → renders numbered circles + connecting lines
// Active step gets primary color; completed steps get checkmark icon
// Controlled via `currentStep: number` prop passed down from wizard page
Note: In Recharts v3, `Cell` is deprecated in favor of the `shape` prop and `activeShape`/`inactiveShape` are deprecated in favor of `shape`. Existing `Cell` usage still works; migration is not required for this milestone.
interface Step {
id: string
label: string
}
**2. Vertical Bar Chart (income budget vs actual)**
```tsx
<BarChart data={incomeData}>
<CartesianGrid vertical={false} strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis />
<Bar dataKey="budgeted" radius={[4, 4, 0, 0]} fill="var(--color-muted)" />
<Bar dataKey="actual" radius={[4, 4, 0, 0]} fill="var(--color-income)" />
<Tooltip content={<ChartTooltipContent />} />
</BarChart>
```
**3. Horizontal Bar Chart (spend by category type)**
```tsx
// layout="vertical" turns BarChart into a horizontal bar chart
<BarChart data={categoryData} layout="vertical">
<XAxis type="number" hide />
<YAxis type="category" dataKey="name" width={130} />
<Bar dataKey="budgeted" radius={[0, 4, 4, 0]} fill="var(--color-muted)" />
<Bar dataKey="actual" radius={[0, 4, 4, 0]} fill="var(--color-primary)" />
<Tooltip content={<ChartTooltipContent />} />
</BarChart>
```
**Confidence: HIGH** — All three patterns verified against Recharts official examples and docs.
---
### Tailwind CSS 4 Color System Patterns
The existing `index.css` is already correctly structured with `@theme inline`. The overhaul needs to extend it with:
**1. Richer category colors (more vibrant for charts)**
The current category colors are defined but conservative. For the rich visual style target, increase chroma:
```css
/* Recommended: bump chroma from ~0.14 to ~0.18+ for visual richness */
--color-income: oklch(0.68 0.19 145); /* vivid green */
--color-bill: oklch(0.65 0.19 25); /* vivid orange-red */
--color-variable-expense: oklch(0.70 0.18 55); /* vivid amber */
--color-debt: oklch(0.62 0.20 355); /* vivid rose */
--color-saving: oklch(0.68 0.18 220); /* vivid blue */
--color-investment: oklch(0.65 0.18 285); /* vivid purple */
```
**2. Semantic status tokens for budget comparison**
```css
--color-over-budget: oklch(0.62 0.20 25); /* red-orange for overspend */
--color-on-budget: oklch(0.68 0.19 145); /* green for on-track */
--color-budget-bar-bg: oklch(0.92 0.01 260); /* neutral track for progress bars */
```
**3. Dark theme token set**
The current CSS has no dark mode overrides. With `next-themes` v0.4.6 already installed, dark mode works by toggling `.dark` on `<html>`. Add a dark block:
```css
.dark {
@theme inline {
--color-background: oklch(0.13 0.02 260);
--color-foreground: oklch(0.95 0.005 260);
--color-card: oklch(0.18 0.02 260);
/* ...etc — mirror the light tokens with dark values */
}
interface WizardStepperProps {
steps: Step[]
currentStep: number // 0-based index
}
```
This is optional for the current milestone (desktop-first, dark mode not listed as a goal), but the token structure is already set up for it.
State management: hold `currentStep` in the wizard page component with `useState`. Each step's validation runs via `react-hook-form`'s `trigger(fieldNames)` before `setCurrentStep(n + 1)`.
**Confidence: HIGH**Tailwind CSS 4 `@theme inline` pattern verified against official Tailwind v4 docs.
**Confidence: HIGH**shadcn/ui blocks page confirms stepper patterns are available as copy-paste blocks with no external dependencies (verified March 2026). Zero external library is the correct choice.
---
### Typography Patterns
### 3. shadcn/ui Components to Add
Already uses Inter via `--font-sans`. No new font installations needed. Apply these patterns consistently:
The wizard needs two additional shadcn/ui components not currently installed:
| Pattern | CSS / Tailwind | Where to Use |
|---------|---------------|--------------|
| Tabular numbers | `tabular-nums` (already used in DashboardPage) | All currency amounts, percentages |
| Monospace amounts | `font-mono` | Dense data tables where column alignment matters |
| Numeric font features | `font-feature-settings: "tnum" 1` | When `tabular-nums` alone is insufficient |
| Large metric emphasis | `text-3xl font-bold tracking-tight` | Summary card primary values |
| Muted labels | `text-sm text-muted-foreground` | Section headers, stat labels |
| Component | Install Command | Purpose | Notes |
|-----------|----------------|---------|-------|
| `progress` | `npx shadcn@latest add progress` | Optional step progress bar within wizard header | Built on Radix UI Progress; already themed via CSS vars. Use if linear progress indicator preferred over dot/circle steps. |
| `checkbox` | `npx shadcn@latest add checkbox` | Select/deselect template items in wizard step | Built on Radix UI Checkbox; WAI-ARIA compliant. |
| `scroll-area` | `npx shadcn@latest add scroll-area` | Scrollable category library panel in budget view | Built on Radix UI ScrollArea; consistent cross-browser scrollbar styling. |
The codebase already uses `tabular-nums` on currency values — this is correct and should be applied everywhere financial numbers appear.
The existing `dialog.tsx`, `input.tsx`, `button.tsx`, `select.tsx`, `badge.tsx`, and `skeleton.tsx` are already present and sufficient for the wizard steps and inline library picker.
**Confidence: HIGH**Pattern matches current codebase and Shopify Polaris / Datawrapper typography standards.
**Confidence: HIGH**Verified against current component list in `src/components/ui/`.
---
### Layout Patterns
## Design Token Changes — Sharp Minimal Pastel System
**Summary card grid:**
No new packages are needed. All changes are CSS variable overrides in `src/index.css`.
```tsx
// 4 cards on desktop, 2x2 on tablet, stacked on mobile
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
### Border Radius — The Core Change
The v1.0 design feels "clunky and rounded" because `--radius: 0.625rem` (10px) is applied everywhere. The v2.0 "sharp minimal" direction requires:
```css
/* Sharp edges — change ONE token, affects all shadcn/ui components */
--radius: 0.125rem; /* 2px — sharp but not perfectly square */
/* Alternative: 0rem for fully square (more aggressive) */
```
**Chart row:**
This single change propagates through every shadcn/ui component because they all use `rounded-[var(--radius)]` or similar. No individual component changes needed.
```tsx
// Charts side-by-side on desktop, stacked on mobile
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
### Pastel Color Recalibration
The current category colors use L~0.55 (text-weight, too dark for fills and backgrounds). "Clear pastels" in a sharp minimal design system need a two-tier system:
- **Surface pastel** (card backgrounds, highlights): L~0.93-0.96, C~0.04-0.06
- **Accent pastel** (borders, tags, icons): L~0.75-0.80, C~0.10-0.12
- **Text** (labels, amounts): L~0.40-0.50, C~0.15-0.18 (existing values are correct for this)
```css
/* New: pastel surface colors for wizard step indicators, category cards */
--color-income-surface: oklch(0.95 0.04 155);
--color-bill-surface: oklch(0.95 0.04 25);
--color-variable-expense-surface: oklch(0.95 0.04 50);
--color-debt-surface: oklch(0.95 0.05 355);
--color-saving-surface: oklch(0.95 0.04 220);
--color-investment-surface: oklch(0.95 0.04 285);
/* New: accent pastel (for badges, step indicators, borders) */
--color-income-accent: oklch(0.80 0.10 155);
--color-bill-accent: oklch(0.80 0.10 25);
--color-variable-expense-accent: oklch(0.80 0.10 50);
--color-debt-accent: oklch(0.80 0.11 355);
--color-saving-accent: oklch(0.80 0.10 220);
--color-investment-accent: oklch(0.80 0.10 285);
```
**Collapsible category section:**
The existing text-weight category colors (`--color-income`, etc.) remain unchanged — they're already correct for text/icon usage and pass WCAG 4.5:1.
```tsx
// Using shadcn Accordion — one group per CategoryType
<Accordion type="multiple" defaultValue={["income", "bill"]}>
<AccordionItem value="income">
<AccordionTrigger>
{/* Summary row: label + budgeted + actual + delta */}
</AccordionTrigger>
<AccordionContent>
{/* Line item rows */}
</AccordionContent>
</AccordionItem>
</Accordion>
### Minimal Layout Tokens
```css
/* Reduce visual weight for card borders — sharp design reads better with subtle borders */
--color-border: oklch(0.90 0.008 260); /* slightly lighter than current 0.88 */
/* Tighter card padding via CSS custom property (used in PageShell / StatCard) */
/* No token needed — use Tailwind p-4 consistently instead of p-6 */
```
Use `type="multiple"` so users can expand multiple sections simultaneously. Default expand income and variable_expense as the most-checked categories.
**Confidence: HIGH** — Standard shadcn/ui pattern, verified against official docs.
**Confidence: HIGH** — Based on OKLCH perceptual uniformity properties; the lightness/chroma values follow the Evil Martians OKLCH guide for pastel palette design.
---
## What NOT to Use
## Backend Changes — Supabase (Auto-Budget Creation + Template Seeding)
### Auto-Budget Creation
The feature "auto-create monthly budgets from template on first visit" requires:
1. **A Supabase RPC function** (PostgreSQL function called via `.rpc()`) to atomically create a budget + copy template items in a single round-trip. Application-layer logic (JavaScript calling multiple inserts) is fragile across network failures.
```sql
-- New migration: create_budget_from_template(user_id, month_date)
-- Returns the new budget_id
-- Idempotent: if budget for that month already exists, returns existing id
create or replace function create_budget_from_template(
p_user_id uuid,
p_month date -- first day of the target month
)
returns uuid
language plpgsql
security definer -- needed to bypass RLS for the INSERT
as $$
declare
v_template_id uuid;
v_budget_id uuid;
begin
-- Get user's template
select id into v_template_id from templates where user_id = p_user_id limit 1;
if v_template_id is null then return null; end if;
-- Idempotency: return existing budget for this month
select id into v_budget_id
from budgets
where user_id = p_user_id
and start_date = date_trunc('month', p_month)::date
limit 1;
if v_budget_id is not null then return v_budget_id; end if;
-- Create new budget
insert into budgets (user_id, start_date, end_date, currency)
values (
p_user_id,
date_trunc('month', p_month)::date,
(date_trunc('month', p_month) + interval '1 month' - interval '1 day')::date,
(select currency from profiles where id = p_user_id limit 1)
)
returning id into v_budget_id;
-- Copy template items to budget items
insert into budget_items (budget_id, category_id, budgeted_amount, item_tier)
select v_budget_id, ti.category_id, ti.budgeted_amount, ti.item_tier
from template_items ti
where ti.template_id = v_template_id;
return v_budget_id;
end;
$$;
```
Frontend call:
```typescript
const { data: budgetId } = await supabase.rpc('create_budget_from_template', {
p_user_id: user.id,
p_month: `${year}-${month}-01`
})
```
**Why RPC not application layer:** A single RPC is atomic (no partial state if network drops mid-sequence), runs in 1 round-trip instead of 3-4, and the idempotency guard prevents duplicate budgets from double-calls (React StrictMode double-invocation, fast navigation, etc.).
### Template Seeding (Wizard First-Run)
The wizard "pre-filled common items" require a static list seeded client-side — no backend change needed. The wizard presents checkboxes for ~15 common items (Rent, Salary, Car Insurance, Groceries, etc.) with pre-populated amounts. On wizard completion, one batch `insert` creates the template + template_items. The existing `templates` and `template_items` tables support this without schema changes.
**Categories pre-seeding:** Categories (income, bill, variable_expense, etc.) are per-user, not system-wide. The wizard must also insert default categories before template items can reference them. Order: insert default categories → insert template → insert template_items.
This can also be an RPC (`setup_user_template`) or application-layer batch — the wizard runs once, so network failure risk is acceptable at client-side orchestration.
### Category Library (Inline Add-from-Library)
The `quick_add_items` table stores name + icon only — no amount or category_type. For the inline category library in budget view (replacing the QuickAdd page), the library needs category_type to know which budget section to add to.
**Schema addition needed:**
```sql
-- New migration: add category_type to quick_add_items
alter table quick_add_items
add column category_type category_type, -- existing enum
add column default_amount numeric(12,2) default 0;
```
This enables the library to show items grouped by type and pre-fill amounts when adding to a budget.
**Confidence: MEDIUM** — RPC pattern is well-established in Supabase. Schema addition is straightforward. The exact RPC SQL above is a starting point and may need adjustment based on profiles table structure (currency field). Flag for verification in planning phase.
---
## What NOT to Add
| Avoid | Why | Use Instead |
|-------|-----|-------------|
| Nivo | Adds a large bundle, different component API, requires adapting all existing chart code | Recharts 3.8.0 — already installed, sufficient |
| ApexCharts / ECharts | New library dependency, no benefit over Recharts for this scope | Recharts 3.8.0 |
| react-financial-charts | Designed for candlestick / OHLC trading charts, not budget dashboards | Recharts 3.8.0 |
| Recharts 2.x | Project is already on v3.8.0 — never downgrade | Stay on 3.8.0 |
| shadcn `npx shadcn@latest add` for chart without reading the output | The generated chart.tsx requires a manual Recharts v3 patch | Run the add command, then apply the `initialDimension` fix to `ChartContainer` |
| CSS-in-JS for theming | Tailwind v4 `@theme inline` already handles all theming via CSS variables | Extend `index.css` `@theme inline` block |
| Custom progress bar libraries | Raw Tailwind divs with `style={{ width: X% }}` are already used and are sufficient | Keep existing progress bar pattern, improve styling only |
| Framer Motion | Adds bundle weight; CSS transitions via `transition-all duration-200` cover needed animations | Tailwind transition utilities |
| React Grid Layout | Drag/resize dashboards are out of scope for this milestone | Standard CSS Grid |
| External stepper library (react-use-wizard, react-step-wizard, stepperize) | None is dominant; all add bundle weight for what is 50 lines of custom code; APIs change | Custom `<WizardStepper>` using shadcn/ui Button + Badge + Tailwind |
| Zod v3 (avoid if installing fresh) | v4 is stable and 14x faster; no reason to use v3 for new code | `zod@4.3.6` |
| Framer Motion for wizard step transitions | 28kb gzip; CSS `transition-opacity duration-200` is sufficient for step fade | Tailwind transition utilities |
| Recharts upgrade to 3.x in this milestone | 2.15.4 is working; v3 migration guide lists breaking changes that would require updating all existing charts; out of scope | Stay on 2.15.4 for v2.0 milestone; plan upgrade separately |
| CSS-in-JS for new design tokens | Tailwind v4 `@theme inline` in `index.css` already handles all theming | Extend `index.css` `@theme inline` block |
| Zustand for wizard state | TanStack Query + useState is already the state pattern in this app; wizard state is local and short-lived | `useState` in wizard page component |
| Supabase Edge Functions for auto-budget | PostgreSQL function (RPC) runs in the same DB transaction; simpler, no Deno runtime | Supabase RPC (pg function) |
---
@@ -236,10 +279,26 @@ Use `type="multiple"` so users can expand multiple sections simultaneously. Defa
| Recommended | Alternative | When to Use Alternative |
|-------------|-------------|-------------------------|
| Recharts 3.8.0 (stay) | Nivo | If you needed animated, visually opinionated charts with server-side rendering — not applicable here |
| shadcn Accordion | KendoReact PanelBar | If the project used KendoReact's broader component suite — it doesn't |
| Tailwind `tabular-nums` | Geist Mono font | Use Geist Mono only if building a dense trading-style table where column alignment is a core feature, not a budget dashboard |
| shadcn chart.tsx (copy-paste) | Direct Recharts usage | Acceptable — the project's existing dashboard already uses Recharts directly. shadcn wrappers add theme-aware tooltips and config-based colors but are not mandatory |
| Custom WizardStepper | `react-use-wizard` (npm) | If wizard logic were complex (branching paths, async steps with external dependencies) — this wizard is linear with simple validation |
| Zod 4 | Valibot | If bundle size were critical (Valibot is ~1kb vs Zod's ~14kb) — not a concern here |
| Supabase RPC for auto-budget | Application-layer multi-insert | Acceptable if you tolerate partial failure risk and handle retry logic — RPC is cleaner |
| Two-tier OKLCH pastel tokens | Single token set | If the design only needed chart colors — the wizard and library UI need surface pastels that the existing single-tier system doesn't provide |
---
## Installation
```bash
# Wizard form validation (new packages)
bun add react-hook-form@7.72.0 zod@4.3.6 @hookform/resolvers@5.2.2
# New shadcn/ui components
npx shadcn@latest add progress
npx shadcn@latest add checkbox
npx shadcn@latest add scroll-area
```
No other npm/bun installs needed. All other new functionality (wizard stepper UI, design token changes, Supabase RPC, schema migration) is implemented via local code and SQL.
---
@@ -247,43 +306,59 @@ Use `type="multiple"` so users can expand multiple sections simultaneously. Defa
| Package | Version | Compatible With | Notes |
|---------|---------|-----------------|-------|
| Recharts | 3.8.0 | React 19 | Requires `react-is` peer dependency override for React 19 |
| shadcn chart.tsx | CLI generated | Recharts 3.8.0 | Apply `initialDimension` fix to `ChartContainer` after generation |
| Tailwind CSS | 4.2.1 | `@theme inline` | Use `@theme inline` (not bare `@theme`) when referencing other CSS vars |
| next-themes | 0.4.6 | React 19 | Compatible; dark mode toggled via `.dark` class on `<html>` |
| radix-ui | 1.4.3 | Post-June 2025 migration | shadcn CLI add commands now generate imports from `radix-ui`, not `@radix-ui/react-*` |
| react-hook-form | 7.72.0 | React 19 | Fully compatible; hooks-based, no legacy API |
| zod | 4.3.6 | TypeScript ~5.9.3 | Requires TypeScript 4.5+; project is on 5.9.3 — fine |
| @hookform/resolvers | 5.2.2 | react-hook-form 7.x + zod 4.x | Automatic v3/v4 Zod detection |
| Recharts | 2.15.4 | React 19 | Stays on v2; DO NOT upgrade in this milestone |
| Tailwind CSS | 4.2.1 | `@theme inline` | Sharp radius via `--radius: 0.125rem` in `@theme inline` block |
| radix-ui | 1.4.3 | shadcn new-york style | New shadcn add commands generate `radix-ui` imports (unified package), not `@radix-ui/*` |
---
## Installation
## Integration Points
```bash
# Add shadcn chart primitives (then apply Recharts v3 fix to chart.tsx)
npx shadcn@latest add chart
### Wizard → Template → Budget Flow
# Add Accordion for collapsible dashboard sections
npx shadcn@latest add accordion
```
WizardPage (new route: /setup)
└─ react-hook-form (FormProvider wrapping all steps)
└─ WizardStepper component (step indicator)
└─ Step 1: Pick categories (checkbox + default amounts)
└─ Step 2: Adjust fixed items (input fields, pre-filled)
└─ Step 3: Adjust variable items
└─ Step 4: Review + confirm
└─ onSubmit → batch insert categories + template + template_items
└─ redirect to /dashboard
# Add Collapsible if single-section toggles are needed
npx shadcn@latest add collapsible
DashboardPage (existing)
└─ on mount: check if budget exists for current month
└─ if not: call supabase.rpc('create_budget_from_template', { month })
└─ render budget data (existing pattern, improved display)
BudgetDetailPage (existing, enhanced)
└─ inline category library panel (uses scroll-area + checkbox/button)
└─ add one-off items directly from library
```
No npm/bun package installs needed — Recharts 3.8.0 is already installed and sufficient.
### Design Token Change Impact
The `--radius` change in `index.css` requires no component-level changes — all shadcn/ui components use the token automatically. The new surface/accent OKLCH tokens need to be applied explicitly in new components (wizard steps, category library cards); existing components are unaffected.
---
## Sources
- [Recharts GitHub Releases](https://github.com/recharts/recharts/releases) — version 3.8.0 confirmed latest stable (March 2025)
- [Recharts 3.0 Migration Guide](https://github.com/recharts/recharts/wiki/3.0-migration-guide) — breaking changes from v2 to v3
- [shadcn/ui Chart Docs](https://ui.shadcn.com/docs/components/chart) — ChartContainer, ChartConfig, ChartTooltip patterns
- [shadcn-ui/ui PR #8486](https://github.com/shadcn-ui/ui/pull/8486) — Recharts v3 chart.tsx upgrade (open as of March 2026)
- [shadcn-ui/ui Issue #9892](https://github.com/shadcn-ui/ui/issues/9892) — Community-verified Recharts v3 chart.tsx fix
- [shadcn/ui Accordion Docs](https://ui.shadcn.com/docs/components/radix/accordion) — component API verified
- [Tailwind CSS v4 Theme Docs](https://tailwindcss.com/docs/theme) — `@theme inline`, CSS variables, OKLCH palette
- [npm recharts](https://www.npmjs.com/package/recharts) — 3.8.0 current, 7M weekly downloads, healthy maintenance
- npm search results (April 2026) — react-hook-form 7.72.0, zod 4.3.6, @hookform/resolvers 5.2.2
- [zod.dev/v4](https://zod.dev/v4) — Zod 4 stable release notes, versioning strategy
- [shadcn/ui blocks page](https://ui.shadcn.com/blocks) — Confirmed no native stepper component; patterns available as copy-paste blocks (no npm dep)
- [shadcn-ui/ui Discussion #1422](https://github.com/shadcn-ui/ui/discussions/1422) — Feature request for stepper (still open as of April 2026)
- [react-hook-form/resolvers GitHub](https://github.com/react-hook-form/resolvers/releases) — v5.2.2 Zod v4 support
- [github.com/recharts/recharts/wiki/3.0-migration-guide](https://github.com/recharts/recharts/wiki/3.0-migration-guide) — v3 breaking changes confirming upgrade is out of scope for this milestone
- [evilmartians.com — Better dynamic themes with OKLCH](https://evilmartians.com/chronicles/better-dynamic-themes-in-tailwind-with-oklch-color-magic) — OKLCH lightness/chroma guidance for pastel systems
- `package.json` in project root — authoritative source for actual installed versions (Recharts 2.15.4, not 3.x as prior research stated)
- `supabase/migrations/` — authoritative source confirming Supabase backend, existing schema
---
*Stack research for: SimpleFinanceDash UI Overhaul*
*Researched: 2026-03-16*
*Stack research for: SimpleFinanceDash v2.0 — Wizard Setup, Auto-Budget, Sharp Pastel Design*
*Researched: 2026-04-02*

View File

@@ -1,200 +1,183 @@
# Project Research Summary
**Project:** SimpleFinanceDash — UI/UX Overhaul Milestone
**Domain:** Personal finance budget dashboard (React SPA, UI-only redesign)
**Researched:** 2026-03-16
**Project:** SimpleFinanceDash v2.0 — Wizard Setup, Auto-Budget Creation, Sharp Pastel Design
**Domain:** Personal finance dashboard React SPA with Supabase backend
**Researched:** 2026-04-02
**Confidence:** HIGH
## Executive Summary
This milestone is a pure UI/UX overhaul of an existing working application. The backend (Supabase schema, hooks, queries) is frozen. The stack is already in place — React 19, Vite 8, Tailwind CSS 4, Recharts 3.8.0, shadcn/ui, TanStack Query — and no new framework dependencies are needed. The overhaul adds three shadcn/ui primitives (`chart`, `accordion`/`collapsible`), extends the existing OKLCH color system, and introduces a structured component hierarchy for the dashboard. The core transformation is from a flat single-chart dashboard to a rich hybrid layout: summary KPI cards, three chart types (donut, vertical bar, horizontal bar), and collapsible per-category line-item sections.
SimpleFinanceDash v2.0 is a UX simplification milestone on top of a fully working v1.0 app. All data infrastructure already exists — categories, templates, budget generation, charts, collapsible sections. The central problem is cognitive: new users land on a blank dashboard with no guidance, monthly budget creation requires a manual trigger, and the Quick Add feature lives on a disconnected page. The recommended approach is a three-part simplification: (1) a 3-step first-run wizard that seeds a usable template from curated defaults, (2) automatic monthly budget creation on dashboard visit when a template is populated, and (3) inline item-adding directly from the budget view to replace the isolated Quick Add page. Paired with a design system token rework (sharp radius, clearer pastels), these changes transform the app from a data entry tool into a coherent, guided experience.
The recommended approach is to establish design foundations first (tokens, shared components, build order primitives) before touching any page. Every visual decision — color, spacing, card style — must originate from `index.css` `@theme inline` tokens and a small set of shared components (`PageShell`, `StatCard`, `CategorySection`). Without this discipline, a multi-page overhaul will produce "island redesign" inconsistency: each page looks polished individually but the app feels fragmented during navigation. The dashboard phase comes second, followed by extending the design system to all remaining pages.
The stack is locked and healthy. The only new dependencies are react-hook-form 7.72.0, zod 4.3.6, and @hookform/resolvers 5.2.2 for multi-step form validation in the wizard. Three additional shadcn/ui components are needed (progress, checkbox, scroll-area). All other work — the wizard stepper UI, design token changes, auto-budget triggering — is implemented through local code changes and SQL with no additional packages. Critically, no new DB migrations are required for features: all wizard and auto-budget writes go to existing `categories`, `template_items`, `budgets`, and `budget_items` tables via existing hooks and mutations. Two DB constraint migrations are required for safety (unique constraint on `budgets(user_id, start_date)` and `categories(user_id, name)`), and a one-time migration to set `profiles.setup_completed = true` for existing v1.0 users.
The highest-risk technical area is the Recharts + shadcn `chart.tsx` integration: the official shadcn PR for Recharts v3 is not yet merged, so the generated `chart.tsx` requires a known manual patch (add `initialDimension` to `ResponsiveContainer`). A close second risk is collapsible section layout shift — Recharts `ResponsiveContainer` instances react to parent height changes, and multiple instances on one page require `debounce={50}` and Radix `Collapsible` (not raw `display:none` toggle) to prevent ResizeObserver cascade errors. Both risks have documented fixes and are LOW recovery cost if addressed proactively.
---
The primary risks are concurrency-related and data-integrity-related, not technical. Auto-budget creation via a client-side `useEffect` can fire multiple times (React StrictMode double-invocation, multi-tab, fast navigation), producing duplicate budget rows without a DB-level unique constraint. The wizard completion sequence is non-idempotent without explicit guards — a re-run creates duplicate categories and template items. The design token rework is a third systemic risk: changing global CSS variables (`--radius`, OKLCH color tokens) affects all 9 existing pages simultaneously. All three risks have clear, low-cost mitigations that must be applied before the relevant features ship, not after.
## Key Findings
### Recommended Stack
The stack is locked; no new npm packages are required. Three shadcn/ui components must be installed via CLI: `chart` (Recharts theme-aware wrappers), `collapsible` (Radix primitive for category sections), and optionally `accordion`. After running `npx shadcn@latest add chart`, a manual one-line fix to `chart.tsx` is required: add `initialDimension={{ width: 320, height: 200 }}` to the inner `ResponsiveContainer` (see shadcn-ui/ui issue #9892). The existing OKLCH color palette in `index.css` needs only two additions: richer chroma on category colors (bump from ~0.14 to ~0.18+) and semantic status tokens (`--color-over-budget`, `--color-on-budget`, `--color-budget-bar-bg`).
The project runs on React 19 + Vite 8 + TypeScript 5.9 + Tailwind CSS 4 + Recharts 2.15.4 + TanStack Query v5 + Supabase (PostgreSQL + Auth + RLS). These versions are locked and must not be changed in this milestone. Note: prior research incorrectly listed Recharts 3.x — the actual installed version is 2.15.4 per `package.json`, and upgrading to v3 is explicitly out of scope due to breaking changes. The backend is Supabase, not a Go service — there is no Go source code in the repository.
**Core technologies and their roles for this milestone:**
- **Recharts 3.8.0** — all three chart types (donut, bar, horizontal bar) are supported natively; stay on current version, do not introduce alternative chart libraries
- **shadcn `chart.tsx`** — `ChartContainer` + `ChartTooltipContent` wrappers provide CSS-variable-aware theming for all Recharts instances; required patch documented in issue #9892
- **shadcn `Collapsible`** — Radix UI primitive that animates height via CSS custom property `--radix-collapsible-content-height`; the correct tool for per-category collapsible sections
- **Tailwind CSS 4 `@theme inline`** — single source of truth for all color tokens; all component color values must reference CSS variables, never hardcoded hex
- **`useMemo` in DashboardContent** — all chart data derivations must be memoized centrally; child chart components receive pre-computed data arrays and render only
**Critical version note:** Recharts 3 deprecated `Cell` in favor of `shape` prop, and removed `blendStroke` — use `stroke="none"` instead. Existing `Cell` usage still works but should not be extended.
**Core technologies (new additions only):**
- `react-hook-form 7.72.0` + `zod 4.3.6` + `@hookform/resolvers 5.2.2` — multi-step wizard form validation; industry standard, 9.3kb bundle, handles per-step validation before advancing
- `shadcn checkbox`, `progress`, `scroll-area` — three new shadcn components needed for wizard and inline add panel
- Custom `<WizardStepper>` built from shadcn/ui `Button` + `Badge` + Tailwind — no external stepper library; none are dominant and all add bundle weight for 50 lines of local code
- OKLCH two-tier pastel token system in `src/index.css` — surface tokens at L~0.95 for backgrounds, accent tokens at L~0.80 for borders/badges, existing text tokens at L~0.55 unchanged
### Expected Features
Research grounded in competitor analysis (YNAB, Empower) and fintech UX standards. The full feature list lives in `FEATURES.md`.
**Must have (table stakes — v2.0 launch):**
- 3-step first-run wizard: income → common items (pre-filled, editable, with live running balance) → review — skippable per step and as a whole
- Pre-seeded library of ~15-20 curated items grouped by category type with static sensible default amounts
- Auto-create current month's budget from template on dashboard visit — silent, no manual trigger
- First-creation toast notification only ("Your April budget was created from your template"); silent for all subsequent months
- Inline add-from-library on budget view as a shadcn Sheet panel — replaces the standalone Quick Add page
- Quick Add removed from sidebar navigation; route kept with redirect to `/budgets`
- Dashboard summary cards correctly reflecting current month budget data
- Empty state CTAs for: empty template page, empty dashboard, empty budget view
**Must have (table stakes — users expect these):**
- Summary KPI cards (income / expenses / balance) with colored semantics and variance badges
- Donut chart with center total label and active hover expand
- Horizontal bar chart: budget vs actual per category type
- Grouped bar chart: income budgeted vs actual
- Collapsible per-category sections with line items and group totals
- Skeleton loading states that mirror the real layout structure
- Month navigation control on the dashboard (currently locked to current month)
- Consistent design language across all pages — the dashboard sets the pattern, all other pages must inherit it
**Should have (competitive differentiators — v2.x):**
- "Edit template" shortcut link from budget view for quick access to change recurring items
- Persistent "this month" summary widget on the dashboard sidebar
- "Complete setup" banner for users who skipped the wizard but have an empty template
- Running balance updating live during wizard item selection (income minus sum of selected items; frontend computation only)
**Should have (differentiators, high value for low cost):**
- Variance indicators (delta arrows/badges) on summary cards and section headers
- Accent-colored category section borders (`border-l-4` with category CSS variable)
- Empty state with actionable CTA for new months
- Carryover amount surfaced on the dashboard balance card
- Section collapse state preserved in localStorage (P3 polish)
**Defer to v2+:**
- Trend / multi-month charts — requires new query shape and chart layout; explicitly out of scope
- Dark mode — OKLCH infrastructure is ready but requires full contrast audit; doubles testing surface
- AI-derived insights — backend dependency; no scope here
- Drag-to-reorder categories — requires `sort_order` mutation support
**Defer (v3+):**
- AI-suggested amounts based on spending history — requires historical data and ML infrastructure; static defaults are sufficient
- CSV/bank import for actuals — already noted as a future feature in PROJECT.md
- Mandatory wizard / forced onboarding — explicitly an anti-feature; skippable is always correct
- Complex 6+ step wizard — drop-off increases sharply beyond step 3; confirmed by YNAB's own Oct 2025 update to shorten their onboarding
### Architecture Approach
The existing three-tier architecture (Pages → Hooks → Supabase) is preserved intact. The overhaul introduces a **View Components layer** that sits between pages and shadcn/ui primitives, and a small **Shared Components layer** for cross-page patterns. Hooks and library files are read-only during this milestone; all computation lives in the presentation layer via `useMemo`.
The v2.0 architecture is additive, not structural. A new `WizardRoute` guard wraps the existing `ProtectedRoute` subtree in `App.tsx`. A new `/setup` route renders `SetupWizardPage` as a dedicated page (not a modal overlay — dedicated URL prevents broken refresh/back behavior). The wizard completes by writing to existing tables via existing hooks. Auto-budget creation is a `useEffect` trigger added to `DashboardPage` that calls the already-existing `generateFromTemplate` mutation. Inline add replaces `QuickAddPicker` with a new `AddOneOffSheet` component at both call sites. Dashboard simplification removes the 3-column chart grid from `DashboardContent` (charts stay in the codebase but are removed from the Dashboard layout). All existing hooks and mutations (`useBudgets.ts`, `useTemplate.ts`, `useCategories.ts`, etc.) are read-only for this milestone.
**New components and their responsibilities:**
**New files:**
1. `src/hooks/useFirstRunState.ts` — detects first-run: `categories.length === 0 OR template_items.length === 0`
2. `src/data/presets.ts` — static preset category list with suggested amounts (compile-time data, no DB table)
3. `src/pages/SetupWizardPage.tsx` — 3-step wizard, local `useState` only, localStorage persistence
4. `src/components/wizard/WizardStep.tsx`, `CategoryDefaults.tsx`, `TemplateDefaults.tsx` — wizard UI pieces
5. `src/components/budget/AddOneOffSheet.tsx` — Sheet-based one-off item adder (replaces QuickAddPicker)
| Component | Location | Responsibility |
|-----------|----------|----------------|
| `DashboardContent` | `components/dashboard/` | Orchestrator: owns `useMemo` derivations, passes typed props to all children |
| `SummaryStrip` + `StatCard` | `components/dashboard/` | KPI cards row with semantic color and variance badge |
| `ChartPanel` | `components/dashboard/` | Two-column responsive grid containing all three chart instances |
| `IncomeBarChart` | `components/dashboard/` | Budgeted vs actual income vertical bar, wrapped in `ChartContainer` |
| `ExpenseDonutChart` | `components/dashboard/` | Expense breakdown donut with center total and custom legend |
| `SpendBarChart` | `components/dashboard/` | Horizontal budget vs actual by category type |
| `CategorySection` | `components/dashboard/` | Radix `Collapsible` wrapping header row + `BudgetLineItems` |
| `BudgetLineItems` | `components/dashboard/` | Line-item table reusing existing `InlineEditCell` / `DifferenceCell` atoms |
| `PageShell` | `components/shared/` | Cross-page consistent header with title, optional description, CTA slot |
**Build order is strictly dependency-driven** (see Architecture section for full sequence): install shadcn primitives first, then `PageShell` and `StatCard`, then chart components, then `CategorySection`, then `DashboardContent` as final orchestrator, then all remaining page refreshes.
**Modified files:** `src/App.tsx`, `src/components/AppLayout.tsx`, `src/pages/DashboardPage.tsx`, `src/pages/BudgetDetailPage.tsx`, `src/index.css`, `src/i18n/en.json`, `src/i18n/de.json`
### Critical Pitfalls
All six pitfalls in `PITFALLS.md` are rated HIGH confidence with verified fixes. The top five to actively prevent:
1. **Duplicate budget creation on concurrent auto-create** — Add `UNIQUE (user_id, start_date)` constraint to `budgets` table via migration AND use `INSERT ... ON CONFLICT DO NOTHING` in `generateFromTemplate` before any auto-create code ships. Use a `useRef(false)` guard in the `useEffect` to prevent double-fire from React StrictMode.
1. **Unmemoized chart data triggers triple re-renders** — every `items.filter().reduce()` in `DashboardContent` must be wrapped in `useMemo`. Adding three chart instances to a non-memoized render body multiplies re-render cost 3x and causes tooltip hover lag. Recovery cost is LOW but disrupts delivered work if caught late.
2. **Wizard creates duplicate categories on re-run** — Add `UNIQUE (user_id, name)` constraint to `categories` table; use upsert for category creation. Add `profiles.setup_completed` boolean; set to `true` in `onSuccess` only. Write a migration to backfill `setup_completed = true` for all v1.0 users with existing template items before shipping.
2. **shadcn `chart.tsx` incompatibility with Recharts 3** — the generated `chart.tsx` from `npx shadcn@latest add chart` will produce `width(-1) and height(-1)` warnings and potential layout failures. Apply the `initialDimension` fix to `ChartContainer` immediately after generation. This is a one-line fix with a documented workaround (issue #9892), but if skipped it causes all charts to silently render at zero dimensions.
3. **Design token rework breaks all 9 pages silently** — Token changes must be one isolated commit followed immediately by a full visual regression pass on all pages before any component code is touched. Never mix token changes and component changes in the same commit.
3. **Collapsible sections trigger ResizeObserver cascade on charts** — using `display:none` toggle or raw `height` animation on category sections causes Recharts `ResponsiveContainer` instances above/below to rapidly resize. Fix: use Radix `Collapsible` with CSS `@keyframes` on `--radix-collapsible-content-height`, and add `debounce={50}` to all `ResponsiveContainer` instances.
4. **Auto-budget defaults to wrong currency** — The `generateFromTemplate` mutation defaults to `"EUR"`. Auto-create must read `profile.currency` first and chain via TanStack Query's `enabled` flag: only auto-create after both the budgets list and user profile are loaded.
4. **Color accessibility regression during "rich visual" overhaul** — the redesign goal of rich colors is a direct risk factor for WCAG contrast failures. The existing `text-green-600` / `text-red-600` pattern must be audited (green-600 is borderline). All six category pie slice colors cluster at similar OKLCH lightness (~0.650.72) — vary lightness as well as hue. Supplement color with icons for status indicators; color alone is never sufficient.
5. **i18n key regressions**`i18next` silently falls back to English when German keys are missing (`fallbackLng: 'en'`). Every new UI text key must be added to both `en.json` and `de.json` in the same commit. Run `i18next-scanner` or manually switch to German locale before marking any phase complete.
**Sixth pitfall to prevent at the outset:** Design inconsistency across page refreshes. If shared components (`StatCard`, `CategorySection` header pattern, card border accents) are not extracted before page work begins, each page will develop subtle visual drift that is expensive to correct retroactively.
---
5. **Wizard state lost on browser refresh** — Persist wizard state to `localStorage` keyed by `wizard_state_${userId}` on every step change; read on mount; clear on completion or skip. Use URL search params (`?step=2`) for browser back/forward support.
## Implications for Roadmap
Research points to a clear four-phase structure. The ordering is driven by: (1) the build dependency chain in ARCHITECTURE.md, (2) the "design foundation before page work" principle from PITFALLS.md, and (3) the feature dependency graph in FEATURES.md.
Research points to a clear five-phase structure derived from the dependency chain in ARCHITECTURE.md, the feature dependency graph in FEATURES.md, and the phase-to-pitfall mapping in PITFALLS.md.
### Phase 1: Design Foundation and Primitives
**Rationale:** Multiple pitfalls converge on the same root cause — design tokens and shared components must exist before any page work begins. Design drift (Pitfall 6) and color accessibility failures (Pitfall 4) both require the palette and shared component abstractions to be established first. This phase has no external dependencies and produces the building blocks every subsequent phase consumes.
**Delivers:** Extended `index.css` color tokens (richer chroma, semantic status tokens), installed shadcn primitives (`chart.tsx` with Recharts v3 patch applied, `collapsible.tsx`), `PageShell`, `StatCard` / `SummaryStrip` components.
**Addresses:** Summary KPI cards (table stakes), accent-colored category borders, semantic color system, skeleton components
**Avoids:** Design inconsistency pitfall, color accessibility regression, CSS variable scope issues
**Research flag:** Standard patternsno additional research needed. Tailwind v4 `@theme inline` and WCAG contrast requirements are well-documented.
### Phase 1: Design System Token Rework
**Rationale:** Token changes cascade globally to all 9 existing pages. This must land first, in isolation, establishing the visual baseline before any page component is built or modified. Mixing token changes with component changes makes regressions impossible to attribute.
**Delivers:** `--radius: 0.125rem` (sharp edges), refined OKLCH pastel surface/accent tokens, warmer background, softer border — applied in `src/index.css` only, zero component-file changes.
**Addresses:** Sharp minimal aesthetic direction; OKLCH two-tier pastel system for category colors
**Avoids:** Pitfall 3 (token rework breaks pages silently) — full visual pass on all 9 pages is the acceptance criterion before this phase closes.
**Research flag:** Standard pattern — CSS custom property overrides in Tailwind v4 `@theme inline` are fully documented. No deeper research needed.
### Phase 2: Dashboard Charts and Layout
**Rationale:** Charts depend on `chart.tsx` from Phase 1. The dashboard is the highest-value page and establishes the full visual language for all subsequent pages. Month navigation must be included here (not deferred) because it changes how `DashboardContent` holds state — retrofitting it after collapsible sections are built is more disruptive than including it upfront.
**Delivers:** `DashboardContent` orchestrator with `useMemo` data derivations, `ChartPanel` with all three chart types (`IncomeBarChart`, `ExpenseDonutChart`, `SpendBarChart`), month navigation control, skeleton loading for charts and cards.
**Addresses:** Donut chart (table stakes), horizontal bar chart (P1), grouped income bar chart (P1), skeleton loading (P1), month navigation (P1)
**Avoids:** Unmemoized chart data pitfall (use `useMemo` from the start), `chart.tsx` Recharts v3 patch (apply in Phase 1 before this phase begins)
**Research flag:** Standard patterns — Recharts 3.8.0 chart implementations are fully documented. The specific `chart.tsx` fix is documented in issue #9892.
### Phase 2: Preset Data, First-Run Detection, and DB Safety Constraints
**Rationale:** Both the wizard and auto-budget creation depend on knowing whether this is a first-run user and on DB constraints that prevent duplicate data. Static data and detection hook have no UI dependencies and can be built and tested in isolation. The DB constraints must exist before any write mutations are triggered.
**Delivers:** `src/data/presets.ts`, `src/hooks/useFirstRunState.ts`, DB migration for `UNIQUE (user_id, start_date)` on `budgets`, DB migration for `UNIQUE (user_id, name)` on `categories`, DB migration for `profiles.setup_completed` flag with backfill for v1.0 users.
**Addresses:** Accurate first-run detection; protection against duplicate data at the DB layer
**Avoids:** Pitfall 1 (duplicate budgets), Pitfall 6 (duplicate categories), Pitfall 8 (first-run gate triggers for existing users)
**Research flag:** Standard pattern. The `setup_completed` backfill migration needs a SQL audit of the `profiles` table structure before writing — low-effort verification.
### Phase 3: Collapsible Dashboard Sections
**Rationale:** `CategorySection` depends on `Collapsible` primitive (Phase 1) and `BudgetLineItems` (which reuses existing `InlineEditCell` atoms). This phase brings the dashboard to full feature completeness. Separating it from Phase 2 keeps each phase focused and ensures chart layout is stable before section collapse animations interact with chart resize behavior.
**Delivers:** `CategorySection` components with Radix `Collapsible`, `BudgetLineItems` table, group totals row, variance indicators in section headers, carryover amount on balance card.
**Addresses:** Collapsible sections with line items (P1), totals per section (table stakes), variance indicators (P2), carryover amount (P2)
**Avoids:** Collapsible layout shift pitfall — use Radix `Collapsible` with CSS keyframe animation and `debounce={50}` on all `ResponsiveContainer` instances; never `display:none` toggle
**Research flag:** Standard patterns — Radix Collapsible API is well-documented. The `--radix-collapsible-content-height` animation pattern is the established approach.
### Phase 3: Setup Wizard
**Rationale:** Depends on Phase 2 (presets data, first-run hook, DB constraints). The wizard is the core new-user experience. Building it after the data layer and constraints ensures the completion flow has correct idempotency guards from the start rather than retrofitting them later.
**Delivers:** `/setup` route, `SetupWizardPage` (3 steps: income → items → review), wizard components, `WizardRoute` guard in `App.tsx`, localStorage state persistence, bilingual i18n keys for all wizard text.
**Addresses:** Wizard-style first-run setup, pre-filled category items, skippable steps, running balance display
**Avoids:** Pitfall 2 (wizard state lost on refresh) and Pitfall 6 (duplicate categories on re-run via idempotency guards)
**Uses:** `react-hook-form` + `zod` + `@hookform/resolvers` (new dependencies), `checkbox` shadcn component
**Research flag:** `react-hook-form` + `zod` integration is the standard shadcn/ui documented form pattern. Custom `WizardStepper` using shadcn primitives is a copy-paste block. No deeper research needed.
### Phase 4: Full-App Design Consistency
**Rationale:** The dashboard establishes the design token application patterns. All other pages inherit from it. This phase is sequenced last because it depends on `PageShell` and the card/color patterns being proven on the dashboard first. FEATURES.md dependency graph makes this explicit: "all-pages redesign depends on dashboard being finished first."
**Delivers:** `PageShell` applied to all 9 pages, consistent card/color/typography treatment on `BudgetDetailPage` (highest urgency — users navigate here directly from dashboard), `BudgetListPage`, `CategoriesPage`, `TemplatePage`, `LoginPage`, `RegisterPage`, `QuickAddPage`, `SettingsPage`. Empty state pattern for new months.
**Addresses:** Consistent design language (table stakes), BudgetDetailPage polish (P1), remaining page polish (P2), empty states (P2)
**Avoids:** i18n key regressionsswitch to German locale and run key parity check before completing each sub-page
**Research flag:** Standard patterns — `PageShell` wrapper is straightforward. The main risk is thoroughness (9 pages), not technical complexity.
### Phase 4: Auto-Budget Creation
**Rationale:** Depends on Phase 3 — a populated template must be possible before auto-creation is meaningful. Also depends on Phase 2 DB constraints being in place. The profile currency dependency must be resolved here, not deferred.
**Delivers:** Auto-create `useEffect` in `DashboardPage` (with `useRef` guard), profile currency read (verify `profiles` table schema), upsert-based budget creation, first-creation toast notification via `sonner`.
**Addresses:** Auto-created budget on first month visit, correct currency denomination for all users, silent creation for all subsequent months
**Avoids:** Pitfall 1 (concurrent duplicate creation — DB constraint + ON CONFLICT guard) and Pitfall 5 (wrong currency — profile dependency resolved before mutation fires)
**Research flag:** Verify the `profiles` table schema for the currency column name before writing the auto-create code. STACK.md flags this as needing confirmation. Low-effort: check `supabase/migrations/` directly.
### Phase 5: Inline Add-from-Library and Dashboard Simplification
**Rationale:** Depends on Phase 4 — inline add is only meaningful when a budget exists for the current month. Dashboard simplification (removing the chart grid) is deferred until auto-creation is working so there is no regression window where the dashboard shows only empty state. Quick Add deprecation with redirect belongs in the same phase as the replacement being functional.
**Delivers:** `AddOneOffSheet` component replacing `QuickAddPicker` at both call sites, removal of QuickAdd from sidebar nav, redirect from `/quick-add` to `/budgets`, removal of 3-column chart grid from `DashboardContent`, `scroll-area` shadcn component.
**Addresses:** Inline add-from-library on budget view, Quick Add page consolidation, dashboard "at a glance" simplification, empty state for removed chart area
**Avoids:** Pitfall 4 (Quick Add removal breaks nav/bookmarks — redirect added in same commit as nav removal)
**Research flag:** Standard component replacement pattern. No deeper research needed.
### Phase Ordering Rationale
- **Foundation before features:** Pitfall 6 (design inconsistency) has a HIGH recovery cost. Establishing `index.css` tokens and shared components in Phase 1 prevents the most expensive failure mode.
- **Dashboard before other pages:** FEATURES.md dependency graph is explicit — the dashboard establishes the patterns all pages inherit. Building it second (after foundation) lets Phase 4 apply proven patterns.
- **Charts before collapsibles:** `ChartPanel` layout must be stable before collapsible sections are added beneath it. The ResizeObserver pitfall (Pitfall 3) is easiest to test and fix when charts are the only moving part.
- **Sections in their own phase:** The collapsible + ResizeObserver interaction is the trickiest technical integration. Isolating it in Phase 3 limits blast radius if issues arise.
- **Tokens first** because they are global-scope — any token change touches all pages. Establishing them before page work begins means every page built afterward is already on the correct visual foundation.
- **Data + constraints before UI** because the wizard's correctness depends on DB-level deduplication and accurate first-run detection. Building the wizard UI first and adding guards later is the most common cause of data corruption in this pattern.
- **Wizard before auto-budget** because auto-budget is only meaningful when there is a template to generate from. The wizard is the mechanism that creates the template. E2E testing of auto-budget requires a wizard-populated template.
- **Auto-budget before inline add** because inline add requires a current-month budget to exist. The auto-creation flow provides that guarantee.
- This ordering satisfies all 9 pitfall prevention phases documented in PITFALLS.md.
### Research Flags
Phases with standard, well-documented patterns (skip `/gsd:research-phase`):
- **Phase 1:** Tailwind v4 `@theme inline`, OKLCH color tokens, and WCAG contrast requirements are all from official documentation with no ambiguity.
- **Phase 2:** Recharts 3.8.0 chart implementations and the `chart.tsx` fix are fully documented. Month navigation via `useBudgets` hook is a straightforward state change in `DashboardContent`.
- **Phase 3:** Radix Collapsible primitive is well-documented. The animation pattern with `--radix-collapsible-content-height` is the standard approach.
- **Phase 4:** `PageShell` application and page-by-page refresh are repetitive pattern application, not novel implementation.
Phases needing specific verification at planning time:
- **Phase 4 (Auto-Budget Creation):** Verify the `profiles` table schema — specifically the `currency` column name and whether `useProfile` or `useAuth` is the correct hook to read it from. STACK.md flags this as a "verify in planning" item. Action: check `supabase/migrations/001_profiles.sql` before writing the auto-create spec.
No phases require pre-execution research. All major decisions are resolved by this research.
---
Phases with standard patterns (skip research-phase):
- **Phase 1:** Tailwind v4 `@theme inline` and OKLCH token overrides — fully documented, established pattern in this codebase.
- **Phase 2:** Static data file, boolean flag migration, unique constraint migrations — no novel patterns.
- **Phase 3:** `react-hook-form` + `zod` is the standard shadcn/ui form pattern; wizard stepper is a shadcn/ui blocks copy-paste.
- **Phase 5:** Component replacement using existing hooks and shadcn Sheet — established pattern within this codebase.
## Confidence Assessment
| Area | Confidence | Notes |
|------|------------|-------|
| Stack | HIGH | Stack is locked and fully inspected. The one uncertainty (shadcn `chart.tsx` + Recharts v3 compatibility) has a documented fix in issue #9892. |
| Features | HIGH | Grounded in competitor analysis (YNAB, Empower) and fintech UX standards. Feature prioritization is opinionated and defensible. |
| Architecture | HIGH | Based on full codebase inspection. Component boundaries and build order are derived from actual file structure and import dependencies. |
| Pitfalls | HIGH | Most pitfalls verified against official docs and open Recharts/shadcn issues. Recovery strategies and warning signs documented for each. |
| Stack | HIGH | Verified against `package.json` and `supabase/migrations/`; actual installed versions confirmed; new dependencies verified via npm (April 2026); prior research's Recharts 3.x claim corrected |
| Features | MEDIUM | Grounded in competitor analysis (YNAB, Monarch, EveryDollar, Quicken Simplifi) and UX onboarding literature; no first-party user testing data for this specific app's users |
| Architecture | HIGH | Based on full codebase inspection; all hook names, mutation signatures, component locations, and file paths verified against source files |
| Pitfalls | HIGH | Direct codebase analysis for each pitfall; React StrictMode double-invocation and TanStack Query mutation patterns are well-understood; DB constraint behaviors are standard PostgreSQL |
**Overall confidence: HIGH**
**Overall confidence:** HIGH
### Gaps to Address
- **shadcn `chart.tsx` patch (issue #9892):** The `initialDimension` fix is community-verified but not yet merged into the official shadcn CLI output. Apply manually after generation and verify with a smoke test (render one chart, confirm no `width(-1)` warnings in console) before proceeding with Phase 2.
- **WCAG contrast on category colors:** The recommended OKLCH values in STACK.md (chroma bumped to ~0.18+) have not been run through a contrast checker. During Phase 1, verify each category color pair against its background at the target luminance levels. Adjust chroma or lightness if any pair fails 3:1 (non-text) or 4.5:1 (text) thresholds.
- **i18n key count baseline:** Before starting the overhaul, run `i18next-scanner` (or manually audit `en.json` vs `de.json`) to establish a baseline parity count. This makes regression detection in each subsequent phase mechanical rather than manual.
- **`BudgetListPage` data shape:** Research did not inspect `BudgetListPage` implementation in detail. Phase 4 may uncover layout decisions that conflict with the dashboard's card pattern. Plan for one iteration pass on `BudgetListPage` specifically.
- **`profiles` table currency column:** STACK.md's RPC SQL assumes a `currency` column on `profiles`. PITFALLS.md flags that auto-create defaults to EUR without reading it. Verify column name before Phase 4 begins — check `supabase/migrations/001_profiles.sql`. Low-effort, one-minute check.
---
- **`setup_completed` backfill migration:** This migration must ship before or simultaneously with Phase 3 to prevent existing v1.0 users from hitting the wizard on their first v2.0 login. Write and test it in Phase 2; it is a prerequisite for Phase 3 deployment.
- **i18n for pre-filled wizard item names:** The ~15-20 preset items in `presets.ts` have English names (Rent, Groceries, Car Insurance, etc.). German translations must exist in `de.json` before the wizard ships. Define translation keys directly in `presets.ts` at data-definition time to make the i18n requirement explicit and auditable.
- **`quick_add_items` user data consideration:** Existing users may have data in `quick_add_items` that no longer surfaces in the UI after Phase 5. The new inline add uses `categories`, not `quick_add_items`. No migration is planned to bridge these. Acceptable risk for a personal/single-user app, but worth noting in user-facing release notes if the app has multiple users.
- **TanStack Query v5 `useEffect` mutation pattern:** PITFALLS.md recommends against firing mutations inside `useEffect` with data dependencies. ARCHITECTURE.md uses exactly this pattern (with a `useRef` guard). Verify the `useRef(false)` guard is sufficient for TanStack Query v5's mutation lifecycle — specifically that `mutate` called on an already-pending mutation is silently ignored (it is, per TQ v5 docs, but confirm in implementation).
## Sources
### Primary (HIGH confidence — official documentation)
- [Recharts 3.0 Migration Guide](https://github.com/recharts/recharts/wiki/3.0-migration-guide) — v3 breaking changes, `Cell` deprecation, `blendStroke` removal
- [Recharts API: ResponsiveContainer](https://recharts.github.io/en-US/api/ResponsiveContainer/) — `debounce` prop, dimension requirements
- [shadcn/ui Chart Docs](https://ui.shadcn.com/docs/components/chart) — `ChartContainer`, `ChartConfig`, `ChartTooltipContent`
- [shadcn/ui Accordion + Collapsible Docs](https://ui.shadcn.com/docs/components/radix/accordion) — component API, `type="multiple"`, independent state
- [Radix UI Collapsible](https://www.radix-ui.com/primitives/docs/components/collapsible) — `--radix-collapsible-content-height` animation pattern
- [Tailwind CSS v4 Theme Docs](https://tailwindcss.com/docs/theme) — `@theme inline`, CSS variable scoping, dark mode class strategy
- [WCAG 2.1 SC 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html) — 3:1 minimum for UI components and chart elements
- [WCAG SC 1.4.3 Contrast Minimum](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) — 4.5:1 for normal text
- [React useMemo](https://react.dev/reference/react/useMemo) — memoization patterns for derived state
- Existing codebase: full inspection of `src/pages/`, `src/components/`, `src/hooks/`, `src/lib/`, `src/index.css`
### Primary (HIGH confidence)
- `package.json` (project root) — authoritative installed versions; confirmed Recharts 2.15.4 not 3.x
- `supabase/migrations/002_categories.sql` through `005_quick_add.sql` — authoritative schema
- `src/App.tsx`, `src/components/AppLayout.tsx`, `src/pages/DashboardPage.tsx`, `src/pages/BudgetDetailPage.tsx` — confirmed existing routing, nav items, hook usage patterns
- `src/hooks/useBudgets.ts`, `src/hooks/useTemplate.ts`, `src/hooks/useCategories.ts` — confirmed existing mutation signatures
- `src/index.css`, `src/lib/palette.ts`, `src/lib/types.ts` — confirmed token structure and CSS variable names
- npm search results (April 2026) — react-hook-form 7.72.0, zod 4.3.6, @hookform/resolvers 5.2.2
- [shadcn/ui blocks page](https://ui.shadcn.com/blocks) — stepper patterns available as copy-paste blocks, no npm dependency
### Secondary (MEDIUM confidence — community sources, multiple corroborating)
- [shadcn-ui/ui PR #8486](https://github.com/shadcn-ui/ui/pull/8486) — Recharts v3 chart.tsx upgrade (open as of March 2026)
- [shadcn-ui/ui Issue #9892](https://github.com/shadcn-ui/ui/issues/9892) — Community-verified `initialDimension` fix for Recharts v3
- [Recharts performance guide](https://recharts.github.io/en-US/guide/performance/) — memoization guidance
- [Recharts ResizeObserver loop issue #1770](https://github.com/recharts/recharts/issues/1770) — confirmed bug and `debounce` workaround
- [YNAB / Empower competitor analysis](https://bountisphere.com/blog/personal-finance-apps-2025-review) — feature comparison basis
- [Fintech dashboard design best practices — Eleken, Merge Rocks, F9 Finance](https://merge.rocks/blog/fintech-dashboard-design-or-how-to-make-data-look-pretty) — visual design conventions
- [shadcn/ui Charts examples](https://ui.shadcn.com/charts) — Donut with center text, bar chart patterns
### Secondary (MEDIUM confidence)
- YNAB, Monarch Money, EveryDollar, Quicken Simplifi — competitor feature patterns for wizard setup, auto-budget creation, and inline item adding
- [zod.dev/v4](https://zod.dev/v4) — Zod 4 stable release notes and versioning strategy
- [Evil Martians OKLCH guide](https://evilmartians.com/chronicles/better-dynamic-themes-in-tailwind-with-oklch-color-magic) — lightness/chroma values for pastel system design
- UX onboarding literature (UX Design Institute, UXCam, UXDA, Smashing Magazine) — wizard step count drop-off data, sheet vs. modal UX rationale
- [Recharts 3.0 migration guide](https://github.com/recharts/recharts/wiki/3.0-migration-guide) — confirmed breaking changes; basis for "do not upgrade" recommendation
### Tertiary (informing but not authoritative)
- [Skeleton loading UX — LogRocket](https://blog.logrocket.com/ux-design/skeleton-loading-screen-design/) — skeleton mirrors real layout
- [Empty state UX — Eleken](https://www.eleken.co/blog-posts/empty-state-ux) — CTA pattern for empty states
- [Color theory in finance dashboards — Extej/Medium](https://medium.com/@extej/the-role-of-color-theory-in-finance-dashboard-design-d2942aec9fff) — palette chroma recommendations
### Tertiary (LOW confidence — informing but not authoritative)
- TanStack Query v5 Strict Mode double-invocation behavior — inferred from known React 18/19 `useEffect` patterns; verify against TQ v5 mutation docs if unexpected behavior appears during implementation
- PostgreSQL `ON CONFLICT DO NOTHING` behavior on Supabase PostgREST layer — standard DB behavior but confirm the exact upsert syntax works via the `@supabase/supabase-js` v2 client
---
*Research completed: 2026-03-16*
*Research completed: 2026-04-02*
*Ready for roadmap: yes*