Unofficial Hacker News API
Latest commit 2cd9aaa Jun 16, 2016 @cheeaun committed on GitHub Merge pull request #21 from amilajack/patch-1
Added page query param example to readme

Hacker News (unofficial) API

Yet another unofficial API for Hacker News. Currently being used by my other project. Feel free to fork and contribute.

NOTE: If you are planning to scrape a huge amount of posts or (historical) data from HN, please don't use this API. Use the official Hacker News API or HN Search API instead.


Quick Start

  1. git clone this repo.
  2. cd to repo folder.
  3. Optionally download, install and start redis or memcached.
  4. npm install
  5. npm start
  6. Load localhost in your web browser.



HNapi uses nconf for configuration, which can be done via the config.json file, environment variables and command-line arguments.

  • port - (default: 80) Server port
  • cache_exp - (default: 600) Cache expiry in seconds
  • log_referer - (default: false) Logs referers
  • log_useragent - (default: false) Logs user-agent strings
  • cache
    • memory - (default: true) Use in-memory caching
    • store - (memcached | redis, default: none) Specify the cache store
    • options - Options for specified cache store
      • servers - HOST:PORT for memcached server
      • url - redis://USERNAME:PASSWORD@HOST:PORT for redis server
      • debug - (default: false) Allows debugging (only for redis store)
  • papertrail - for logging with Papertrail
    • host
    • port
    • hostname (optional) - host name for the server
  • universal_analytics - for logging with Google Analytics' Universal Analytics' Measurement Protocol
    • tid - tracking ID


Licensed under the MIT License.

Other APIs