# danishdsouza/frie architecture

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

- Interactive diagram: https://gitdiagram.com/danishdsouza/frie
- Repository: https://github.com/danishdsouza/frie

## Overview

FRIE is a financial-readiness assessment app: users sign in, provide profile and financial documents, build assessment features, and view a score, explanations, and recommendations. The graph separates the browser experience, API boundary, backend domain services, and persistence. The README only describes running the code; workflow details come from sampled source and the SOURCE INDEX. Several route and service implementations were not sampled, so uncertain backend connections are omitted rather than inferred.

Main entry points: [`backend/app/main.py`](https://github.com/danishdsouza/frie/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/api/routes/analysis.py`](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/analysis.py) (Analysis routes), [`backend/app/services/feature_engineering.py`](https://github.com/danishdsouza/frie/blob/main/backend/app/services/feature_engineering.py) (Feature engineering), [`src/services/api.ts`](https://github.com/danishdsouza/frie/blob/main/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser app"]
  node_app["App state<br/>[App.tsx]"]
  node_login["Sign-in view<br/>[LoginView.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_documents_ui["Documents view<br/>[DocumentsView.tsx]"]
  node_analysis_ui["Analysis view<br/>[AnalysisView.tsx]"]
  node_profile_ui["Profile view<br/>[ProfileView.tsx]"]
  node_portfolio_ui["Portfolio views<br/>[PortfolioViews.tsx]"]
  node_assessment_ui["Assessment controls<br/>[shared.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API layer"]
  node_server["FastAPI app<br/>[main.py]"]
  node_auth_route["Authentication routes<br/>[auth.py]"]
  node_documents_route["Document routes<br/>[documents.py]"]
  node_analysis_route["Analysis routes<br/>[analysis.py]"]
  node_features_route["Feature routes<br/>[features.py]"]
  node_prediction_route["Prediction routes<br/>[prediction.py]"]
  node_profile_route["Profile routes<br/>[profile.py]"]
end

subgraph group_domain["Assessment services"]
  node_auth_service["Account sessions<br/>[auth_service.py]"]
  node_document_service["Document handling"]
  node_extraction["Document extraction"]
  node_storage["File storage<br/>[storage_service.py]"]
  node_bank_import["Bank import<br/>[bank_import.py]"]
  node_feature_engineering["Feature engineering"]
  node_credit_records["Credit records<br/>[credit_records.py]"]
  node_classifier["Transaction classifier"]
  node_feature_contract["Feature contract"]
  node_prediction["Scoring service"]
  node_recommendations["Recommendations"]
  node_indicators["Financial indicators"]
  node_profile_service["Profile service<br/>[profile_service.py]"]
end

subgraph group_data["Persistence"]
  node_db_session["Database sessions<br/>[session.py]"]
  node_models[("FRIE records<br/>[models.py]")]
end

node_user(("FRIE user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_dashboard
node_app -->|"restores session"| node_api_client
node_dashboard -->|"uses"| node_assessment_ui
node_documents_ui -->|"requests documents"| node_api_client
node_profile_ui -->|"requests profile"| node_api_client
node_portfolio_ui -->|"requests data"| node_api_client
node_assessment_ui -->|"builds and assesses"| node_api_client
node_api_client -.->|"HTTP requests"| node_server
node_server -->|"registers"| node_auth_route
node_server -->|"registers"| node_documents_route
node_server -->|"registers"| node_analysis_route
node_server -->|"registers"| node_features_route
node_server -->|"registers"| node_prediction_route
node_server -->|"registers"| node_profile_route
node_auth_route -->|"calls"| node_auth_service
node_auth_service -->|"reads and writes"| node_models
node_documents_route -->|"calls"| node_document_service
node_documents_route -->|"calls"| node_extraction
node_documents_route -->|"calls"| node_storage
node_documents_route -->|"calls"| node_bank_import
node_extraction -->|"uses"| node_storage
node_analysis_route -->|"calls"| node_feature_engineering
node_analysis_route -->|"calls"| node_prediction
node_analysis_route -->|"calls"| node_recommendations
node_analysis_route -->|"calls"| node_indicators
node_analysis_route -->|"calls"| node_profile_service
node_features_route -->|"calls"| node_feature_engineering
node_prediction_route -.->|"dispatches"| node_prediction
node_profile_route -.->|"dispatches"| node_profile_service
node_feature_engineering -->|"reads imported data"| node_bank_import
node_feature_engineering -->|"uses"| node_credit_records
node_feature_engineering -->|"uses"| node_classifier
node_feature_engineering -->|"uses"| node_profile_service
node_prediction -->|"validates inputs"| node_feature_contract
node_prediction -.->|"persists results"| node_models
node_db_session -->|"creates sessions"| node_models
node_server -->|"loads model"| node_prediction

click node_app "https://github.com/danishdsouza/frie/blob/main/src/app/App.tsx"
click node_login "https://github.com/danishdsouza/frie/blob/main/src/app/views/LoginView.tsx"
click node_dashboard "https://github.com/danishdsouza/frie/blob/main/src/app/views/DashboardView.tsx"
click node_documents_ui "https://github.com/danishdsouza/frie/blob/main/src/app/views/DocumentsView.tsx"
click node_analysis_ui "https://github.com/danishdsouza/frie/blob/main/src/app/views/AnalysisView.tsx"
click node_profile_ui "https://github.com/danishdsouza/frie/blob/main/src/app/views/ProfileView.tsx"
click node_portfolio_ui "https://github.com/danishdsouza/frie/blob/main/src/app/views/PortfolioViews.tsx"
click node_assessment_ui "https://github.com/danishdsouza/frie/blob/main/src/app/components/shared.tsx"
click node_api_client "https://github.com/danishdsouza/frie/blob/main/src/services/api.ts"
click node_server "https://github.com/danishdsouza/frie/blob/main/backend/app/main.py"
click node_auth_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/auth.py"
click node_documents_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/documents.py"
click node_analysis_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/analysis.py"
click node_features_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/features.py"
click node_prediction_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/prediction.py"
click node_profile_route "https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/profile.py"
click node_auth_service "https://github.com/danishdsouza/frie/blob/main/backend/app/services/auth_service.py"
click node_document_service "https://github.com/danishdsouza/frie/blob/main/backend/app/services/document_service.py"
click node_extraction "https://github.com/danishdsouza/frie/blob/main/backend/app/services/extraction_service.py"
click node_storage "https://github.com/danishdsouza/frie/blob/main/backend/app/services/storage_service.py"
click node_bank_import "https://github.com/danishdsouza/frie/blob/main/backend/app/services/bank_import.py"
click node_feature_engineering "https://github.com/danishdsouza/frie/blob/main/backend/app/services/feature_engineering.py"
click node_credit_records "https://github.com/danishdsouza/frie/blob/main/backend/app/services/credit_records.py"
click node_classifier "https://github.com/danishdsouza/frie/blob/main/backend/app/services/transaction_classifier.py"
click node_feature_contract "https://github.com/danishdsouza/frie/blob/main/backend/app/core/feature_contract.py"
click node_prediction "https://github.com/danishdsouza/frie/blob/main/backend/app/services/prediction_service.py"
click node_recommendations "https://github.com/danishdsouza/frie/blob/main/backend/app/services/recommendation_service.py"
click node_indicators "https://github.com/danishdsouza/frie/blob/main/backend/app/services/indicator_service.py"
click node_profile_service "https://github.com/danishdsouza/frie/blob/main/backend/app/services/profile_service.py"
click node_db_session "https://github.com/danishdsouza/frie/blob/main/backend/app/db/session.py"
click node_models "https://github.com/danishdsouza/frie/blob/main/backend/app/db/models.py"

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,node_login,node_dashboard,node_documents_ui,node_analysis_ui,node_profile_ui,node_portfolio_ui,node_assessment_ui,node_api_client,node_user toneBlue
class node_server,node_auth_route,node_documents_route,node_analysis_route,node_features_route,node_prediction_route,node_profile_route toneAmber
class node_auth_service,node_document_service,node_extraction,node_storage,node_bank_import,node_feature_engineering,node_credit_records,node_classifier,node_feature_contract,node_prediction,node_recommendations,node_indicators,node_profile_service toneMint
class node_db_session,node_models toneRose
```

## Components

### Browser app

- [App state](https://github.com/danishdsouza/frie/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Sign-in view](https://github.com/danishdsouza/frie/blob/main/src/app/views/LoginView.tsx): `src/app/views/LoginView.tsx`
- [Dashboard](https://github.com/danishdsouza/frie/blob/main/src/app/views/DashboardView.tsx): `src/app/views/DashboardView.tsx`
- [Documents view](https://github.com/danishdsouza/frie/blob/main/src/app/views/DocumentsView.tsx): `src/app/views/DocumentsView.tsx`
- [Analysis view](https://github.com/danishdsouza/frie/blob/main/src/app/views/AnalysisView.tsx): `src/app/views/AnalysisView.tsx`
- [Profile view](https://github.com/danishdsouza/frie/blob/main/src/app/views/ProfileView.tsx): `src/app/views/ProfileView.tsx`
- [Portfolio views](https://github.com/danishdsouza/frie/blob/main/src/app/views/PortfolioViews.tsx): `src/app/views/PortfolioViews.tsx`
- [Assessment controls](https://github.com/danishdsouza/frie/blob/main/src/app/components/shared.tsx): `src/app/components/shared.tsx`
- [API client](https://github.com/danishdsouza/frie/blob/main/src/services/api.ts): `src/services/api.ts`

### API layer

- [FastAPI app](https://github.com/danishdsouza/frie/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Document routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/documents.py): `backend/app/api/routes/documents.py`
- [Analysis routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/analysis.py): `backend/app/api/routes/analysis.py`
- [Feature routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/features.py): `backend/app/api/routes/features.py`
- [Prediction routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/prediction.py): `backend/app/api/routes/prediction.py`
- [Profile routes](https://github.com/danishdsouza/frie/blob/main/backend/app/api/routes/profile.py): `backend/app/api/routes/profile.py`

### Assessment services

- [Account sessions](https://github.com/danishdsouza/frie/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Document handling](https://github.com/danishdsouza/frie/blob/main/backend/app/services/document_service.py): `backend/app/services/document_service.py`
- [Document extraction](https://github.com/danishdsouza/frie/blob/main/backend/app/services/extraction_service.py): `backend/app/services/extraction_service.py`
- [File storage](https://github.com/danishdsouza/frie/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`
- [Bank import](https://github.com/danishdsouza/frie/blob/main/backend/app/services/bank_import.py): `backend/app/services/bank_import.py`
- [Feature engineering](https://github.com/danishdsouza/frie/blob/main/backend/app/services/feature_engineering.py): `backend/app/services/feature_engineering.py`
- [Credit records](https://github.com/danishdsouza/frie/blob/main/backend/app/services/credit_records.py): `backend/app/services/credit_records.py`
- [Transaction classifier](https://github.com/danishdsouza/frie/blob/main/backend/app/services/transaction_classifier.py): `backend/app/services/transaction_classifier.py`
- [Feature contract](https://github.com/danishdsouza/frie/blob/main/backend/app/core/feature_contract.py): `backend/app/core/feature_contract.py`
- [Scoring service](https://github.com/danishdsouza/frie/blob/main/backend/app/services/prediction_service.py): `backend/app/services/prediction_service.py`
- [Recommendations](https://github.com/danishdsouza/frie/blob/main/backend/app/services/recommendation_service.py): `backend/app/services/recommendation_service.py`
- [Financial indicators](https://github.com/danishdsouza/frie/blob/main/backend/app/services/indicator_service.py): `backend/app/services/indicator_service.py`
- [Profile service](https://github.com/danishdsouza/frie/blob/main/backend/app/services/profile_service.py): `backend/app/services/profile_service.py`

### Persistence

- [Database sessions](https://github.com/danishdsouza/frie/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [FRIE records](https://github.com/danishdsouza/frie/blob/main/backend/app/db/models.py): `backend/app/db/models.py`

### Other components

- **FRIE user**

## Connections

- FRIE user → App state: uses
- App state → Sign-in view: renders (evidence: `src/app/App.tsx`)
- App state → Dashboard: renders (evidence: `src/app/App.tsx`)
- App state → API client: restores session (evidence: `src/app/App.tsx`)
- Dashboard → Assessment controls: uses (evidence: `src/app/views/DashboardView.tsx`)
- Documents view → API client: requests documents (evidence: `src/app/views/DocumentsView.tsx`)
- Profile view → API client: requests profile (evidence: `src/app/views/ProfileView.tsx`)
- Portfolio views → API client: requests data (evidence: `src/app/views/PortfolioViews.tsx`)
- Assessment controls → API client: builds and assesses (evidence: `src/app/components/shared.tsx`)
- API client → FastAPI app: HTTP requests
- FastAPI app → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Document routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Analysis routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Feature routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Prediction routes: registers (evidence: `backend/app/main.py`)
- FastAPI app → Profile routes: registers (evidence: `backend/app/main.py`)
- Authentication routes → Account sessions: calls (evidence: `backend/app/api/routes/auth.py`)
- Account sessions → FRIE records: reads and writes (evidence: `backend/app/services/auth_service.py`)
- Document routes → Document handling: calls (evidence: `backend/app/api/routes/documents.py`)
- Document routes → Document extraction: calls (evidence: `backend/app/api/routes/documents.py`)
- Document routes → File storage: calls (evidence: `backend/app/api/routes/documents.py`)
- Document routes → Bank import: calls (evidence: `backend/app/api/routes/documents.py`)
- Document extraction → File storage: uses (evidence: `backend/app/services/extraction_service.py`)
- Analysis routes → Feature engineering: calls (evidence: `backend/app/api/routes/analysis.py`)
- Analysis routes → Scoring service: calls (evidence: `backend/app/api/routes/analysis.py`)
- Analysis routes → Recommendations: calls (evidence: `backend/app/api/routes/analysis.py`)
- Analysis routes → Financial indicators: calls (evidence: `backend/app/api/routes/analysis.py`)
- Analysis routes → Profile service: calls (evidence: `backend/app/api/routes/analysis.py`)
- Feature routes → Feature engineering: calls (evidence: `backend/app/api/routes/features.py`)
- Prediction routes → Scoring service: dispatches
- Profile routes → Profile service: dispatches
- Feature engineering → Bank import: reads imported data (evidence: `backend/app/services/feature_engineering.py`)
- Feature engineering → Credit records: uses (evidence: `backend/app/services/feature_engineering.py`)
- Feature engineering → Transaction classifier: uses (evidence: `backend/app/services/feature_engineering.py`)
- Feature engineering → Profile service: uses (evidence: `backend/app/services/feature_engineering.py`)
- Scoring service → Feature contract: validates inputs (evidence: `backend/app/services/prediction_service.py`)
- Scoring service → FRIE records: persists results
- Database sessions → FRIE records: creates sessions (evidence: `backend/app/db/session.py`)
- FastAPI app → Scoring service: loads model (evidence: `backend/app/main.py`)
