# pranavkuruvella/stocks architecture

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

- Interactive diagram: https://gitdiagram.com/pranavkuruvella/stocks
- Repository: https://github.com/pranavkuruvella/stocks

## Overview

This is a stock-market dashboard with email sign-up/sign-in as a key user workflow: users submit credentials, the server delegates authentication to Better Auth, and successful sign-up dispatches an Inngest event. The dashboard presents market overview, heatmap, stories, and quotes through TradingView widgets; stock detail, search, and watchlists are additional product areas evident from the tree. Background email/news jobs and several data paths are represented cautiously: their implementation was not excerpted, so uncertain connections are dashed and unverified.

Main entry points: [`lib/actions/auth.actions.ts`](https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/auth.actions.ts) (Authentication actions), [`app/(auth)/sign-up/page.tsx`](https://github.com/pranavkuruvella/stocks/blob/main/app/(auth)/sign-up/page.tsx) (Profile preferences form), [`components/TradingViewWidget.tsx`](https://github.com/pranavkuruvella/stocks/blob/main/components/TradingViewWidget.tsx) (TradingView embeds), [`app/api/inngest/route.ts`](https://github.com/pranavkuruvella/stocks/blob/main/app/api/inngest/route.ts) (Inngest endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_auth_pages["Sign-in and sign-up<br/>[page.tsx]"]
  node_signup_form["Profile preferences form<br/>[page.tsx]"]
  node_dashboard["Market dashboard<br/>[page.tsx]"]
  node_stock_page["Stock detail page<br/>[page.tsx]"]
  node_search["Stock search<br/>[SearchCommand.tsx]"]
  node_watchlist_ui["Watchlist controls"]
  node_form_controls["Form controls"]
end

subgraph group_identity["Identity and accounts"]
  node_auth_actions["Authentication actions<br/>[auth.actions.ts]"]
  node_better_auth["Better Auth<br/>[auth.ts]"]
  node_user_actions["User actions<br/>[user.actions.ts]"]
  node_database[("MongoDB connection<br/>[mongoose.ts]")]
  node_watchlist_actions["Watchlist actions"]
  node_watchlist_model[("Watchlist model<br/>[watchlist.model.ts]")]
end

subgraph group_market["Market information"]
  node_tradingview_widget["TradingView embeds"]
  node_finnhub_actions["Market data actions<br/>[finnhub.actions.ts]"]
  node_tradingview_service["TradingView"]
  node_finnhub_service["Finnhub"]
end

subgraph group_jobs["Background jobs"]
  node_inngest_client["Inngest client<br/>[client.ts]"]
  node_inngest_route["Inngest endpoint<br/>[route.ts]"]
  node_job_functions["Email and news jobs<br/>[functions.ts]"]
  node_email_service["Email delivery<br/>[index.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"submits credentials"| node_auth_pages
node_visitor -->|"enters preferences"| node_signup_form
node_signup_form -->|"renders fields"| node_form_controls
node_auth_pages -->|"calls sign-in"| node_auth_actions
node_signup_form -->|"calls sign-up"| node_auth_actions
node_auth_actions -->|"calls auth API"| node_better_auth
node_better_auth -->|"connects database"| node_database
node_auth_actions -->|"sends signup event"| node_inngest_client
node_inngest_route -->|"serves client"| node_inngest_client
node_inngest_route -->|"registers jobs"| node_job_functions
node_job_functions -.->|"may deliver email"| node_email_service
node_dashboard -->|"renders widgets"| node_tradingview_widget
node_tradingview_widget -.->|"loads embeds"| node_tradingview_service
node_stock_page -.->|"may render charts"| node_tradingview_widget
node_search -.->|"may request quotes"| node_finnhub_actions
node_finnhub_actions -.->|"may fetch market data"| node_finnhub_service
node_watchlist_ui -.->|"may update list"| node_watchlist_actions
node_watchlist_actions -.->|"may access model"| node_watchlist_model
node_user_actions -.->|"may access accounts"| node_database

click node_auth_pages "https://github.com/pranavkuruvella/stocks/blob/main/app/(auth)/sign-in/page.tsx"
click node_signup_form "https://github.com/pranavkuruvella/stocks/blob/main/app/(auth)/sign-up/page.tsx"
click node_dashboard "https://github.com/pranavkuruvella/stocks/blob/main/app/(root)/page.tsx"
click node_stock_page "https://github.com/pranavkuruvella/stocks/blob/main/app/(root)/stocks/%5Bsymbol%5D/page.tsx"
click node_search "https://github.com/pranavkuruvella/stocks/blob/main/components/SearchCommand.tsx"
click node_watchlist_ui "https://github.com/pranavkuruvella/stocks/blob/main/components/watchlistButton.tsx"
click node_form_controls "https://github.com/pranavkuruvella/stocks/tree/main/components/forms"
click node_tradingview_widget "https://github.com/pranavkuruvella/stocks/blob/main/components/TradingViewWidget.tsx"
click node_finnhub_actions "https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/finnhub.actions.ts"
click node_auth_actions "https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/auth.actions.ts"
click node_better_auth "https://github.com/pranavkuruvella/stocks/blob/main/lib/better-auth/auth.ts"
click node_user_actions "https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/user.actions.ts"
click node_database "https://github.com/pranavkuruvella/stocks/blob/main/database/mongoose.ts"
click node_watchlist_actions "https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/watchlist.actions.ts"
click node_watchlist_model "https://github.com/pranavkuruvella/stocks/blob/main/database/models/watchlist.model.ts"
click node_inngest_client "https://github.com/pranavkuruvella/stocks/blob/main/lib/inngest/client.ts"
click node_inngest_route "https://github.com/pranavkuruvella/stocks/blob/main/app/api/inngest/route.ts"
click node_job_functions "https://github.com/pranavkuruvella/stocks/blob/main/lib/inngest/functions.ts"
click node_email_service "https://github.com/pranavkuruvella/stocks/blob/main/lib/nodemailer/index.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_auth_pages,node_signup_form,node_dashboard,node_stock_page,node_search,node_watchlist_ui,node_form_controls toneBlue
class node_auth_actions,node_better_auth,node_user_actions,node_database,node_watchlist_actions,node_watchlist_model toneAmber
class node_tradingview_widget,node_finnhub_actions,node_tradingview_service,node_finnhub_service toneMint
class node_inngest_client,node_inngest_route,node_job_functions,node_email_service toneRose
class node_visitor toneIndigo
```

## Components

### User experience

- [Sign-in and sign-up](https://github.com/pranavkuruvella/stocks/blob/main/app/(auth)/sign-in/page.tsx): `app/(auth)/sign-in/page.tsx`
- [Profile preferences form](https://github.com/pranavkuruvella/stocks/blob/main/app/(auth)/sign-up/page.tsx): `app/(auth)/sign-up/page.tsx`
- [Market dashboard](https://github.com/pranavkuruvella/stocks/blob/main/app/(root)/page.tsx): `app/(root)/page.tsx`
- [Stock detail page](https://github.com/pranavkuruvella/stocks/blob/main/app/(root)/stocks/%5Bsymbol%5D/page.tsx): `app/(root)/stocks/[symbol]/page.tsx`
- [Stock search](https://github.com/pranavkuruvella/stocks/blob/main/components/SearchCommand.tsx): `components/SearchCommand.tsx`
- [Watchlist controls](https://github.com/pranavkuruvella/stocks/blob/main/components/watchlistButton.tsx): `components/watchlistButton.tsx`
- [Form controls](https://github.com/pranavkuruvella/stocks/tree/main/components/forms): `components/forms`

### Identity and accounts

- [Authentication actions](https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/auth.actions.ts): `lib/actions/auth.actions.ts`
- [Better Auth](https://github.com/pranavkuruvella/stocks/blob/main/lib/better-auth/auth.ts): `lib/better-auth/auth.ts`
- [User actions](https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/user.actions.ts): `lib/actions/user.actions.ts`
- [MongoDB connection](https://github.com/pranavkuruvella/stocks/blob/main/database/mongoose.ts): `database/mongoose.ts`
- [Watchlist actions](https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/watchlist.actions.ts): `lib/actions/watchlist.actions.ts`
- [Watchlist model](https://github.com/pranavkuruvella/stocks/blob/main/database/models/watchlist.model.ts): `database/models/watchlist.model.ts`

### Market information

- [TradingView embeds](https://github.com/pranavkuruvella/stocks/blob/main/components/TradingViewWidget.tsx): `components/TradingViewWidget.tsx`
- [Market data actions](https://github.com/pranavkuruvella/stocks/blob/main/lib/actions/finnhub.actions.ts): `lib/actions/finnhub.actions.ts`
- **TradingView**
- **Finnhub**

### Background jobs

- [Inngest client](https://github.com/pranavkuruvella/stocks/blob/main/lib/inngest/client.ts): `lib/inngest/client.ts`
- [Inngest endpoint](https://github.com/pranavkuruvella/stocks/blob/main/app/api/inngest/route.ts): `app/api/inngest/route.ts`
- [Email and news jobs](https://github.com/pranavkuruvella/stocks/blob/main/lib/inngest/functions.ts): `lib/inngest/functions.ts`
- [Email delivery](https://github.com/pranavkuruvella/stocks/blob/main/lib/nodemailer/index.ts): `lib/nodemailer/index.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Sign-in and sign-up: submits credentials (evidence: `app/(auth)/sign-in/page.tsx`)
- Visitor → Profile preferences form: enters preferences (evidence: `app/(auth)/sign-up/page.tsx`)
- Profile preferences form → Form controls: renders fields (evidence: `app/(auth)/sign-up/page.tsx`)
- Sign-in and sign-up → Authentication actions: calls sign-in (evidence: `app/(auth)/sign-in/page.tsx`)
- Profile preferences form → Authentication actions: calls sign-up (evidence: `app/(auth)/sign-up/page.tsx`)
- Authentication actions → Better Auth: calls auth API (evidence: `lib/actions/auth.actions.ts`)
- Better Auth → MongoDB connection: connects database (evidence: `lib/better-auth/auth.ts`)
- Authentication actions → Inngest client: sends signup event (evidence: `lib/actions/auth.actions.ts`)
- Inngest endpoint → Inngest client: serves client (evidence: `app/api/inngest/route.ts`)
- Inngest endpoint → Email and news jobs: registers jobs (evidence: `app/api/inngest/route.ts`)
- Email and news jobs → Email delivery: may deliver email
- Market dashboard → TradingView embeds: renders widgets (evidence: `app/(root)/page.tsx`)
- TradingView embeds → TradingView: loads embeds
- Stock detail page → TradingView embeds: may render charts
- Stock search → Market data actions: may request quotes
- Market data actions → Finnhub: may fetch market data
- Watchlist controls → Watchlist actions: may update list
- Watchlist actions → Watchlist model: may access model
- User actions → MongoDB connection: may access accounts
