# jaswanthreddyam-maker/tech_news architecture

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

- Interactive diagram: https://gitdiagram.com/jaswanthreddyam-maker/tech_news
- Repository: https://github.com/jaswanthreddyam-maker/tech_news

## Overview

#### Purpose and entry points
Tech News Today is an AI-assisted technology-news platform: it ingests RSS/web content, enriches and organizes it into stories and editorial views, then serves discovery, reading, search, recommendations, chat, and distribution experiences. Runtime entry points are the FastAPI service at `backend/main.py`, Celery worker configuration at `backend/celery_app.py`, and the Next.js application rooted at `frontend/src/app/layout.tsx` and `frontend/src/app/(public)/page.tsx`.

#### API and client boundary
The Python backend exposes versioned HTTP APIs, with v1 as the broad product surface and v2 for artifact, event, intent, and admin functions. Routes are the public boundary to application services, authorization, and persistence. The Next.js App Router provides public, auth, dashboard, editorial, article, search, chat, and workspace screens; its API clients normalize backend responses before presentation.
Paths: `backend/app/api/v1/router.py`, `backend/app/api/v2/routes/intents.py`, `frontend/src/lib/api/client.ts`, `frontend/src/app/(public)/articles/[slug]/page.tsx`.

#### Content ingestion and story formation
Source acquisition uses RSS/HTML agents and an ingestion pipeline to fetch, extract, filter, deduplicate, persist, assign articles to stories, derive related coverage, and generate/manage thumbnails. This is the main write-side flow: external publishers → raw/processed article and story records → emitted events/projections. Source-specific policies and thumbnail retries make ingestion an asynchronous operational subsystem.
Paths: `backend/agents/ingestion/rss_agent.py`, `backend/app/services/ingestion/pipeline.py`, `backend/app/services/ingestion/story_assignment.py`.

#### AI and knowledge intelligence
AI enrichment generates summaries, topics, entities, sentiment, embeddings, clustering, timelines, and provenance-aware artifacts. Provider adapters isolate OpenAI, Anthropic, and Gemini behind common contracts with caching, retry, circuit breaking, validation, cost, and telemetry controls. Knowledge-graph services resolve aliases/canonical entities, detect conflicts and duplicates, and evolve graph knowledge; semantic search and chat retrieve this enriched corpus.
Paths: `backend/app/ai/ai_pipeline.py`, `backend/app/ai/providers/factory.py`, `backend/app/services/knowledge_graph/evolution_pipeline.py`.

#### Events, CQRS, and projections
The system explicitly adopts event envelopes, an outbox, dispatching, and projection engines. Write-side domain models/events feed read models for article views, homepage sections, story dashboards, recommendations, analytics, and search; projection/replay/recovery support eventual-consistency operations. This boundary is central: UI-facing reads should favor projections rather than reconstructing raw ingestion state.
Paths: `backend/app/core/events/dispatcher.py`, `backend/app/core/projection/engine.py`, `backend/app/models/projection.py`.

#### Editorial, personalization, and distribution
Editorial services rank and curate content under category, diversity, freshness, lifecycle, and source-profile policies, then build homepage and desk projections. Behavioral telemetry, user interests, cohorts, and recommendation pipelines personalize feeds. Briefing/newsletter and distribution capabilities turn selected content into recipient deliveries over email or RSS.
Paths: `backend/app/editorial/homepage_builder.py`, `backend/app/recommendations/pipeline.py`, `backend/app/newsletter/service.py`.

#### Runtime infrastructure and operations
The deployed stack is Python/FastAPI, Celery scheduling/workers, Next.js/React, PostgreSQL with Alembic migrations, Redis, Docker Compose, and Nginx. Persistent/generated assets, database/cache volumes, logs, monitoring data, and backups are deliberately isolated under `runtime/`; thumbnail storage uses original/optimized/fallback paths. Backup, recovery, telemetry, leasing, and chaos scenarios indicate production resilience requirements.
Paths: `docker-compose.yml`, `backend/alembic/env.py`, `backend/app/backup/service.py`.

#### Architecture governance tool
`ace/` is a separate Python CLI for architecture discovery, contract/compliance checks, governance policy evaluation, and architecture-graph knowledge. It is not part of the news serving path, but supports enforcement of repository architectural rules and ADR/constitution validation.
Paths: `ace/src/cli.py`, `ace/src/compliance/engine.py`, `ace/src/governance/engine.py`.

Main entry points: [`backend/app/models/projection.py`](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/models/projection.py) (Read models), [`backend/app/services/ingestion/pipeline.py`](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/ingestion/pipeline.py) (Ingestion pipeline), [`backend/app/ai/ai_pipeline.py`](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/ai/ai_pipeline.py) (AI enrichment), [`backend/main.py`](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/main.py) (FastAPI service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product Experience"]
  node_nextjs["Next.js application<br/>web client<br/>[layout.tsx]"]
  node_article_page["Article reader<br/>App Router page<br/>[page.tsx]"]
  node_api_client["API client<br/>client adapter<br/>[client.ts]"]
end

subgraph group_content["Content Intelligence"]
  node_rss_sources(("Publishers<br/>external RSS/HTML"))
  node_rss_agent["RSS acquisition<br/>ingestion agent<br/>[rss_agent.py]"]
  node_ingestion["Ingestion pipeline<br/>write pipeline<br/>[pipeline.py]"]
  node_story_assignment["Story formation<br/>story service"]
  node_ai_pipeline["AI enrichment<br/>AI pipeline<br/>[ai_pipeline.py]"]
  node_ai_providers["AI provider adapters<br/>provider factory<br/>[factory.py]"]
  node_knowledge_graph["Knowledge evolution<br/>knowledge graph service"]
  node_editorial["Editorial homepage<br/>curation service"]
  node_recommendations["Recommendations<br/>personalization pipeline<br/>[pipeline.py]"]
  node_newsletter["Newsletter delivery<br/>distribution service<br/>[service.py]"]
end

subgraph group_platform["Platform Runtime"]
  node_fastapi["FastAPI service<br/>HTTP API<br/>[main.py]"]
  node_v1_routes["v1 product API<br/>route layer<br/>[router.py]"]
  node_v2_intents["v2 intents API<br/>route layer<br/>[intents.py]"]
  node_events["Event dispatcher<br/>event bus<br/>[dispatcher.py]"]
  node_projections["Projection engine<br/>CQRS read builder<br/>[engine.py]"]
  node_read_models[("Read models<br/>projection models<br/>[projection.py]")]
  node_postgres[("PostgreSQL<br/>primary database<br/>[env.py]")]
  node_celery["Celery workers<br/>async runtime<br/>[celery_app.py]"]
  node_compose{{"Deployment stack<br/>container runtime<br/>[docker-compose.yml]"}}
  node_backup["Backup and recovery<br/>resilience service<br/>[service.py]"]
end

subgraph group_governance["Architecture Governance"]
  node_ace_cli["ACE CLI<br/>governance tool<br/>[cli.py]"]
  node_compliance["Compliance checks<br/>policy evaluator<br/>[engine.py]"]
  node_governance_engine["Governance engine<br/>policy evaluator<br/>[engine.py]"]
end

node_nextjs -->|"renders"| node_article_page
node_article_page -->|"uses"| node_api_client
node_api_client -->|"HTTP"| node_fastapi
node_fastapi -->|"serves"| node_v1_routes
node_fastapi -->|"serves"| node_v2_intents
node_v1_routes -->|"reads"| node_read_models
node_v2_intents -->|"commands/events"| node_events
node_rss_sources -->|"feeds"| node_rss_agent
node_rss_agent -->|"fetches content"| node_ingestion
node_ingestion -->|"articles"| node_story_assignment
node_ingestion -->|"enriches"| node_ai_pipeline
node_ai_pipeline -->|"invokes"| node_ai_providers
node_ai_pipeline -->|"entities and artifacts"| node_knowledge_graph
node_story_assignment -->|"publishes"| node_events
node_ai_pipeline -->|"publishes"| node_events
node_events -->|"dispatches"| node_projections
node_projections -->|"materializes"| node_read_models
node_read_models -->|"content views"| node_editorial
node_read_models -->|"behavior and corpus"| node_recommendations
node_editorial -->|"homepage projections"| node_read_models
node_recommendations -->|"personalized feeds"| node_read_models
node_editorial -->|"selected content"| node_newsletter
node_ingestion -->|"persists"| node_postgres
node_read_models -->|"stores"| node_postgres
node_celery -->|"runs asynchronously"| node_ingestion
node_compose -.->|"deploys"| node_fastapi
node_compose -.->|"deploys"| node_celery
node_backup -->|"backs up"| node_postgres
node_ace_cli -->|"runs"| node_compliance
node_ace_cli -->|"runs"| node_governance_engine

click node_nextjs "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/app/layout.tsx"
click node_article_page "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/app/(public)/articles/%5Bslug%5D/page.tsx"
click node_api_client "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/lib/api/client.ts"
click node_fastapi "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/main.py"
click node_v1_routes "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/api/v1/router.py"
click node_v2_intents "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/api/v2/routes/intents.py"
click node_rss_agent "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/agents/ingestion/rss_agent.py"
click node_ingestion "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/ingestion/pipeline.py"
click node_story_assignment "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/ingestion/story_assignment.py"
click node_ai_pipeline "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/ai/ai_pipeline.py"
click node_ai_providers "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/ai/providers/factory.py"
click node_knowledge_graph "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/knowledge_graph/evolution_pipeline.py"
click node_events "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/core/events/dispatcher.py"
click node_projections "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/core/projection/engine.py"
click node_read_models "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/models/projection.py"
click node_editorial "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/editorial/homepage_builder.py"
click node_recommendations "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/recommendations/pipeline.py"
click node_newsletter "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/newsletter/service.py"
click node_postgres "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/alembic/env.py"
click node_celery "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/celery_app.py"
click node_compose "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/docker-compose.yml"
click node_backup "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/backup/service.py"
click node_ace_cli "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/cli.py"
click node_compliance "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/compliance/engine.py"
click node_governance_engine "https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/governance/engine.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_nextjs,node_article_page,node_api_client toneBlue
class node_rss_sources,node_rss_agent,node_ingestion,node_story_assignment,node_ai_pipeline,node_ai_providers,node_knowledge_graph,node_editorial,node_recommendations,node_newsletter toneAmber
class node_fastapi,node_v1_routes,node_v2_intents,node_events,node_projections,node_read_models,node_postgres,node_celery,node_compose,node_backup toneMint
class node_ace_cli,node_compliance,node_governance_engine toneRose
```

## Components

### Product Experience

- [Next.js application](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/app/layout.tsx): web client · Public, account, editorial, search, chat, and workspace screens. · `frontend/src/app/layout.tsx`
- [Article reader](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/app/(public)/articles/%5Bslug%5D/page.tsx): App Router page · `frontend/src/app/(public)/articles/[slug]/page.tsx`
- [API client](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/frontend/src/lib/api/client.ts): client adapter · Normalizes backend responses for presentation. · `frontend/src/lib/api/client.ts`

### Content Intelligence

- **Publishers**: external RSS/HTML
- [RSS acquisition](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/agents/ingestion/rss_agent.py): ingestion agent · `backend/agents/ingestion/rss_agent.py`
- [Ingestion pipeline](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/ingestion/pipeline.py): write pipeline · Extracts, filters, deduplicates, persists, and manages thumbnails. · `backend/app/services/ingestion/pipeline.py`
- [Story formation](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/ingestion/story_assignment.py): story service · Assigns articles, related coverage, and story records. · `backend/app/services/ingestion/story_assignment.py`
- [AI enrichment](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/ai/ai_pipeline.py): AI pipeline · Builds summaries, topics, entities, embeddings, clusters, and provenance artifacts. · `backend/app/ai/ai_pipeline.py`
- [AI provider adapters](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/ai/providers/factory.py): provider factory · Common controlled access to OpenAI, Anthropic, and Gemini. · `backend/app/ai/providers/factory.py`
- [Knowledge evolution](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/services/knowledge_graph/evolution_pipeline.py): knowledge graph service · Resolves canonical entities, conflicts, duplicates, and graph evolution. · `backend/app/services/knowledge_graph/evolution_pipeline.py`
- [Editorial homepage](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/editorial/homepage_builder.py): curation service · `backend/app/editorial/homepage_builder.py`
- [Recommendations](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/recommendations/pipeline.py): personalization pipeline · `backend/app/recommendations/pipeline.py`
- [Newsletter delivery](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/newsletter/service.py): distribution service · Delivers selected content through email or RSS. · `backend/app/newsletter/service.py`

### Platform Runtime

- [FastAPI service](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/main.py): HTTP API · Product service runtime and API boundary. · `backend/main.py`
- [v1 product API](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/api/v1/router.py): route layer · `backend/app/api/v1/router.py`
- [v2 intents API](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/api/v2/routes/intents.py): route layer · Artifact, event, intent, and admin functions. · `backend/app/api/v2/routes/intents.py`
- [Event dispatcher](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/core/events/dispatcher.py): event bus · Dispatches domain event envelopes from the write side. · `backend/app/core/events/dispatcher.py`
- [Projection engine](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/core/projection/engine.py): CQRS read builder · Builds and replays UI-facing read models. · `backend/app/core/projection/engine.py`
- [Read models](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/models/projection.py): projection models · Article, homepage, story, recommendation, analytics, and search views. · `backend/app/models/projection.py`
- [PostgreSQL](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/alembic/env.py): primary database · Persistent write-side records and projection storage. · `backend/alembic/env.py`
- [Celery workers](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/celery_app.py): async runtime · Runs scheduled ingestion and asynchronous operational work. · `backend/celery_app.py`
- [Deployment stack](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/docker-compose.yml): container runtime · Docker Compose runs application infrastructure including Redis and Nginx. · `docker-compose.yml`
- [Backup and recovery](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/backend/app/backup/service.py): resilience service · `backend/app/backup/service.py`

### Architecture Governance

- [ACE CLI](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/cli.py): governance tool · Separate architecture discovery and compliance command-line tool. · `ace/src/cli.py`
- [Compliance checks](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/compliance/engine.py): policy evaluator · `ace/src/compliance/engine.py`
- [Governance engine](https://github.com/jaswanthreddyam-maker/tech_news/blob/main/ace/src/governance/engine.py): policy evaluator · Evaluates architectural rules, ADRs, and constitution policy. · `ace/src/governance/engine.py`

## Connections

- Next.js application → Article reader: renders
- Article reader → API client: uses
- API client → FastAPI service: HTTP
- FastAPI service → v1 product API: serves
- FastAPI service → v2 intents API: serves
- v1 product API → Read models: reads
- v2 intents API → Event dispatcher: commands/events
- Publishers → RSS acquisition: feeds
- RSS acquisition → Ingestion pipeline: fetches content
- Ingestion pipeline → Story formation: articles
- Ingestion pipeline → AI enrichment: enriches
- AI enrichment → AI provider adapters: invokes
- AI enrichment → Knowledge evolution: entities and artifacts
- Story formation → Event dispatcher: publishes
- AI enrichment → Event dispatcher: publishes
- Event dispatcher → Projection engine: dispatches
- Projection engine → Read models: materializes
- Read models → Editorial homepage: content views
- Read models → Recommendations: behavior and corpus
- Editorial homepage → Read models: homepage projections
- Recommendations → Read models: personalized feeds
- Editorial homepage → Newsletter delivery: selected content
- Ingestion pipeline → PostgreSQL: persists
- Read models → PostgreSQL: stores
- Celery workers → Ingestion pipeline: runs asynchronously
- Deployment stack → FastAPI service: deploys
- Deployment stack → Celery workers: deploys
- Backup and recovery → PostgreSQL: backs up
- ACE CLI → Compliance checks: runs
- ACE CLI → Governance engine: runs
