How anthueeccel/hackernews works
This is a small ASP.NET Core API that validates a requested story count, fetches and filters Hacker News stories, sorts them by score, and returns a public JSON response. Its internal service layer uses a bounded in-memory cache with single-flight coalescing and limited parallel fetches; the typed client calls Hacker News. README documents health and Development OpenAPI endpoints. Relationships shown come from excerpts or README; configuration wiring is visible in Program.cs, while health/OpenAPI routes are documented only.
Main entry points: Program.cs Application setup · BestStoriesService.cs Best stories service · StoriesEndpoints.cs Stories endpoint · HackerNewsClient.cs Hacker News client
Components 15
API surface
- Stories endpoint
src/HackerNews.BestStories.Api/Endpoints/StoriesEndpoints.cs - Health check
src/HackerNews.BestStories.Api/Program.cs - OpenAPI document
src/HackerNews.BestStories.Api/Program.cs
Story retrieval
- Best stories service
src/HackerNews.BestStories.Api/Services/BestStoriesService.cs - Single-flight cache
src/HackerNews.BestStories.Api/Infrastructure/SingleFlightCache.cs - Bounded memory cache
src/HackerNews.BestStories.Api/Infrastructure/SingleFlightCache.cs - Story response DTO
src/HackerNews.BestStories.Api/Models/StoryResponse.cs
Hacker News integration
- Hacker News client
src/HackerNews.BestStories.Api/Clients/HackerNewsClient.cs - Client contract
src/HackerNews.BestStories.Api/Clients/IHackerNewsClient.cs - Upstream item model
src/HackerNews.BestStories.Api/Models/HackerNewsItem.cs - Hacker News API
Runtime configuration
- Story options
src/HackerNews.BestStories.Api/Options/StoriesOptions.cs - Upstream options
src/HackerNews.BestStories.Api/Options/HackerNewsOptions.cs - Application setup
src/HackerNews.BestStories.Api/Program.cs
Other components
- API caller
Connections 18
- API caller → Stories endpoint: requests stories
README.md - Stories endpoint → Best stories service: calls service
src/HackerNews.BestStories.Api/Endpoints/StoriesEndpoints.cs - Stories endpoint → Story options: validates count
src/HackerNews.BestStories.Api/Endpoints/StoriesEndpoints.cs - Best stories service → Client contract: fetches IDs/items
src/HackerNews.BestStories.Api/Services/BestStoriesService.cs - Best stories service → Single-flight cache: gets cached values
src/HackerNews.BestStories.Api/Services/BestStoriesService.cs - Best stories service → Story options: uses limits and TTLs
src/HackerNews.BestStories.Api/Services/BestStoriesService.cs - Best stories service → Story response DTO: maps stories
src/HackerNews.BestStories.Api/Services/BestStoriesService.cs - Single-flight cache → Bounded memory cache: reads and writes
src/HackerNews.BestStories.Api/Infrastructure/SingleFlightCache.cs - Hacker News client → Hacker News API: requests IDs/items
README.md - Hacker News client → Upstream item model: deserializes items
src/HackerNews.BestStories.Api/Clients/HackerNewsClient.cs - Application setup → Stories endpoint: maps routes
src/HackerNews.BestStories.Api/Program.cs - Application setup → Health check: maps health route
src/HackerNews.BestStories.Api/Program.cs - Application setup → OpenAPI document: enables in Development
src/HackerNews.BestStories.Api/Program.cs - Application setup → Hacker News client: registers typed client
src/HackerNews.BestStories.Api/Program.cs - Application setup → Single-flight cache: registers cache
src/HackerNews.BestStories.Api/Program.cs - Application setup → Best stories service: registers service
src/HackerNews.BestStories.Api/Program.cs - Application setup → Story options: binds and validates
src/HackerNews.BestStories.Api/Program.cs - Application setup → Upstream options: binds and validates
src/HackerNews.BestStories.Api/Program.cs