# vitoplantamura/hackernewsremovals architecture

> Architecture diagram of the GitHub repository vitoplantamura/hackernewsremovals, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vitoplantamura/hackernewsremovals
- Repository: https://github.com/vitoplantamura/hackernewsremovals

## Overview

##### Data Collection Layer
- HN API Client Component
- Connection to official HN API
- 1-minute polling interval
- 90 Top Stories fetch operation
- Front Page (top 30) monitoring

##### Processing Layer
- Story Comparison Engine
- Input from consecutive API calls
- Logic for detecting removed stories
- Filter for second-chance pool exclusions
- Story State Tracker
- Track story positions and metadata
- Store previous minute's state

##### Logging Layer
- Markdown File Generator
- Organization by date
- Story metadata formatting
- Archive management system

##### Storage Layer
- Archive System
- Monthly markdown files structure
- Chronological organization

Design Guidelines:

##### Timing indicators
- 1-minute polling cycle
- Archive rotation schedule

##### Data flow markers
- → for real-time data flow
- ⇢ for archival operations

##### Separation between active monitoring and historical storage

- Component types
- Timing indicators

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        HNAPI[("Hacker News API")]:::external
    end

    subgraph "Data Collection Layer"
        APIClient["HN API Client\n(1-min polling)"]:::processing
        TopStories["Top 90 Stories\nFetcher"]:::processing
        FrontPage["Front Page Monitor\n(Top 30)"]:::processing
    end

    subgraph "Processing Layer"
        CompEngine["Story Comparison\nEngine"]:::processing
        StateTracker["Story State\nTracker"]:::processing
    end

    subgraph "Logging Layer"
        MDGen["Markdown File\nGenerator"]:::logging
    end

    subgraph "Storage Layer"
        Archive["Archive System"]:::storage
        MonthlyFiles["Monthly Archive\nFiles"]:::storage
    end

    %% Connections
    HNAPI --> APIClient
    APIClient --> TopStories
    TopStories --> FrontPage
    FrontPage --> CompEngine
    CompEngine --> StateTracker
    StateTracker --> MDGen
    MDGen --> Archive
    Archive --> MonthlyFiles

    %% Click events
    click Archive "https://github.com/vitoplantamura/HackerNewsRemovals/tree/main/OLD"
    click MonthlyFiles "https://github.com/vitoplantamura/HackerNewsRemovals/blob/main/OLD/ARCHIVE-*.md"
    click APIClient "https://github.com/vitoplantamura/HackerNewsRemovals/blob/main/Program.cs"
    
    %% Styling
    classDef external fill:#A0D8EF
    classDef processing fill:#90EE90
    classDef storage fill:#FFE5B4
    classDef logging fill:#D3D3D3

    %% Legend
    subgraph Legend
        L1[("External Services")]:::external
        L2["Processing Components"]:::processing
        L3["Storage Components"]:::storage
        L4["Logging Components"]:::logging
    end
```
