FinSight / frontend /README.md
Sanjam19's picture
Deploy FinSight demo (single-container Docker Space)
d4f8959 verified
|
Raw
History Blame Contribute Delete
2.5 kB
# 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.