# anantatantia-cmd/tipcheck architecture

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

- Interactive diagram: https://gitdiagram.com/anantatantia-cmd/tipcheck
- Repository: https://github.com/anantatantia-cmd/tipcheck

## Overview

TipCheck is an India-focused investing education and stock-tip reality-check app. Its main workflow accepts pasted text or a screenshot, validates it, uses Gemini to extract claims, checks companies, sources, red flags and price claims, then presents a safety-checked card. Separate product branches provide stock reports and comparisons, a rule-based investment-kind planner, a beginner explainer, a browser-only practice watchlist, and lessons. The graph follows documented routes and sampled imports; some unsampled page-to-API wiring is shown only where the README documents it.

Main entry points: [`lib/pipeline.ts`](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/pipeline.ts) (Tip pipeline), [`app/stocks/StocksView.tsx`](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/stocks/StocksView.tsx) (Stock report page), [`lib/ai.ts`](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/ai.ts) (Gemini tasks), [`components/Checker.tsx`](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/Checker.tsx) (Tip input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tips["Tip reality check"]
  node_checker["Tip input<br/>[Checker.tsx]"]
  node_check_api["Check endpoint<br/>[route.ts]"]
  node_validation["Input validation<br/>[validateInput.ts]"]
  node_pipeline["Tip pipeline<br/>[pipeline.ts]"]
  node_ai["Gemini tasks<br/>[ai.ts]"]
  node_company_match["Company matching<br/>[companies.ts]"]
  node_source_check["SEBI lookup<br/>[sebi.ts]"]
  node_red_flags["Red-flag rules<br/>[redFlags.ts]"]
  node_risk["Risk scoring<br/>[risk.ts]"]
  node_tip_card["Reality-check card<br/>[TipCard.tsx]"]
end

subgraph group_market["Market research"]
  node_stock_search["Stock search<br/>[StockSearch.tsx]"]
  node_stocks_view["Stock report page<br/>[StocksView.tsx]"]
  node_stock_api["Stock endpoint<br/>[route.ts]"]
  node_market_data["Market reports<br/>[market.ts]"]
  node_report_view["Report display"]
  node_price_chart["Price chart<br/>[PriceChart.tsx]"]
  node_compare["Stock comparison<br/>[CompareView.tsx]"]
end

subgraph group_planning["Investment planning"]
  node_planner["Planner interface<br/>[PlanView.tsx]"]
  node_plan_rules["Plan rules<br/>[plan.ts]"]
  node_plan_api["Plan endpoint<br/>[route.ts]"]
  node_plan_summary_api["Summary endpoint<br/>[route.ts]"]
end

subgraph group_learning["Learning and help"]
  node_ask_view["AI explainer<br/>[AskView.tsx]"]
  node_ask_api["Explainer endpoint<br/>[route.ts]"]
  node_watchlist["Watchlist practice<br/>[WatchlistView.tsx]"]
  node_learn["Lessons and quiz<br/>[LearnView.tsx]"]
end

subgraph group_shared["Shared safeguards"]
  node_no_advice["Advice guard<br/>[noAdvice.ts]"]
  node_storage[("Browser storage<br/>[storage.ts]")]
end

node_user(("Investor"))
node_gemini_service{{"Google Gemini"}}

node_user -->|"submits tip"| node_checker
node_checker -->|"posts tip"| node_check_api
node_check_api -->|"validates input"| node_validation
node_check_api -->|"runs checks"| node_pipeline
node_pipeline -->|"reads and writes"| node_ai
node_pipeline -->|"matches company"| node_company_match
node_pipeline -->|"checks source"| node_source_check
node_pipeline -->|"finds flags"| node_red_flags
node_pipeline -->|"scores risk"| node_risk
node_pipeline -->|"checks price claims"| node_market_data
node_pipeline -->|"checks wording"| node_no_advice
node_pipeline -->|"returns card"| node_tip_card
node_checker -->|"renders result"| node_tip_card
node_ai -->|"requests generation"| node_gemini_service
node_user -->|"searches stock"| node_stocks_view
node_stocks_view -->|"offers search"| node_stock_search
node_stock_search -->|"fetches matches"| node_stock_api
node_stocks_view -->|"loads report"| node_stock_api
node_stock_api -->|"gets report"| node_market_data
node_stocks_view -->|"renders report"| node_report_view
node_report_view -->|"renders chart"| node_price_chart
node_user -->|"compares stocks"| node_compare
node_compare -->|"loads reports"| node_stocks_view
node_user -->|"answers questions"| node_planner
node_planner -->|"submits profile"| node_plan_api
node_plan_api -->|"builds plan"| node_plan_rules
node_planner -->|"requests summary"| node_plan_summary_api
node_plan_summary_api -->|"uses plan facts"| node_plan_rules
node_plan_summary_api -->|"summarises facts"| node_ai
node_user -->|"asks question"| node_ask_view
node_ask_view -->|"posts question"| node_ask_api
node_ask_api -->|"explains question"| node_ai
node_ask_api -->|"checks answer"| node_no_advice
node_user -->|"saves practice"| node_watchlist
node_watchlist -->|"stores locally"| node_storage
node_user -->|"studies lessons"| node_learn
node_learn -->|"saves progress"| node_storage

click node_checker "https://github.com/anantatantia-cmd/tipcheck/blob/main/components/Checker.tsx"
click node_check_api "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/check/route.ts"
click node_validation "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/validateInput.ts"
click node_pipeline "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/pipeline.ts"
click node_ai "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/ai.ts"
click node_company_match "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/companies.ts"
click node_source_check "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/sebi.ts"
click node_red_flags "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/redFlags.ts"
click node_risk "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/risk.ts"
click node_tip_card "https://github.com/anantatantia-cmd/tipcheck/blob/main/components/TipCard.tsx"
click node_no_advice "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/noAdvice.ts"
click node_stock_search "https://github.com/anantatantia-cmd/tipcheck/blob/main/components/StockSearch.tsx"
click node_stocks_view "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/stocks/StocksView.tsx"
click node_stock_api "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/stocks/route.ts"
click node_market_data "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/market.ts"
click node_report_view "https://github.com/anantatantia-cmd/tipcheck/blob/main/components/StockReportView.tsx"
click node_price_chart "https://github.com/anantatantia-cmd/tipcheck/blob/main/components/PriceChart.tsx"
click node_compare "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/compare/CompareView.tsx"
click node_planner "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/plan/PlanView.tsx"
click node_plan_rules "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/plan.ts"
click node_plan_api "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/plan/route.ts"
click node_plan_summary_api "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/plan/summary/route.ts"
click node_ask_view "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/ask/AskView.tsx"
click node_ask_api "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/ask/route.ts"
click node_watchlist "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/watchlist/WatchlistView.tsx"
click node_storage "https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/storage.ts"
click node_learn "https://github.com/anantatantia-cmd/tipcheck/blob/main/app/learn/LearnView.tsx"

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_checker,node_check_api,node_validation,node_pipeline,node_ai,node_company_match,node_source_check,node_red_flags,node_risk,node_tip_card toneBlue
class node_stock_search,node_stocks_view,node_stock_api,node_market_data,node_report_view,node_price_chart,node_compare toneAmber
class node_planner,node_plan_rules,node_plan_api,node_plan_summary_api toneMint
class node_ask_view,node_ask_api,node_watchlist,node_learn toneRose
class node_no_advice,node_storage,node_user,node_gemini_service toneIndigo
```

## Components

### Tip reality check

- [Tip input](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/Checker.tsx): `components/Checker.tsx`
- [Check endpoint](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/check/route.ts): `app/api/check/route.ts`
- [Input validation](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/validateInput.ts): `lib/validateInput.ts`
- [Tip pipeline](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/pipeline.ts): `lib/pipeline.ts`
- [Gemini tasks](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/ai.ts): `lib/ai.ts`
- [Company matching](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/companies.ts): `lib/companies.ts`
- [SEBI lookup](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/sebi.ts): `lib/sebi.ts`
- [Red-flag rules](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/redFlags.ts): `lib/redFlags.ts`
- [Risk scoring](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/risk.ts): `lib/risk.ts`
- [Reality-check card](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/TipCard.tsx): `components/TipCard.tsx`

### Market research

- [Stock search](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/StockSearch.tsx): `components/StockSearch.tsx`
- [Stock report page](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/stocks/StocksView.tsx): `app/stocks/StocksView.tsx`
- [Stock endpoint](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/stocks/route.ts): `app/api/stocks/route.ts`
- [Market reports](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/market.ts): `lib/market.ts`
- [Report display](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/StockReportView.tsx): `components/StockReportView.tsx`
- [Price chart](https://github.com/anantatantia-cmd/tipcheck/blob/main/components/PriceChart.tsx): `components/PriceChart.tsx`
- [Stock comparison](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/compare/CompareView.tsx): `app/compare/CompareView.tsx`

### Investment planning

- [Planner interface](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/plan/PlanView.tsx): `app/plan/PlanView.tsx`
- [Plan rules](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/plan.ts): `lib/plan.ts`
- [Plan endpoint](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/plan/route.ts): `app/api/plan/route.ts`
- [Summary endpoint](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/plan/summary/route.ts): `app/api/plan/summary/route.ts`

### Learning and help

- [AI explainer](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/ask/AskView.tsx): `app/ask/AskView.tsx`
- [Explainer endpoint](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/api/ask/route.ts): `app/api/ask/route.ts`
- [Watchlist practice](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/watchlist/WatchlistView.tsx): `app/watchlist/WatchlistView.tsx`
- [Lessons and quiz](https://github.com/anantatantia-cmd/tipcheck/blob/main/app/learn/LearnView.tsx): `app/learn/LearnView.tsx`

### Shared safeguards

- [Advice guard](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/noAdvice.ts): `lib/noAdvice.ts`
- [Browser storage](https://github.com/anantatantia-cmd/tipcheck/blob/main/lib/storage.ts): `lib/storage.ts`

### Other components

- **Investor**
- **Google Gemini**

## Connections

- Investor → Tip input: submits tip
- Tip input → Check endpoint: posts tip
- Check endpoint → Input validation: validates input (evidence: `app/api/check/route.ts`)
- Check endpoint → Tip pipeline: runs checks (evidence: `app/api/check/route.ts`)
- Tip pipeline → Gemini tasks: reads and writes (evidence: `lib/pipeline.ts`)
- Tip pipeline → Company matching: matches company (evidence: `lib/pipeline.ts`)
- Tip pipeline → SEBI lookup: checks source (evidence: `lib/pipeline.ts`)
- Tip pipeline → Red-flag rules: finds flags (evidence: `lib/pipeline.ts`)
- Tip pipeline → Risk scoring: scores risk (evidence: `lib/pipeline.ts`)
- Tip pipeline → Market reports: checks price claims (evidence: `lib/pipeline.ts`)
- Tip pipeline → Advice guard: checks wording (evidence: `lib/pipeline.ts`)
- Tip pipeline → Reality-check card: returns card
- Tip input → Reality-check card: renders result (evidence: `components/Checker.tsx`)
- Gemini tasks → Google Gemini: requests generation (evidence: `lib/ai.ts`)
- Investor → Stock report page: searches stock
- Stock report page → Stock search: offers search (evidence: `app/stocks/StocksView.tsx`)
- Stock search → Stock endpoint: fetches matches (evidence: `components/StockSearch.tsx`)
- Stock report page → Stock endpoint: loads report (evidence: `app/stocks/StocksView.tsx`)
- Stock endpoint → Market reports: gets report (evidence: `app/api/stocks/route.ts`)
- Stock report page → Report display: renders report (evidence: `app/stocks/StocksView.tsx`)
- Report display → Price chart: renders chart (evidence: `components/StockReportView.tsx`)
- Investor → Stock comparison: compares stocks
- Stock comparison → Stock report page: loads reports (evidence: `app/compare/CompareView.tsx`)
- Investor → Planner interface: answers questions
- Planner interface → Plan endpoint: submits profile
- Plan endpoint → Plan rules: builds plan (evidence: `app/api/plan/route.ts`)
- Planner interface → Summary endpoint: requests summary
- Summary endpoint → Plan rules: uses plan facts (evidence: `app/api/plan/summary/route.ts`)
- Summary endpoint → Gemini tasks: summarises facts (evidence: `app/api/plan/summary/route.ts`)
- Investor → AI explainer: asks question
- AI explainer → Explainer endpoint: posts question
- Explainer endpoint → Gemini tasks: explains question (evidence: `app/api/ask/route.ts`)
- Explainer endpoint → Advice guard: checks answer (evidence: `app/api/ask/route.ts`)
- Investor → Watchlist practice: saves practice
- Watchlist practice → Browser storage: stores locally (evidence: `lib/storage.ts`)
- Investor → Lessons and quiz: studies lessons
- Lessons and quiz → Browser storage: saves progress (evidence: `app/learn/LearnView.tsx`)
