Skip to main content

SPEC 009 — Finance Dashboard


1. Feature Purpose

The Finance Dashboard provides a real-time financial overview for organizations, displaying key metrics (assets, liabilities, equity), accounts receivable/payable aging, bank account balances, open invoices and bills, P&L reports, and scheduled CFO automation jobs. Unlike other Equa modules, this feature connects to an external HH Finance Agent REST API rather than the core equa-server backend. The finance agent syncs with QuickBooks Online and provides aggregated financial data.

2. Current State (Verified)

2.1 Architecture

The finance dashboard is a frontend-only module within equa-web that communicates with an external microservice:
  • No equa-server entities — The finance agent is a standalone service; no tables in schema.ts
  • No authentication — API calls from the frontend carry no Authorization header, API key, or token
  • No route-level permission gating — Accessible to any authenticated organization member

2.2 Frontend

2.3 External API Configuration

The base URL defaults to http://localhost:19792 and must be set via environment variable for deployed environments.

3. Data Model (TypeScript Interfaces)

Since there are no database entities, the data model is defined entirely as TypeScript interfaces in types/index.ts.

3.1 Core Financial Types

FinancialDashboard: KeyMetrics:

3.2 Account Types

BankAccount: AccountSummary:

3.3 Customer and Vendor Types

CustomerSummary / VendorSummary (same structure):

3.4 Transaction Types

InvoiceSummary: BillSummary:

3.5 Aging

AgingBucket:

3.6 Dashboard Summary (Composite)

DashboardSummary:

3.7 Scheduler Types

ScheduledJob: JobExecution: SchedulerStatus: HealthStatus:

4. API Endpoints (External HH Finance Agent)

All endpoints are on the external HH Finance Agent service (33 total).

Health

Dashboard

Accounts

Customers / Accounts Receivable

Vendors / Accounts Payable

Invoices

Bills

Reports

Report endpoints return unknown types — the response schemas are not fully typed in the frontend. This is a gap that should be addressed when report rendering is implemented.

Scheduler

Tools


5. Frontend Components

Component Hierarchy

Components

React Hooks

Hook pattern: Generic useAsync<T> with data: T | null, loading: boolean, error: string | null, refetch().

Formatting Utilities

Routes

Dashboard Layout

  1. Header: Title, subtitle with generatedAt timestamp, Refresh button
  2. Metrics Grid (5 cards): Total Assets, Total Liabilities, Total Equity, Accounts Receivable total, Accounts Payable total
  3. Bank Accounts: Table of bank accounts with balances
  4. Two-Column Grid: AR Aging Summary | AP Aging Summary
  5. Two-Column Grid: Open Invoices (limit 5) | Open Bills (limit 5)
  6. Scheduler (conditional — shown only when scheduler exists and has jobs): Job list with run/toggle controls

State Management

  • Loading: Shows “Loading financial data…” message
  • Error: Alert banner with error message and Retry button
  • Empty: “No data available” message
  • Actions: handleRunJob(jobId) triggers manual job execution; handleToggleJob(jobId, enabled) enables/disables a job; refetch() refreshes all data

6. Business Rules and Validation


7. Acceptance Criteria

  • Dashboard loads and displays 5 metric cards (total assets, liabilities, equity, AR, AP)
  • Bank accounts table shows all accounts with names, types, and balances
  • AR and AP aging summaries display correct bucket totals (current, 1-30, 31-60, 61-90, 90+)
  • Open invoices table shows up to 5 invoices with status indicators
  • Open bills table shows up to 5 bills with status indicators
  • Refresh button fetches fresh data from the finance agent
  • Loading state is displayed while data is fetching
  • Error state displays the error message with a Retry option
  • Scheduler section appears only when jobs exist
  • Scheduled jobs can be manually run and toggled on/off
  • All currency values are formatted as USD
  • Relative timestamps display correctly (e.g., “2 hours ago”)
  • REACT_APP_HH_FINANCE_API_URL environment variable configures the API base URL
  • Dashboard is accessible from the organization navigation

8. Risks and Edge Cases


9. Dependencies


The HH Finance Agent (Spec 009) and the FFM Sync Engine (FFM Spec 007) are related but separate systems that both interact with QuickBooks Online.

Integration Architecture

Future Integration Points

  • The Finance Dashboard could display FFM sync health status via the GET /api/sync/health endpoint
  • Both systems share the same QBO realm for Hills & Hollows, LLC (qboRealmId)
  • The FFM circuit breaker state could inform the dashboard’s data freshness indicator

FFM Documentation