# sahinurrahman-debug/vibefinance architecture

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

- Interactive diagram: https://gitdiagram.com/sahinurrahman-debug/vibefinance
- Repository: https://github.com/sahinurrahman-debug/vibefinance

## Overview

VibeFinance is a FastAPI investment-guidance app for Indian retail investors. A browser request reaches the API, which authenticates the user and invokes the engine; the engine runs market and personal agents, then synthesizes cited, calibrated recommendations and stores the run. Separate branches support portfolio risk and alerts, live data, and evaluation/back-testing. The README documents these connections; sampled excerpts substantiate key implementation details, while unsampled modules are represented only where documented capabilities and the source index support them.

Main entry points: [`app/engine.py`](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/engine.py) (Analysis engine), [`app/agents.py`](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/agents.py) (Six agents), [`app/server.py`](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/server.py) (REST API), [`app/rag.py`](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/rag.py) (Filing retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience and API"]
  node_dashboard["Web dashboard<br/>[index.html]"]
  node_api["REST API<br/>[server.py]"]
  node_security["Account security<br/>[security.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_analysis["Analysis pipeline"]
  node_engine["Analysis engine<br/>[engine.py]"]
  node_agents["Six agents<br/>[agents.py]"]
  node_signals["Signal functions<br/>[signals.py]"]
  node_contracts["Output contracts<br/>[contracts.py]"]
  node_synthesis["Recommendation synthesis<br/>[synthesis.py]"]
  node_cache["Run request cache<br/>[runcache.py]"]
end

subgraph group_data["Market data and retrieval"]
  node_market["Market feeds and data<br/>[market.py]"]
  node_live["Live data adapters<br/>[live.py]"]
  node_filing_corpus["Filing corpus<br/>[corpus.py]"]
  node_corpus_history["Corpus history<br/>[corpus_history.py]"]
  node_rag["Filing retrieval<br/>[rag.py]"]
  node_vectorstore[("Vector index<br/>[vectorstore.py]")]
  node_lexicon["Finance lexicon<br/>[lexicon.py]"]
end

subgraph group_personal["Personal finance and state"]
  node_portfolio["Portfolio risk<br/>[portfolio.py]"]
  node_alerts["User alerts<br/>[alerts.py]"]
  node_store[("Account and run store<br/>[store.py]")]
end

subgraph group_evaluation["Evaluation"]
  node_calibration["Confidence calibration<br/>[calibration.py]"]
  node_backtest["Signal back-test<br/>[backtest.py]"]
  node_strategy["Strategy back-test<br/>[strategy.py]"]
end

node_browser(("Investor browser"))

node_browser -->|"loads"| node_dashboard
node_dashboard -->|"calls"| node_api
node_api -->|"authenticates"| node_security
node_api -->|"requests analysis"| node_engine
node_api -->|"reads and writes"| node_store
node_engine -->|"dispatches"| node_agents
node_engine -->|"synthesizes outputs"| node_synthesis
node_engine -->|"persists runs"| node_store
node_engine -->|"computes risk"| node_portfolio
node_engine -->|"evaluates rules"| node_alerts
node_engine -->|"uses evaluation"| node_backtest
node_engine -->|"runs strategies"| node_strategy
node_engine -->|"caches requests"| node_cache
node_agents -->|"computes signals"| node_signals
node_agents -->|"returns structured outputs"| node_contracts
node_agents -->|"reads feeds"| node_market
node_agents -->|"retrieves filings"| node_rag
node_agents -->|"uses user risk"| node_portfolio
node_agents -->|"uses user history"| node_store
node_synthesis -->|"calibrates confidence"| node_calibration
node_synthesis -->|"consumes outputs"| node_contracts
node_market -.->|"supports live mode"| node_live
node_live -->|"provides live feeds"| node_market
node_rag -->|"indexes passages"| node_filing_corpus
node_rag -->|"searches vectors"| node_vectorstore
node_rag -->|"expands queries"| node_lexicon
node_corpus_history -.->|"maintains history"| node_filing_corpus
node_backtest -->|"evaluates signals"| node_signals
node_backtest -->|"uses historical data"| node_market
node_strategy -->|"reuses signal grid"| node_backtest
node_api -->|"uses settings"| node_config

click node_dashboard "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/static/index.html"
click node_api "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/server.py"
click node_security "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/security.py"
click node_engine "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/engine.py"
click node_agents "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/agents.py"
click node_signals "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/signals.py"
click node_contracts "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/contracts.py"
click node_synthesis "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/synthesis.py"
click node_calibration "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/calibration.py"
click node_market "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/market.py"
click node_live "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/live.py"
click node_filing_corpus "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/corpus.py"
click node_corpus_history "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/corpus_history.py"
click node_rag "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/rag.py"
click node_vectorstore "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/vectorstore.py"
click node_portfolio "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/portfolio.py"
click node_alerts "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/alerts.py"
click node_store "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/store.py"
click node_backtest "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/backtest.py"
click node_strategy "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/strategy.py"
click node_cache "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/runcache.py"
click node_lexicon "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/lexicon.py"
click node_config "https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/config.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_dashboard,node_api,node_security,node_config,node_browser toneBlue
class node_engine,node_agents,node_signals,node_contracts,node_synthesis,node_cache toneAmber
class node_market,node_live,node_filing_corpus,node_corpus_history,node_rag,node_vectorstore,node_lexicon toneMint
class node_portfolio,node_alerts,node_store toneRose
class node_calibration,node_backtest,node_strategy toneIndigo
```

## Components

### User experience and API

- [Web dashboard](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/static/index.html): `app/static/index.html`
- [REST API](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/server.py): `app/server.py`
- [Account security](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/security.py): `app/security.py`
- [Runtime configuration](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/config.py): `app/config.py`

### Analysis pipeline

- [Analysis engine](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/engine.py): `app/engine.py`
- [Six agents](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/agents.py): `app/agents.py`
- [Signal functions](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/signals.py): `app/signals.py`
- [Output contracts](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/contracts.py): `app/contracts.py`
- [Recommendation synthesis](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/synthesis.py): `app/synthesis.py`
- [Run request cache](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/runcache.py): `app/runcache.py`

### Market data and retrieval

- [Market feeds and data](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/market.py): `app/market.py`
- [Live data adapters](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/live.py): `app/live.py`
- [Filing corpus](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/corpus.py): `app/corpus.py`
- [Corpus history](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/corpus_history.py): `app/corpus_history.py`
- [Filing retrieval](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/rag.py): `app/rag.py`
- [Vector index](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/vectorstore.py): `app/vectorstore.py`
- [Finance lexicon](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/lexicon.py): `app/lexicon.py`

### Personal finance and state

- [Portfolio risk](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/portfolio.py): `app/portfolio.py`
- [User alerts](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/alerts.py): `app/alerts.py`
- [Account and run store](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/store.py): `app/store.py`

### Evaluation

- [Confidence calibration](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/calibration.py): `app/calibration.py`
- [Signal back-test](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/backtest.py): `app/backtest.py`
- [Strategy back-test](https://github.com/sahinurrahman-debug/vibefinance/blob/main/app/strategy.py): `app/strategy.py`

### Other components

- **Investor browser**

## Connections

- Investor browser → Web dashboard: loads (evidence: `README.md`)
- Web dashboard → REST API: calls (evidence: `README.md`)
- REST API → Account security: authenticates (evidence: `README.md`)
- REST API → Analysis engine: requests analysis (evidence: `README.md`)
- REST API → Account and run store: reads and writes (evidence: `README.md`)
- Analysis engine → Six agents: dispatches (evidence: `README.md`)
- Analysis engine → Recommendation synthesis: synthesizes outputs (evidence: `README.md`)
- Analysis engine → Account and run store: persists runs (evidence: `README.md`)
- Analysis engine → Portfolio risk: computes risk (evidence: `README.md`)
- Analysis engine → User alerts: evaluates rules (evidence: `README.md`)
- Analysis engine → Signal back-test: uses evaluation (evidence: `README.md`)
- Analysis engine → Strategy back-test: runs strategies (evidence: `README.md`)
- Analysis engine → Run request cache: caches requests (evidence: `app/engine.py`)
- Six agents → Signal functions: computes signals (evidence: `app/agents.py`)
- Six agents → Output contracts: returns structured outputs (evidence: `README.md`)
- Six agents → Market feeds and data: reads feeds (evidence: `app/agents.py`)
- Six agents → Filing retrieval: retrieves filings (evidence: `README.md`)
- Six agents → Portfolio risk: uses user risk (evidence: `README.md`)
- Six agents → Account and run store: uses user history (evidence: `README.md`)
- Recommendation synthesis → Confidence calibration: calibrates confidence (evidence: `app/synthesis.py`)
- Recommendation synthesis → Output contracts: consumes outputs (evidence: `app/synthesis.py`)
- Market feeds and data → Live data adapters: supports live mode (evidence: `README.md`)
- Live data adapters → Market feeds and data: provides live feeds (evidence: `README.md`)
- Filing retrieval → Filing corpus: indexes passages (evidence: `app/rag.py`)
- Filing retrieval → Vector index: searches vectors (evidence: `app/rag.py`)
- Filing retrieval → Finance lexicon: expands queries (evidence: `README.md`)
- Corpus history → Filing corpus: maintains history (evidence: `app/corpus_history.py`)
- Signal back-test → Signal functions: evaluates signals (evidence: `app/backtest.py`)
- Signal back-test → Market feeds and data: uses historical data (evidence: `app/backtest.py`)
- Strategy back-test → Signal back-test: reuses signal grid (evidence: `README.md`)
- REST API → Runtime configuration: uses settings (evidence: `app/server.py`)
