| # FinSight Frontend |
|
|
| A calm, data-first fintech dashboard for analysing financial filings β built in React + TypeScript with Vite. |
|
|
| ## Quick start |
|
|
| ```bash |
| npm install |
| npm run dev # starts on http://localhost:5173 |
| ``` |
|
|
| The dev server proxies `/api/*` β `http://localhost:8000` (your FinSight backend). Change the target in `vite.config.ts` if your backend runs elsewhere. |
|
|
| ## Folder structure |
|
|
| ``` |
| src/ |
| βββ api/ |
| β βββ client.ts # All API calls + NotFoundError |
| βββ components/ |
| β βββ layout/ |
| β β βββ AppLayout.tsx # Sidebar + route layout |
| β βββ ui/ |
| β βββ Alert.tsx |
| β βββ ConfidenceBadge.tsx |
| β βββ MetricCard.tsx |
| β βββ RecommendationBadge.tsx |
| β βββ SeverityBadge.tsx |
| β βββ Spinner.tsx |
| βββ pages/ |
| β βββ UploadPage.tsx # POST /upload with low_confidence_metrics callout |
| β βββ ReportPage.tsx # GET /report + /red_flags + /recommendation |
| β βββ AskPage.tsx # POST /query β chat interface |
| β βββ ComparePage.tsx # POST /compare β side-by-side table |
| β βββ CompaniesPage.tsx # GET /companies β search & browse |
| βββ types/ |
| β βββ api.ts # All TypeScript types mirroring OpenAPI schema |
| βββ App.tsx # Router |
| βββ main.tsx |
| βββ styles.css # Full design system (CSS custom properties) |
| ``` |
|
|
| ## Design decisions |
|
|
| - **Confidence is a first-class UI concept.** Every metric, red flag, and query answer surfaces its confidence level as a coloured pill badge (green/amber/red). |
| - **SKIP is not an error.** `RecommendationBadge` renders SKIP as a neutral grey state with "Insufficient data." |
| - **API `error` fields on 200 responses** are shown as yellow warning banners β not treated as exceptions. |
| - **404 responses** show "No filing found. Upload a filing first." β not a generic error. |
| - **Metric dual-format.** `MetricCard` handles both rich `{value, confidence, β¦}` objects and plain numeric ratio values. |
| - **Proxy in dev.** All `/api/*` requests proxy to the backend β no CORS issues during development. |
|
|
| ## Connecting to the backend |
|
|
| The only file you need to change for a different backend URL is: |
|
|
| ```ts |
| // vite.config.ts |
| proxy: { |
| '/api': { |
| target: 'http://localhost:8000', // β change this |
| ``` |
|
|
| For production, set a `VITE_API_BASE` env var and update `client.ts` accordingly. |
|
|