A modern, multiplatform JavaScript webapp for reading Hacker News.
- Browse Hacker News front page
- Read articles and comments
- Filter by Ask HN, Show HN, and Top posts
- Dark theme support
- Offline caching
- Mobile-friendly responsive design
This project has been modernized with:
- TypeScript for type safety
- Vite for fast builds and hot module replacement
- Modern ES modules instead of legacy script loading
- ESLint for code quality
- Node.js 18+
- npm or yarn
npm installStart both the mock API server and the dev server:
# Terminal 1 - Start mock API server
npm run dev:api
# Terminal 2 - Start Vite dev server
npm run devThis starts a development server at http://localhost:3000 with hot module replacement.
npm run buildThe built files will be in the dist/ directory.
npm run previewnpm run type-checknpm run lintImportant: The original API endpoint (http://ng.premii.com:8080) is no longer accessible. For development, this project includes a mock API server.
- Start the mock API server (in one terminal):
npm run dev:api- Start the development server (in another terminal):
npm run devThe mock API server runs on http://localhost:8080 and provides sample Hacker News data for testing.
For production use, you'll need to:
-
Set up your own Hacker News API backend, or
-
Use an alternative API service such as:
- Official Hacker News Firebase API:
https://hacker-news.firebaseio.com/v0/ - Algolia HN Search API:
https://hn.algolia.com/api/v1/
- Official Hacker News Firebase API:
-
Update the API endpoint in
src/config.ts:
url: {
stories: "YOUR_API_ENDPOINT_HERE",
readability: "a/read/sample.txt"
}The API expects the following endpoints:
GET /news- Returns an array of story objectsGET /item/{id}- Returns a single story with comments
See mock-api-server.js for the expected data format.
- TypeScript
- Vite
- Modern JavaScript (ES2020+)
- CSS3
- LocalStorage for offline caching
- Fetch API for HTTP requests
- Original Web: http://hn.premii.com
- iOS: https://itunes.apple.com/us/app/hacker-news-yc/id713733435
- Android: https://play.google.com/store/apps/details?id=com.premii.hn
- Icon font - http://icomoon.io
- Normalize.css - https://github.com/necolas/normalize.css/
- Unofficial Hacker News API - https://github.com/cheeaun/node-hnapi/
MIT