# chazz-45/daybreak architecture

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

- Interactive diagram: https://gitdiagram.com/chazz-45/daybreak
- Repository: https://github.com/chazz-45/daybreak

## Overview

DayBreak is a Next.js news discovery and reading app with sample or GNews feeds, an India feed, browser-local bookmarks, and opt-in Gemini features. Readers browse or filter stories, open story pages, and can save or request AI assistance; the home and India pages also fetch news directly through the provider adapter. The API routes provide separate news and AI request paths. The graph follows shown calls and README-documented integrations; some component internals and subsystem wiring were not sampled, so those relationships are omitted.

Main entry points: [`app/page.tsx`](https://github.com/chazz-45/daybreak/blob/main/app/page.tsx) (Home feed), [`lib/news-provider.ts`](https://github.com/chazz-45/daybreak/blob/main/lib/news-provider.ts) (News adapter), [`components/news-card.tsx`](https://github.com/chazz-45/daybreak/blob/main/components/news-card.tsx) (News card), [`components/bookmark-button.tsx`](https://github.com/chazz-45/daybreak/blob/main/components/bookmark-button.tsx) (Bookmark controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["News discovery"]
  node_home["Home feed<br/>[page.tsx]"]
  node_india["India feed<br/>[page.tsx]"]
end

subgraph group_reading["Story reading"]
  node_storypage["Story page<br/>[page.tsx]"]
  node_card["News card<br/>[news-card.tsx]"]
  node_image["Article image<br/>[article-image.tsx]"]
  node_bookmarks["Bookmark controls"]
  node_bookmarkstore["Bookmark storage<br/>[bookmarks.ts]"]
  node_bookmarkpage["Saved list<br/>[page.tsx]"]
end

subgraph group_intelligence["AI tools"]
  node_feedai["Feed AI tools<br/>[ai-feed-tools.tsx]"]
  node_storyai["Story AI tools<br/>[ai-story-tools.tsx]"]
  node_aisummary["Summary control"]
end

subgraph group_services["Server services"]
  node_query["Query parsing<br/>[news-query.ts]"]
  node_provider["News adapter<br/>[news-provider.ts]"]
  node_gnews["GNews"]
  node_samples["Sample stories<br/>[sample-news.ts]"]
  node_newsapi["News API<br/>[route.ts]"]
  node_aiapi["AI insights API<br/>[route.ts]"]
  node_aivalidation["AI request validation<br/>[ai-insights.ts]"]
  node_gemini["Gemini adapter<br/>[gemini.ts]"]
  node_geminiservice["Gemini API"]
end

node_reader(("Reader"))

node_reader -->|"browses"| node_home
node_reader -->|"browses"| node_india
node_home -->|"parses filters"| node_query
node_home -->|"fetches feed"| node_provider
node_india -->|"fetches headlines"| node_provider
node_provider -->|"uses sample data"| node_samples
node_provider -.->|"requests articles"| node_gnews
node_reader -.->|"requests feed"| node_newsapi
node_newsapi -->|"parses parameters"| node_query
node_newsapi -->|"gets news"| node_provider
node_reader -->|"opens story"| node_storypage
node_home -->|"renders stories"| node_card
node_card -->|"renders image"| node_image
node_card -->|"renders controls"| node_bookmarks
node_reader -->|"saves story"| node_bookmarks
node_bookmarks -->|"reads and writes"| node_bookmarkstore
node_reader -->|"views saved"| node_bookmarkpage
node_bookmarkpage -->|"renders list"| node_bookmarks
node_home -->|"renders tools"| node_feedai
node_feedai -->|"posts insights"| node_aiapi
node_reader -.->|"requests story AI"| node_storyai
node_card -->|"renders summary action"| node_aisummary
node_aiapi -->|"validates request"| node_aivalidation
node_aiapi -->|"generates insight"| node_gemini
node_gemini -.->|"sends AI request"| node_geminiservice

click node_home "https://github.com/chazz-45/daybreak/blob/main/app/page.tsx"
click node_india "https://github.com/chazz-45/daybreak/blob/main/app/india/page.tsx"
click node_query "https://github.com/chazz-45/daybreak/blob/main/lib/news-query.ts"
click node_provider "https://github.com/chazz-45/daybreak/blob/main/lib/news-provider.ts"
click node_samples "https://github.com/chazz-45/daybreak/blob/main/lib/sample-news.ts"
click node_newsapi "https://github.com/chazz-45/daybreak/blob/main/app/api/news/route.ts"
click node_storypage "https://github.com/chazz-45/daybreak/blob/main/app/story/%5Bid%5D/page.tsx"
click node_card "https://github.com/chazz-45/daybreak/blob/main/components/news-card.tsx"
click node_image "https://github.com/chazz-45/daybreak/blob/main/components/article-image.tsx"
click node_bookmarks "https://github.com/chazz-45/daybreak/blob/main/components/bookmark-button.tsx"
click node_bookmarkstore "https://github.com/chazz-45/daybreak/blob/main/lib/bookmarks.ts"
click node_bookmarkpage "https://github.com/chazz-45/daybreak/blob/main/app/bookmarks/page.tsx"
click node_feedai "https://github.com/chazz-45/daybreak/blob/main/components/ai-feed-tools.tsx"
click node_storyai "https://github.com/chazz-45/daybreak/blob/main/components/ai-story-tools.tsx"
click node_aisummary "https://github.com/chazz-45/daybreak/blob/main/components/ai-summary-button.tsx"
click node_aiapi "https://github.com/chazz-45/daybreak/blob/main/app/api/ai/insights/route.ts"
click node_aivalidation "https://github.com/chazz-45/daybreak/blob/main/lib/ai-insights.ts"
click node_gemini "https://github.com/chazz-45/daybreak/blob/main/lib/gemini.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_home,node_india toneBlue
class node_storypage,node_card,node_image,node_bookmarks,node_bookmarkstore,node_bookmarkpage toneAmber
class node_feedai,node_storyai,node_aisummary toneMint
class node_query,node_provider,node_gnews,node_samples,node_newsapi,node_aiapi,node_aivalidation,node_gemini,node_geminiservice toneRose
class node_reader toneIndigo
```

## Components

### News discovery

- [Home feed](https://github.com/chazz-45/daybreak/blob/main/app/page.tsx): `app/page.tsx`
- [India feed](https://github.com/chazz-45/daybreak/blob/main/app/india/page.tsx): `app/india/page.tsx`

### Story reading

- [Story page](https://github.com/chazz-45/daybreak/blob/main/app/story/%5Bid%5D/page.tsx): `app/story/[id]/page.tsx`
- [News card](https://github.com/chazz-45/daybreak/blob/main/components/news-card.tsx): `components/news-card.tsx`
- [Article image](https://github.com/chazz-45/daybreak/blob/main/components/article-image.tsx): `components/article-image.tsx`
- [Bookmark controls](https://github.com/chazz-45/daybreak/blob/main/components/bookmark-button.tsx): `components/bookmark-button.tsx`
- [Bookmark storage](https://github.com/chazz-45/daybreak/blob/main/lib/bookmarks.ts): `lib/bookmarks.ts`
- [Saved list](https://github.com/chazz-45/daybreak/blob/main/app/bookmarks/page.tsx): `app/bookmarks/page.tsx`

### AI tools

- [Feed AI tools](https://github.com/chazz-45/daybreak/blob/main/components/ai-feed-tools.tsx): `components/ai-feed-tools.tsx`
- [Story AI tools](https://github.com/chazz-45/daybreak/blob/main/components/ai-story-tools.tsx): `components/ai-story-tools.tsx`
- [Summary control](https://github.com/chazz-45/daybreak/blob/main/components/ai-summary-button.tsx): `components/ai-summary-button.tsx`

### Server services

- [Query parsing](https://github.com/chazz-45/daybreak/blob/main/lib/news-query.ts): `lib/news-query.ts`
- [News adapter](https://github.com/chazz-45/daybreak/blob/main/lib/news-provider.ts): `lib/news-provider.ts`
- **GNews**
- [Sample stories](https://github.com/chazz-45/daybreak/blob/main/lib/sample-news.ts): `lib/sample-news.ts`
- [News API](https://github.com/chazz-45/daybreak/blob/main/app/api/news/route.ts): `app/api/news/route.ts`
- [AI insights API](https://github.com/chazz-45/daybreak/blob/main/app/api/ai/insights/route.ts): `app/api/ai/insights/route.ts`
- [AI request validation](https://github.com/chazz-45/daybreak/blob/main/lib/ai-insights.ts): `lib/ai-insights.ts`
- [Gemini adapter](https://github.com/chazz-45/daybreak/blob/main/lib/gemini.ts): `lib/gemini.ts`
- **Gemini API**

### Other components

- **Reader**

## Connections

- Reader → Home feed: browses (evidence: `app/page.tsx`)
- Reader → India feed: browses (evidence: `app/india/page.tsx`)
- Home feed → Query parsing: parses filters (evidence: `app/page.tsx`)
- Home feed → News adapter: fetches feed (evidence: `app/page.tsx`)
- India feed → News adapter: fetches headlines (evidence: `app/india/page.tsx`)
- News adapter → Sample stories: uses sample data (evidence: `lib/news-provider.ts`)
- News adapter → GNews: requests articles (evidence: `README.md`)
- Reader → News API: requests feed (evidence: `app/api/news/route.ts`)
- News API → Query parsing: parses parameters (evidence: `app/api/news/route.ts`)
- News API → News adapter: gets news (evidence: `app/api/news/route.ts`)
- Reader → Story page: opens story (evidence: `app/story/[id]/page.tsx`)
- Home feed → News card: renders stories (evidence: `app/page.tsx`)
- News card → Article image: renders image (evidence: `components/news-card.tsx`)
- News card → Bookmark controls: renders controls (evidence: `components/news-card.tsx`)
- Reader → Bookmark controls: saves story (evidence: `components/bookmark-button.tsx`)
- Bookmark controls → Bookmark storage: reads and writes (evidence: `components/bookmark-button.tsx`)
- Reader → Saved list: views saved (evidence: `app/bookmarks/page.tsx`)
- Saved list → Bookmark controls: renders list (evidence: `app/bookmarks/page.tsx`)
- Home feed → Feed AI tools: renders tools (evidence: `app/page.tsx`)
- Feed AI tools → AI insights API: posts insights (evidence: `components/ai-feed-tools.tsx`)
- Reader → Story AI tools: requests story AI (evidence: `README.md`)
- News card → Summary control: renders summary action (evidence: `components/news-card.tsx`)
- AI insights API → AI request validation: validates request (evidence: `app/api/ai/insights/route.ts`)
- AI insights API → Gemini adapter: generates insight (evidence: `app/api/ai/insights/route.ts`)
- Gemini adapter → Gemini API: sends AI request (evidence: `README.md`)
