# santoshniroula/hack-the-news architecture

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

- Interactive diagram: https://gitdiagram.com/santoshniroula/hack-the-news
- Repository: https://github.com/santoshniroula/hack-the-news

## Overview

Hack The News consists of an Android Hacker News reader and a separate Go HTTP service. The Android request path and HTML comment parser are visible in sampled source; the Go router implementations and Android navigation/ViewModel wiring were not sampled, so those connections are left unspecified.

Main entry points: [`hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/utils/ApiClient.kt`](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/utils/ApiClient.kt) (API client), [`hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/MainActivity.kt`](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/MainActivity.kt) (Reader), [`hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/Parser.kt`](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/Parser.kt) (HTML parser), [`hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/data/TopStoriesRepositoryImpl.kt`](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/data/TopStoriesRepositoryImpl.kt) (Stories repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android reader"]
  node_reader["Reader<br/>[MainActivity.kt]"]
  node_navigation["Navigation<br/>[AppNavHost.kt]"]
  node_routes["Route types<br/>[AppRouter.kt]"]
  node_stories_view["Stories screen<br/>[TopStoriesView.kt]"]
  node_stories_vm["Stories state"]
  node_stories_repo["Stories repository"]
  node_stories_contract["Stories contract"]
  node_api_client["API client<br/>[ApiClient.kt]"]
  node_item_model["Story item<br/>[Item.kt]"]
end

subgraph group_detail["Story details"]
  node_detail_view["Detail screen"]
  node_detail_vm["Detail state"]
  node_detail_repo["Comments repository"]
  node_detail_contract["Comments contract"]
  node_parser["HTML parser<br/>[Parser.kt]"]
end

subgraph group_go["Go service"]
  node_go_server["HTTP server<br/>[main.go]"]
  node_go_routes["Route handlers<br/>[utils.go]"]
  node_go_cache["Cache utilities<br/>[utils.go]"]
  node_go_api["Item schema<br/>[item.go]"]
end

subgraph group_hn["Hacker News services"]
  node_firebase["Hacker News API"]
  node_website["Hacker News site"]
end

node_user(("Reader"))

node_user -->|"uses"| node_reader
node_reader -->|"starts"| node_navigation
node_stories_repo -->|"fetches through"| node_api_client
node_api_client -->|"requests items"| node_firebase
node_api_client -->|"requests story IDs"| node_firebase
node_detail_repo -->|"parses comments"| node_parser
node_parser -->|"fetches HTML"| node_website
node_go_server -->|"dispatches routes"| node_go_routes

click node_reader "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/MainActivity.kt"
click node_navigation "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppNavHost.kt"
click node_routes "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppRouter.kt"
click node_stories_view "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesView.kt"
click node_stories_vm "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesViewModel.kt"
click node_stories_repo "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/data/TopStoriesRepositoryImpl.kt"
click node_stories_contract "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/repository/TopStoriesRepository.kt"
click node_api_client "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/utils/ApiClient.kt"
click node_item_model "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/models/Item.kt"
click node_detail_view "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailPage.kt"
click node_detail_vm "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailViewModel.kt"
click node_detail_repo "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/TopStoryDetailRepositoryImpl.kt"
click node_detail_contract "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/repository/TopStoryDetailRepository.kt"
click node_parser "https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/Parser.kt"
click node_go_server "https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/main.go"
click node_go_routes "https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/routers/utils.go"
click node_go_cache "https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/cache/utils.go"
click node_go_api "https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/api/item.go"

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_reader,node_navigation,node_routes,node_stories_view,node_stories_vm,node_stories_repo,node_stories_contract,node_api_client,node_item_model toneBlue
class node_detail_view,node_detail_vm,node_detail_repo,node_detail_contract,node_parser toneAmber
class node_go_server,node_go_routes,node_go_cache,node_go_api toneMint
class node_firebase,node_website toneRose
class node_user toneIndigo
```

## Components

### Android reader

- [Reader](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/MainActivity.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/MainActivity.kt`
- [Navigation](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppNavHost.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppNavHost.kt`
- [Route types](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppRouter.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/app_router/AppRouter.kt`
- [Stories screen](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesView.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesView.kt`
- [Stories state](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesViewModel.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/TopStoriesViewModel.kt`
- [Stories repository](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/data/TopStoriesRepositoryImpl.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/data/TopStoriesRepositoryImpl.kt`
- [Stories contract](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/repository/TopStoriesRepository.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/repository/TopStoriesRepository.kt`
- [API client](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/utils/ApiClient.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/utils/ApiClient.kt`
- [Story item](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/models/Item.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/models/Item.kt`

### Story details

- [Detail screen](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailPage.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailPage.kt`
- [Detail state](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailViewModel.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/TopStoryDetailViewModel.kt`
- [Comments repository](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/TopStoryDetailRepositoryImpl.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/TopStoryDetailRepositoryImpl.kt`
- [Comments contract](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/repository/TopStoryDetailRepository.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/repository/TopStoryDetailRepository.kt`
- [HTML parser](https://github.com/santoshniroula/hack-the-news/blob/main/hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/Parser.kt): `hackthenews/app/src/main/java/np/com/santoshniroula/hackthenews/topstories/detail/data/Parser.kt`

### Go service

- [HTTP server](https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/main.go): `hack-the-news-go/main.go`
- [Route handlers](https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/routers/utils.go): `hack-the-news-go/routers/utils.go`
- [Cache utilities](https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/cache/utils.go): `hack-the-news-go/cache/utils.go`
- [Item schema](https://github.com/santoshniroula/hack-the-news/blob/main/hack-the-news-go/api/item.go): `hack-the-news-go/api/item.go`

### Hacker News services

- **Hacker News API**
- **Hacker News site**

### Other components

- **Reader**

## Connections

- Reader → Reader: uses
- Reader → Navigation: starts
- Stories repository → API client: fetches through
- API client → Hacker News API: requests items
- API client → Hacker News API: requests story IDs
- Comments repository → HTML parser: parses comments
- HTML parser → Hacker News site: fetches HTML
- HTTP server → Route handlers: dispatches routes
