# teddysmithdev/finshark architecture

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

- Interactive diagram: https://gitdiagram.com/teddysmithdev/finshark
- Repository: https://github.com/teddysmithdev/finshark

## Overview

This is a stock research and portfolio web application: users register or log in, search companies, inspect company and financial-statement views, and manage portfolios and stock comments. The React frontend routes these experiences and calls an ASP.NET API; the API handles identity, stocks, portfolios, and comments, with SQL-backed persistence and a Financial Modeling Prep integration. The README is empty, and several frontend and API modules were not excerpted, so uncertain cross-system links are omitted or marked unverified.

Main entry points: [`frontend/src/api.tsx`](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/api.tsx) (API client), [`api/Program.cs`](https://github.com/teddysmithdev/finshark/blob/master/api/Program.cs) (API service wiring), [`api/Repository/StockRepository.cs`](https://github.com/teddysmithdev/finshark/blob/master/api/Repository/StockRepository.cs) (Stock repository), [`api/Data/ApplicationDBContext.cs`](https://github.com/teddysmithdev/finshark/blob/master/api/Data/ApplicationDBContext.cs) (Application data context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes["Page routing<br/>[Routes.tsx]"]
  node_authpages["Login and register<br/>[LoginPage.tsx]"]
  node_searchpage["Search page<br/>[SearchPage.tsx]"]
  node_companypage["Company page<br/>[CompanyPage.tsx]"]
  node_financialviews["Financial statements"]
  node_authcontext["Auth context<br/>[useAuth.tsx]"]
  node_authservice["Auth service<br/>[AuthService.tsx]"]
  node_portfolioservice["Portfolio service"]
  node_commentsservice["Comment service<br/>[CommentService.tsx]"]
  node_apiclient["API client<br/>[api.tsx]"]
end

subgraph group_api["API domain"]
  node_account["Account endpoints"]
  node_stocks["Stock endpoints<br/>[StockController.cs]"]
  node_portfolio["Portfolio endpoints"]
  node_comments["Comment endpoints"]
  node_fmpservice["FMP service<br/>[FMPService.cs]"]
  node_tokenservice["JWT token service<br/>[TokenService.cs]"]
  node_startup["API service wiring<br/>[Program.cs]"]
end

subgraph group_data["Persistence"]
  node_stockrepo["Stock repository<br/>[StockRepository.cs]"]
  node_portfoliorepo["Portfolio repository"]
  node_commentrepo["Comment repository"]
  node_dbcontext["Application data context"]
end

subgraph group_integrations["External systems"]
  node_database[("SQL database")]
  node_fmp["Financial Modeling Prep"]
end

node_visitor(("User"))

node_visitor -->|"opens pages"| node_routes
node_routes -->|"routes to"| node_authpages
node_routes -->|"protects and routes"| node_searchpage
node_routes -->|"protects and routes"| node_companypage
node_companypage -->|"hosts views"| node_financialviews
node_authpages -.->|"uses"| node_authcontext
node_authcontext -->|"calls"| node_authservice
node_searchpage -->|"uses"| node_portfolioservice
node_searchpage -->|"uses"| node_apiclient
node_authservice -.->|"requests"| node_apiclient
node_portfolioservice -.->|"requests"| node_apiclient
node_commentsservice -.->|"requests"| node_apiclient
node_apiclient -.->|"calls API"| node_account
node_apiclient -.->|"calls API"| node_stocks
node_apiclient -.->|"calls API"| node_portfolio
node_apiclient -.->|"calls API"| node_comments
node_account -->|"issues tokens"| node_tokenservice
node_stocks -->|"uses"| node_stockrepo
node_portfolio -->|"uses"| node_portfoliorepo
node_portfolio -->|"looks up stocks"| node_stockrepo
node_comments -->|"uses"| node_commentrepo
node_comments -->|"looks up stocks"| node_stockrepo
node_comments -->|"finds missing stocks"| node_fmpservice
node_stockrepo -->|"queries and saves"| node_dbcontext
node_portfoliorepo -->|"queries and saves"| node_dbcontext
node_commentrepo -->|"queries and saves"| node_dbcontext
node_dbcontext -->|"persists data"| node_database
node_fmpservice -.->|"fetches stock data"| node_fmp
node_startup -->|"configures"| node_dbcontext
node_startup -->|"registers"| node_stockrepo
node_startup -->|"registers"| node_portfoliorepo
node_startup -->|"registers"| node_commentrepo
node_startup -->|"registers"| node_fmpservice
node_startup -->|"registers"| node_tokenservice

click node_routes "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Routes/Routes.tsx"
click node_authpages "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/LoginPage/LoginPage.tsx"
click node_searchpage "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/SearchPage/SearchPage.tsx"
click node_companypage "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/CompanyPage/CompanyPage.tsx"
click node_financialviews "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Components/IncomeStatement/IncomeStatement.tsx"
click node_authcontext "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Context/useAuth.tsx"
click node_authservice "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/AuthService.tsx"
click node_portfolioservice "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/PortfolioService.tsx"
click node_commentsservice "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/CommentService.tsx"
click node_apiclient "https://github.com/teddysmithdev/finshark/blob/master/frontend/src/api.tsx"
click node_account "https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/AccountController.cs"
click node_stocks "https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/StockController.cs"
click node_portfolio "https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/PortfolioController.cs"
click node_comments "https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/CommentController.cs"
click node_stockrepo "https://github.com/teddysmithdev/finshark/blob/master/api/Repository/StockRepository.cs"
click node_portfoliorepo "https://github.com/teddysmithdev/finshark/blob/master/api/Repository/PortfolioRepository.cs"
click node_commentrepo "https://github.com/teddysmithdev/finshark/blob/master/api/Repository/CommentRepository.cs"
click node_dbcontext "https://github.com/teddysmithdev/finshark/blob/master/api/Data/ApplicationDBContext.cs"
click node_fmpservice "https://github.com/teddysmithdev/finshark/blob/master/api/Service/FMPService.cs"
click node_tokenservice "https://github.com/teddysmithdev/finshark/blob/master/api/Service/TokenService.cs"
click node_startup "https://github.com/teddysmithdev/finshark/blob/master/api/Program.cs"

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_routes,node_authpages,node_searchpage,node_companypage,node_financialviews,node_authcontext,node_authservice,node_portfolioservice,node_commentsservice,node_apiclient,node_visitor toneBlue
class node_account,node_stocks,node_portfolio,node_comments,node_fmpservice,node_tokenservice,node_startup toneAmber
class node_stockrepo,node_portfoliorepo,node_commentrepo,node_dbcontext toneMint
class node_database,node_fmp toneRose
```

## Components

### Web application

- [Page routing](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Routes/Routes.tsx): `frontend/src/Routes/Routes.tsx`
- [Login and register](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/LoginPage/LoginPage.tsx): `frontend/src/Pages/LoginPage/LoginPage.tsx`
- [Search page](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/SearchPage/SearchPage.tsx): `frontend/src/Pages/SearchPage/SearchPage.tsx`
- [Company page](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Pages/CompanyPage/CompanyPage.tsx): `frontend/src/Pages/CompanyPage/CompanyPage.tsx`
- [Financial statements](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Components/IncomeStatement/IncomeStatement.tsx): `frontend/src/Components/IncomeStatement/IncomeStatement.tsx`
- [Auth context](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Context/useAuth.tsx): `frontend/src/Context/useAuth.tsx`
- [Auth service](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/AuthService.tsx): `frontend/src/Services/AuthService.tsx`
- [Portfolio service](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/PortfolioService.tsx): `frontend/src/Services/PortfolioService.tsx`
- [Comment service](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/Services/CommentService.tsx): `frontend/src/Services/CommentService.tsx`
- [API client](https://github.com/teddysmithdev/finshark/blob/master/frontend/src/api.tsx): `frontend/src/api.tsx`

### API domain

- [Account endpoints](https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/AccountController.cs): `api/Controllers/AccountController.cs`
- [Stock endpoints](https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/StockController.cs): `api/Controllers/StockController.cs`
- [Portfolio endpoints](https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/PortfolioController.cs): `api/Controllers/PortfolioController.cs`
- [Comment endpoints](https://github.com/teddysmithdev/finshark/blob/master/api/Controllers/CommentController.cs): `api/Controllers/CommentController.cs`
- [FMP service](https://github.com/teddysmithdev/finshark/blob/master/api/Service/FMPService.cs): `api/Service/FMPService.cs`
- [JWT token service](https://github.com/teddysmithdev/finshark/blob/master/api/Service/TokenService.cs): `api/Service/TokenService.cs`
- [API service wiring](https://github.com/teddysmithdev/finshark/blob/master/api/Program.cs): `api/Program.cs`

### Persistence

- [Stock repository](https://github.com/teddysmithdev/finshark/blob/master/api/Repository/StockRepository.cs): `api/Repository/StockRepository.cs`
- [Portfolio repository](https://github.com/teddysmithdev/finshark/blob/master/api/Repository/PortfolioRepository.cs): `api/Repository/PortfolioRepository.cs`
- [Comment repository](https://github.com/teddysmithdev/finshark/blob/master/api/Repository/CommentRepository.cs): `api/Repository/CommentRepository.cs`
- [Application data context](https://github.com/teddysmithdev/finshark/blob/master/api/Data/ApplicationDBContext.cs): `api/Data/ApplicationDBContext.cs`

### External systems

- **SQL database**
- **Financial Modeling Prep**

### Other components

- **User**

## Connections

- User → Page routing: opens pages (evidence: `frontend/src/Routes/Routes.tsx`)
- Page routing → Login and register: routes to (evidence: `frontend/src/Routes/Routes.tsx`)
- Page routing → Search page: protects and routes (evidence: `frontend/src/Routes/Routes.tsx`)
- Page routing → Company page: protects and routes (evidence: `frontend/src/Routes/Routes.tsx`)
- Company page → Financial statements: hosts views (evidence: `frontend/src/Routes/Routes.tsx`)
- Login and register → Auth context: uses
- Auth context → Auth service: calls (evidence: `frontend/src/Context/useAuth.tsx`)
- Search page → Portfolio service: uses (evidence: `frontend/src/Pages/SearchPage/SearchPage.tsx`)
- Search page → API client: uses (evidence: `frontend/src/Pages/SearchPage/SearchPage.tsx`)
- Auth service → API client: requests
- Portfolio service → API client: requests
- Comment service → API client: requests
- API client → Account endpoints: calls API
- API client → Stock endpoints: calls API
- API client → Portfolio endpoints: calls API
- API client → Comment endpoints: calls API
- Account endpoints → JWT token service: issues tokens (evidence: `api/Controllers/AccountController.cs`)
- Stock endpoints → Stock repository: uses (evidence: `api/Controllers/StockController.cs`)
- Portfolio endpoints → Portfolio repository: uses (evidence: `api/Controllers/PortfolioController.cs`)
- Portfolio endpoints → Stock repository: looks up stocks (evidence: `api/Controllers/PortfolioController.cs`)
- Comment endpoints → Comment repository: uses (evidence: `api/Controllers/CommentController.cs`)
- Comment endpoints → Stock repository: looks up stocks (evidence: `api/Controllers/CommentController.cs`)
- Comment endpoints → FMP service: finds missing stocks (evidence: `api/Controllers/CommentController.cs`)
- Stock repository → Application data context: queries and saves (evidence: `api/Repository/StockRepository.cs`)
- Portfolio repository → Application data context: queries and saves (evidence: `api/Repository/PortfolioRepository.cs`)
- Comment repository → Application data context: queries and saves (evidence: `api/Repository/CommentRepository.cs`)
- Application data context → SQL database: persists data
- FMP service → Financial Modeling Prep: fetches stock data
- API service wiring → Application data context: configures (evidence: `api/Program.cs`)
- API service wiring → Stock repository: registers (evidence: `api/Program.cs`)
- API service wiring → Portfolio repository: registers (evidence: `api/Program.cs`)
- API service wiring → Comment repository: registers (evidence: `api/Program.cs`)
- API service wiring → FMP service: registers (evidence: `api/Program.cs`)
- API service wiring → JWT token service: registers (evidence: `api/Program.cs`)
