aboutsummaryrefslogtreecommitdiff

hn

hn is a simple front-end alternative for Hacker News, focusing on privacy and simplicity.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • A web server (e.g., Nginx or Apache)
  • PHP (>= v8.0)
  • Optional: minify

Installing

Install the dependencies, using the web server of your choice:

sudo apt install nginx-full php php-cgi php-fpm minify

Clone the repo:

git clone $repo_url

If you need to minify CSS changes:

# executed in the top-level `hn` dir
minify -o static/styles.min.css static/styles.css

Deployment

Deployment is as easy as copying the code to your webroot. No special packages or tools required.

To deploy, ensure you have a publicly-available web server and configure it to fallback with all errors to the index.php file rather than returning a 404 error.

For nginx, include the following snippet in your website's conf file:

location / {
        # First attempt to serve request as file, then
        # as directory then fall back to index.php
        try_files $uri $uri/ /index.php?$args;
}

For Apache, you can include the following snippet in a .htaccess file within the directory you're serving the PHP file from:

FallbackResource /index.php

Built With

  • PHP - The scripting language
  • HTML - The markup language
  • minify - Used to minify CSS

Contributing

Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.

TODO

A scratch pad of ideas that may be useful to implement:

  • [x] Add minimal CSS.
  • [x] Add functionality to view a user's profile.
  • [x] Add functionality to view item-specific page with comments (ConstructStoryDiscussion).
    • [ ] Load recursive descendant threads.
  • [ ] Add functionality to handle polls (ConstructPoll & ConstructPollOpt).
  • [ ] Add functionality to load more items or paginate.

Versioning

This project currently doesn't use versioning. See the git log instead.

Authors

License

This project is licensed under the Unlicense - see the LICENSE.md file for details.