Ask HN: Is the Hacker News source code public?

51 points by _wldu ↗ HN
Is the Hacker News source code and infrastructure public? I'm interested in web application security and performance and was hoping I could learn more about HN's source code and infrastructure.

62 comments

[ 3.4 ms ] story [ 127 ms ] thread
Hacker news was originally written by Paul Graham in Arc. Arc is a Lisp-inspired programming language also written/invented by PG at the same time and Hacker News programmed in it to (also) prove it works. Arc did not catch on outside of Hacker News. Arc is free and open source. Regarding Hacker News, itself: "Ask PG: Why don’t you open source HN? (2013): https://news.ycombinator.com/item?id=5006037

PG's response is:

I don't have time to manage such a project. I don't think it's necessary anyway. The reason HN lacks x cool feature is not that I expend no energy on the site, but that I expend all my energy on what users actually care about, which is not features but the content.

>The reason HN lacks x cool feature is not that I expend no energy on the site, but that I expend all my energy on what users actually care about, which is not features but the content.

said pg, on a forum in which users constantly complain about missing features...

really? like what? I like hn precisely because of its minimalistic approach.
Have they fixed quote wrapping?
Pagination. I'm sure most people don't know that you can click on "More replies" at the bottom of the page to read more comments. At least I didn't know at first and spent many years reading only the first page.

Edit: It's actually "More" not "More replies".

Really? Interesting, also explains why some mods (I think dang does it) make a stickied post explaining this in big enough threads. Maybe putting a message at the top of threads with multiple pages with its own div / table style would suffice.
I have never understood this. On websites, paginators are always at the end of pages. This one is there and it clearly says what it does. How can someone miss it?
The only thing I can think of is that pagination didn't originally exist, so users could have "learned" that if Ctrl-F didn't find a term, that it didn't exist in the comments (rather than didn't exist on this page of comments). That seems incredibly minor to me, though.
Other sites design their UI to stand out. Paginators may be bolded, or in a different font. And there will usually be other visual cues like a "Page x of y" somewhere. Hacker News' primary color scheme is minimalist grey on grey, specifically so the UI doesn't distract from the content.

As a result, people here develop feature blindness to the point that dang has to remind people that pagination even exists in most paginated threads.

Usually there are two buttons "Prev-Next" or something like "Page: 1,2,3,4..".

And I just checked, it's actually just "More". Maybe it's me but it's not immediately obvious that a link (not even a button) called "More" means that you can go to the next page. Add to that that HN is so lightweight I just assumed all messages were loaded at once.

I think people ctrl+F for something and then post a comment "I can't believe no one mentioned X...".

People don't usually reach the bottom of the first page when they go through comments, because the first page is quite big, so they never have to see the pagination (though they do need to know it's not the complete view).

Option to set colours for more than just the top bar and … that’s about it
I use stylish to changes fonts and colors, here's my custom stylesheet

  * {
    color: #F3F1A1 !important;
    background-color: #000 !important;
  }
  body > center > table > tbody > tr:first-child * {
    background-color: #073642 !important;
  }
  body > center > table > tbody > tr:first-child * a:hover {
    background: #002b36 !important;
  }
  code, pre, input, textarea {
    background: #073642 !important;
  }
  a, .pagetop, .hnname a:visited, .rank, .athing {
    color: #b58900 !important;
  }
  .commtext {
    font-size: 125%;
  }
  .title {
    font-size: 112%;
  }
  .subtext {
      font-size:75%;
  }
  .subtext *, .sitebit, .sitestr, .subtext:nth-child(2) {
      color: #9e7800 !important;
  }
  a:visited, a:visited span {
      color: #717600 !important;
  }
  a:hover, a:hover span {
      background: #073642 !important;
  }
P.s. I am a slightly colorblind, please don't judge my colors palette
a lot of people complain about the font size, for instance.
A strange thing to complain about, given browsers can override with user settings, if not user plugins.
One could argue that if your text-based forum, which is designed to be read, depends on browser settings and plugins to be readable to a vocal minority of users, then your design is deficient. Many people on HN would make that argument with regards to the need for browsers to have a reader mode.

Ignoring modern web typography standards and keeping the default font size, line spacing and contrast such that it's uncomfortable for many people to read is an anti-feature. Particularly given the only reason it is the way it is is that pg didn't consider it worth caring about.

Some users will always complain about something.

edit: They also generally all complain about different things.

It's a love-hate thing. Most people (myself included) love how simple HN is. The only thing I wish I could have is: Being able to search through content I've saved or upvoted. I don't know if I care for any other changes. In my case, it would allow me to find "that article I saw years ago that I cant quite remember" and liked comments would be nice to be able to filter through too. Basically the search engine HN uses at the bottom only goes through public items.
It's still missing modern privacy features, such as the "right to be forgotten".
Right to be forgotten is an old EU law, the new GDPR law is 'right to erasure'

In the event you don't feel like deleting your own comments the mods will likely help you.

A general best practice is to avoid posting personally identifiable information.

You can’t delete your comments after 2 hours.
You can have any problematic comments anonymised or removed by emailing the hn@yc address.

By default, it's an important part of HN that comments stay up, unless they will cause problems for the poster. PG explained why, many years ago:

https://news.ycombinator.com/item?id=6813226

I think it's pretty good. I only need one feature that is a piece of message that shows me which one of my comments has been replied when it happens. But then again I'm fine without it so I guess it's not necessary.
> I'm interested in web application security

After taking a look, please remove the shadowban on my account for saying "What science?" because of the year-long b.s. about masks and vaccine side effects.

I always assumed that someone had lost the source for the iOS app and that’s why we’re stuck with the broken thing.
There is no official HN app, for any OS. People have made multiple unofficial ones, using the API, though.
And many kinda work but are no longer mantained. Such is the fate of the iOS app previously mentioned and of Materialistic (Android)
I'm currently using Harmonic for Android after Materialistic irritated me too many times and while it's definitely got some issues, it works well enough for casual use
I would be completely happy with Harmonic except for 3 issues and I'm not sure if the one can be resolved because every Android HN API using app I have tried has the same issue.

The first issue is that long comments are difficult to type because the text box doesn't scroll the content. You end up typing blind. I'm already doing so now.

The 2nd is that you can you can copy part of a comment.

The 3rd and the one that I've experienced across clients is that dead comments are displayed. I would like to not see dead comments.akimg this a setting would be fine.

Yeah I've faced both of the first 2 issues. I'd also like to add that it has no options for searching which makes it useless since I want recent results, not something years ago
I read it on my iphone in the browser, and it is fine. It never even occurred to me that it would need an app. One of the best features of the site is that it does not need an app, and one can browse it while seated in the little room.
There's an app? Why??

It's the plainest of websites. I've been using it on android and iPhone for years without ever thinking "oh boy this would be better with an installable update able app asking me permissions and doing who knows what on my device". I assume any apps out there would be 3rd party scrapers...

I use materialistic on the phone. Design is nicer for mobile, plus I'm addicted to dark mode.
I use Hermit to appify often accessed pages, you get a Hackernews icon on your Android desktop that behaves exactly like an app, has its own cookie jar that does not leak browsing information etc.

The interface paradigm of mobile devices is built around apps, mobile browsers are a pain in the butt - deliberately, most likely.

I use https://github.com/weiran/Hackers because it’s nice to read on, but then to comment I have to use the site, so yea lol

If there was a dark mode on the site I’d just use that

Octal lets you comment from the app, if that’s something you are missing.
Oh cool, thanks I’ll take a look
Having tried to write an HN client myself, I can assure you most of them scrape instead of using the API. The API is basically read only, is impractical for things like loading a full tree of comments (get ready to make an API call for every comment) and you need to scrape if you want things like “what auth hash do I need in order to upvote this particular comment via POST”.
> that’s why we’re stuck with the broken thing

I've been using HN for 10+ years but I don't think I've ever found anything that was broken. What are you referring to exactly?

> for the iOS app
HN doesn't have any iOS app nor any other app for that matter. So I'm guessing the author must confuse HN with something else.
Thanks for the comments. I'm also interested in the infrastructure. Does HN run on dedicated hardware, shared VPS, AWS, Azure, etc.
It's running on a Lisp Machine under (next to?) dang's desk. It used to be under pg's desk.

:-p

I don't see it mentioned in another comment, so I'll add that part of why it's not public is probably to hide how exactly some things like "shadow banning" work, or the exact secret sauce to make the front page, etc.
I recall they pushed updates a month or so back. Forget why I know this; vaguely recall some hiccups being mentioned. So they seem to update it on the regular, maybe on a pro re nata basis.
how did they make it so fast? I'm always surprised by its loading speed
Perhaps an equally (more?) relevant question is "why are other sites so slow?"
Simplicity. Clean HTML ("rendered" server side), straight forward CSS and little JavaScript.
I remember reading a couple years ago, that there's no database. It just reads stuff off disk, and then caches it in memory.

It probably also helps that the html/css/js is minimal

By not having any features