# team-finch/finch-frontend architecture

> Architecture diagram of the GitHub repository team-finch/finch-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/team-finch/finch-frontend
- Repository: https://github.com/team-finch/finch-frontend

## Overview

FINCH is a mobile-first investing web app. Users sign in, choose stocks during onboarding, and then use home/briefings, stock search and analysis, portfolio insights, AI chat, and account actions such as orders and deposits. The main runtime path is route selection into pages, feature queries and mutations, shared API handling, and a backend; chat uses asynchronous job polling. The README documents the broader feature set and architectural direction, but several feature implementations were not sampled, so uncertain internal links are omitted or marked unverified.

Main entry points: [`src/app/router.tsx`](https://github.com/team-finch/finch-frontend/blob/master/src/app/router.tsx) (Route map), [`src/shared/api/httpClient.ts`](https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/httpClient.ts) (HTTP client), [`src/app/layouts/RootLayout.tsx`](https://github.com/team-finch/finch-frontend/blob/master/src/app/layouts/RootLayout.tsx) (Root layout), [`src/pages/SearchPage.tsx`](https://github.com/team-finch/finch-frontend/blob/master/src/pages/SearchPage.tsx) (Stock search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_app_entry["App entry<br/>[main.tsx]"]
  node_router["Route map<br/>[router.tsx]"]
  node_shell["Root layout<br/>[RootLayout.tsx]"]
  node_routes["Route definitions<br/>[routes.ts]"]
end

subgraph group_account["Identity and account"]
  node_auth_ui["Sign-in and guards<br/>[RequireAuth.tsx]"]
  node_auth_session["Session state<br/>[useAuthSession.ts]"]
  node_auth_bridge["Auth bridge<br/>[authBridge.ts]"]
  node_onboarding["Stock onboarding"]
  node_orders["Order checks"]
  node_deposits["Cash operations"]
end

subgraph group_market["Market exploration"]
  node_home["Home and briefing"]
  node_search["Stock search<br/>[SearchPage.tsx]"]
  node_stock_detail["Stock analysis"]
end

subgraph group_insights["AI and portfolio"]
  node_portfolio["Portfolio insights"]
  node_chat_page["AI chat<br/>[ChatPage.tsx]"]
  node_chat_jobs["Chat job polling<br/>[useChatJobQuery.ts]"]
end

subgraph group_platform["Shared runtime"]
  node_query_state["Query cache<br/>[queryClient.ts]"]
  node_query_keys["Query keys<br/>[queryKeys.ts]"]
  node_api_contract["API contracts<br/>[apiContract.ts]"]
  node_http["HTTP client<br/>[httpClient.ts]"]
  node_shared_ui["Shared UI<br/>[PageMain.tsx]"]
  node_tab_bar["Tab navigation<br/>[TabBar.tsx]"]
  node_toast_state["Toast state<br/>[useToastStore.ts]"]
  node_domain_types["Domain types<br/>[stock.ts]"]
end

node_investor(("Investor"))
node_backend{{"Backend API"}}

node_investor -->|"opens app"| node_app_entry
node_app_entry -->|"mounts"| node_router
node_router -->|"wraps routes"| node_shell
node_router -->|"uses paths"| node_routes
node_router -->|"guards pages"| node_auth_ui
node_auth_ui -.->|"checks session"| node_auth_session
node_auth_session -.->|"shares session"| node_auth_bridge
node_investor -.->|"picks stocks"| node_onboarding
node_investor -.->|"views briefing"| node_home
node_investor -->|"searches stocks"| node_search
node_search -.->|"opens stock"| node_stock_detail
node_investor -.->|"checks order"| node_orders
node_investor -.->|"manages cash"| node_deposits
node_investor -.->|"reviews portfolio"| node_portfolio
node_investor -->|"asks AI"| node_chat_page
node_chat_page -->|"polls jobs"| node_chat_jobs
node_chat_page -->|"uses queries"| node_query_state
node_chat_jobs -->|"keys queries"| node_query_keys
node_query_state -->|"uses transport"| node_http
node_http -->|"checks auth"| node_auth_bridge
node_http -->|"uses contract"| node_api_contract
node_http -->|"sends requests"| node_backend
node_search -->|"renders page"| node_shared_ui
node_shell -->|"shows notices"| node_toast_state
node_shell -.->|"lays out tabs"| node_tab_bar
node_api_contract -.->|"defines API values"| node_domain_types

click node_app_entry "https://github.com/team-finch/finch-frontend/blob/master/src/main.tsx"
click node_router "https://github.com/team-finch/finch-frontend/blob/master/src/app/router.tsx"
click node_shell "https://github.com/team-finch/finch-frontend/blob/master/src/app/layouts/RootLayout.tsx"
click node_routes "https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/routes.ts"
click node_auth_ui "https://github.com/team-finch/finch-frontend/blob/master/src/features/auth/components/RequireAuth.tsx"
click node_auth_session "https://github.com/team-finch/finch-frontend/blob/master/src/features/auth/model/useAuthSession.ts"
click node_auth_bridge "https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/authBridge.ts"
click node_onboarding "https://github.com/team-finch/finch-frontend/tree/master/src/features/onboarding"
click node_home "https://github.com/team-finch/finch-frontend/tree/master/src/features/home"
click node_search "https://github.com/team-finch/finch-frontend/blob/master/src/pages/SearchPage.tsx"
click node_stock_detail "https://github.com/team-finch/finch-frontend/blob/master/src/pages/StockDetailPage.tsx"
click node_orders "https://github.com/team-finch/finch-frontend/tree/master/src/features/order"
click node_deposits "https://github.com/team-finch/finch-frontend/tree/master/src/features/deposit"
click node_portfolio "https://github.com/team-finch/finch-frontend/tree/master/src/features/portfolio"
click node_chat_page "https://github.com/team-finch/finch-frontend/blob/master/src/pages/ChatPage.tsx"
click node_chat_jobs "https://github.com/team-finch/finch-frontend/blob/master/src/features/chat/api/useChatJobQuery.ts"
click node_query_state "https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/queryClient.ts"
click node_query_keys "https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/queryKeys.ts"
click node_api_contract "https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/apiContract.ts"
click node_http "https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/httpClient.ts"
click node_shared_ui "https://github.com/team-finch/finch-frontend/blob/master/src/shared/ui/PageMain.tsx"
click node_tab_bar "https://github.com/team-finch/finch-frontend/blob/master/src/shared/ui/TabBar.tsx"
click node_toast_state "https://github.com/team-finch/finch-frontend/blob/master/src/shared/hooks/useToastStore.ts"
click node_domain_types "https://github.com/team-finch/finch-frontend/blob/master/src/shared/types/stock.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_router,node_shell,node_routes toneBlue
class node_auth_ui,node_auth_session,node_auth_bridge,node_onboarding,node_orders,node_deposits toneAmber
class node_home,node_search,node_stock_detail,node_backend toneMint
class node_portfolio,node_chat_page,node_chat_jobs toneRose
class node_query_state,node_query_keys,node_api_contract,node_http,node_shared_ui,node_tab_bar,node_toast_state,node_domain_types,node_investor toneIndigo
```

## Components

### App shell

- [App entry](https://github.com/team-finch/finch-frontend/blob/master/src/main.tsx): `src/main.tsx`
- [Route map](https://github.com/team-finch/finch-frontend/blob/master/src/app/router.tsx): `src/app/router.tsx`
- [Root layout](https://github.com/team-finch/finch-frontend/blob/master/src/app/layouts/RootLayout.tsx): `src/app/layouts/RootLayout.tsx`
- [Route definitions](https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/routes.ts): `src/shared/config/routes.ts`

### Identity and account

- [Sign-in and guards](https://github.com/team-finch/finch-frontend/blob/master/src/features/auth/components/RequireAuth.tsx): `src/features/auth/components/RequireAuth.tsx`
- [Session state](https://github.com/team-finch/finch-frontend/blob/master/src/features/auth/model/useAuthSession.ts): `src/features/auth/model/useAuthSession.ts`
- [Auth bridge](https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/authBridge.ts): `src/shared/api/authBridge.ts`
- [Stock onboarding](https://github.com/team-finch/finch-frontend/tree/master/src/features/onboarding): `src/features/onboarding`
- [Order checks](https://github.com/team-finch/finch-frontend/tree/master/src/features/order): `src/features/order`
- [Cash operations](https://github.com/team-finch/finch-frontend/tree/master/src/features/deposit): `src/features/deposit`

### Market exploration

- [Home and briefing](https://github.com/team-finch/finch-frontend/tree/master/src/features/home): `src/features/home`
- [Stock search](https://github.com/team-finch/finch-frontend/blob/master/src/pages/SearchPage.tsx): `src/pages/SearchPage.tsx`
- [Stock analysis](https://github.com/team-finch/finch-frontend/blob/master/src/pages/StockDetailPage.tsx): `src/pages/StockDetailPage.tsx`

### AI and portfolio

- [Portfolio insights](https://github.com/team-finch/finch-frontend/tree/master/src/features/portfolio): `src/features/portfolio`
- [AI chat](https://github.com/team-finch/finch-frontend/blob/master/src/pages/ChatPage.tsx): `src/pages/ChatPage.tsx`
- [Chat job polling](https://github.com/team-finch/finch-frontend/blob/master/src/features/chat/api/useChatJobQuery.ts): `src/features/chat/api/useChatJobQuery.ts`

### Shared runtime

- [Query cache](https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/queryClient.ts): `src/shared/api/queryClient.ts`
- [Query keys](https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/queryKeys.ts): `src/shared/config/queryKeys.ts`
- [API contracts](https://github.com/team-finch/finch-frontend/blob/master/src/shared/config/apiContract.ts): `src/shared/config/apiContract.ts`
- [HTTP client](https://github.com/team-finch/finch-frontend/blob/master/src/shared/api/httpClient.ts): `src/shared/api/httpClient.ts`
- [Shared UI](https://github.com/team-finch/finch-frontend/blob/master/src/shared/ui/PageMain.tsx): `src/shared/ui/PageMain.tsx`
- [Tab navigation](https://github.com/team-finch/finch-frontend/blob/master/src/shared/ui/TabBar.tsx): `src/shared/ui/TabBar.tsx`
- [Toast state](https://github.com/team-finch/finch-frontend/blob/master/src/shared/hooks/useToastStore.ts): `src/shared/hooks/useToastStore.ts`
- [Domain types](https://github.com/team-finch/finch-frontend/blob/master/src/shared/types/stock.ts): `src/shared/types/stock.ts`

### Other components

- **Investor**
- **Backend API**

## Connections

- Investor → App entry: opens app
- App entry → Route map: mounts (evidence: `src/main.tsx`)
- Route map → Root layout: wraps routes (evidence: `src/app/router.tsx`)
- Route map → Route definitions: uses paths (evidence: `src/app/router.tsx`)
- Route map → Sign-in and guards: guards pages (evidence: `src/app/router.tsx`)
- Sign-in and guards → Session state: checks session
- Session state → Auth bridge: shares session
- Investor → Stock onboarding: picks stocks
- Investor → Home and briefing: views briefing
- Investor → Stock search: searches stocks (evidence: `src/pages/SearchPage.tsx`)
- Stock search → Stock analysis: opens stock
- Investor → Order checks: checks order
- Investor → Cash operations: manages cash
- Investor → Portfolio insights: reviews portfolio
- Investor → AI chat: asks AI
- AI chat → Chat job polling: polls jobs (evidence: `src/pages/ChatPage.tsx`)
- AI chat → Query cache: uses queries (evidence: `src/pages/ChatPage.tsx`)
- Chat job polling → Query keys: keys queries (evidence: `src/features/chat/api/useChatJobQuery.ts`)
- Query cache → HTTP client: uses transport (evidence: `src/shared/api/index.ts`)
- HTTP client → Auth bridge: checks auth (evidence: `src/shared/api/httpClient.ts`)
- HTTP client → API contracts: uses contract (evidence: `src/shared/api/httpClient.ts`)
- HTTP client → Backend API: sends requests
- Stock search → Shared UI: renders page (evidence: `src/pages/SearchPage.tsx`)
- Root layout → Toast state: shows notices (evidence: `src/app/layouts/RootLayout.tsx`)
- Root layout → Tab navigation: lays out tabs
- API contracts → Domain types: defines API values (evidence: `src/shared/types/stock.ts`)
