Nimforum: Lightweight alternative to Discourse written in Nim
github.com
github.com
This is still better than original Discourse which for this same thing needs 6MB of data (1.2MB compressed). However Discourse does not claim to be efficient or elegant.
This kind of web performance engineering attention to detail will go a long way. The benefits for users on slower connections are particularly important. And as an engineer, showing few KBs of information with few MBs of data should bother you. Your information to data ratio is less than 1%. Excessive reliance on JS does not help. The best way to think about JS is as a feature enhancer not a feature requirement.
See also: https://idlewords.com/talks/website_obesity.htm
Having said that I think it is absolutely great that you are doing this and I hope we can get efficient and elegant forum software. This will certainly help nim adoption if executed in the way that is true to your values.
Edit: A competitor has been mentioned in comments:
https://fluxbb.org/forums/index.php
They are showing similar amount of information in "only" 100KB of total data. And 80% of it is CSS (which does seem excessive for what it does, I am sure 5KB of CSS would do the same job taking that page to amazing 25KB of total data).
As a basis of comparison, HN's home is 43k, and old.reddit.com is currently 3.16MB including all assets, the sole markup is 363K (gzip'd to 104).
That being said, I agree that the web is bloated and needs to go on a diet. We just need to be careful on where to spend our energy for optimization (caches are great and we should rely on them).
Web perfomance optimization tells me a lot about a product and its priorities. I do not mind bloated products that perform a certain function well for their users and never try to pretend to be optimial from an engineering standpoint.
But this is nim, language that markets itself as efficient and elegant, and execution like this can hurt their credibility and brand perception in the very community they are trying to market themselves in (developers).
Back in 2018 when I implemented the basis for this modern reimplementation of the Nim forum I focused on the functionality and a solid CI so that we can easily accept others' contributions without fear of regressions. Unfortunately I had only 2 solid weeks to make this a reality and optimising the code size didn't make the cut.
This is a big low hanging fruit fix, another is simply minifying the Forum's JS, there is also bound to be a lot that can be done on the Nim side to reduce the code size generated.
[1] https://github.com/nim-lang/nimforum/blob/master/nimforum.ni...
I forgot to mention that it is not a bug. See https://github.com/google/recaptcha/issues/335 for example (I believe there are others issues like this in the repo)
Caches hang or crash my browser. Please don't. (Amazon Kindle Paperwhite – yes, this has been my only web browser several times – no, I will not replace it with another Kindle when it breaks)
The way I envision it is chat apps are yelling a question in a café, Discourse is walking into said café and setting down a sign then walking out, while classic forums are pinning a note in a library corkboard.
There is an option named `Skip new user onboarding tips and badges` in preferences though...
Thanks for the tip, I had no idea that it could be turned off.
And so I decide to check out Discourse again, turns out they Announced [1] a $20m Series A Investment by Pace Capital and First Round Capital. Congrats.
1- There is excessive white-space everywhere (like every other modern web-app). I feel like it was designed as a mobile-first solution.
2- There could have been smarter features regarding gamification and karma. Currently you can only hit like button (the total like count of a user is not even visible)
3- If a post has many replies, it only shows them up until a certain point and you have to scroll down to view more. These javascript shenanigans should not exist in a forum app IMO.
I have never used a nimforum-based forum but a quick browse in https://forum.nim-lang.org/ shows that their UI is more dense (less white-space) which addresses point 1 above.
That’s wonderful. Definitely a fantastic decision to help prevent toxic conversations. So glad that “feature” doesn’t exist on Hacker News or in Discourse.
When I ask a technical question on a forum, I'd like to know if a user who is deemed helpful in the community (by like count or `solved` count) is replying to me.
So many programmers have this obsession with interfaces having every available piece of information displayed all at once. I just don't understand the appeal. I find these sorts of interfaces confusing and overwhelming, I literally can't think straight when I look at them. I immediately forget what I was doing due to all the distractions.
No JS no joy. You see a completely white page, because none of it works without JS, not even an indication can be seen, that JS is required and it is waaay off of anything having a non JS fallback.
The above also means, that any knowledge in there will not be found via search engines. I have had it happen, that there was a forum of some community, and I did not even know it existed, even though I searched loads of stuff about the project. It simply never appeared in any search result ever. It is not discoverable.
Aside from not being discoverable, I find that any traditional forum software works better than discourse. For example I cannot properly see when exactly a reply was written, because it abstacts from a simple timestamp and shows only a month and year for example.
Yes, I agree. I like the FluxBB based forum that Arch community uses and find the look & feel a good balance between excessive use of whitespace and overly cramped UIs.
> No JS no joy. You see a completely white page, because none of it works without JS, not even an indication can be seen, that JS is required and it is waaay off of anything having a non JS fallback.
I am not sure if this is configurable but the official kotlin forum [1] uses discourse and I can see the content when js is disabled. A lot of interactivity is disabled but the footer does have a clear message that the site is best viewed with js enabled.
I have often found kotlin forum posts through google search, so there doesn't seem to be any issue on the SEO front.
As for the timestamp, click or hover over the timestamp to see the full date/time, etc.
I have experienced it multiple times, that stuff is only in some discourse forum and I see a blank white page. Basically a JS-wall. Not sure, if the people, who hosted it did something weird to cause that issue, but that is the impression I have of discourse forums. Rarely I allow its scripts to run and make the effort to view some content in any such forum. Usually I just close the tab.
Edit: Now I know why I might have had that experience: I also block loads of third party CDNs. Perhaps they were trying to load scripts and resources from there and that's why nothing was shown.
Edit2: But you are also correct: The Nim one does not show anything without JS.
Google's crawler can index JS-only content just fine:
https://www.google.com/search?q=site:https://forum.nim-lang....
What I don't understand is why discourse can't serve up content that isn't interactive. I get lazy loading if there are >1000 comments on a post, but for anything else, static content should be perfectly fine. Even when you have js on, ctrlf doesn't work because of dynamic loading so the site has to hijack the shortcut with different interaction patterns (pressing enter doesn't go to next result, it loads a separate page).
I just tested with the 999 comment post on that site. First page load with no cache is 5.98MB (1.25MB) and took 5.76s load time. Holding the end key to get to the bottom until I hit the last post downloads a total of 1.91MB (718KB transfer) and takes 70s! That's including all the pictures. That cannot be better than than loading all text and optionally deferring all img loads, right?
The only content is in a <noscript> tag, so this complaint is probably coming from people only blocking third party JS.
When reading a random Discourse forum I don't intend to participate in, blocking all JS usually results in a smoother experience than accepting scripts from discourse-cdn.com. The only exception I've found is for massive threads, because there's no JS-free search.
In case there are any programmers in this comment thread, more interesting to me than the amount of whitespace or how similar the interface is to Discourse, is the source code. It's a great example of the power of the Nim language for application programming.
If you are looking for something minimal with threading support, fossil scm [2] includes a forum. You can checkout the forum for fossil itself which is powered by fossil.
As someone not too familiar with Django, this looks like a nice codebase :)
But am I right that there are no tests?
Typically the first test will be quite painful - you might have to install a testing dependency, possibly re-work some code to allow for testing etc. But then, the next test should be a little easier. And after a few bugs and tests, you might find that for your next feature, you can somewhat easily start with a failing test.
/unsolicted_advice
Considering it'd be faster than what discourse does, yes.
> to see the next 10 post on that thread?
If your forum has unconfigurable 10-post pages I would suggest getting a better forum software? One decades-old forum I frequent loads its default 40-post pages in half the time it takes discourse to load a new section, and using half the data, despite having to reload the entire HTML page.
And it doesn't waste a third the screen on a virtual thread scrollbar.
What's wrong with Discourse: (and other silly scroll-hijacking pages):
1. Scrollbar no longer works properly when you try to navigate thread up and down. Normally you make mental note where there is something, and you can go back to it. But in Discourse, it isn't there, because you scrolled down, it loaded more replies, now you go back and there's something else in there.
2. You slowly drag scrollbar with your mouse. You near end of the page... it loaded more content, and now because you're still slowly dragging scrollbar, it again warps to the end, and WTF just happened, where is the thing I was reading!? Everything jumps and you just skipped dozens of replies.
3. Click any link. There's useless loading spinner, but oh well. Click any link, internal or external, and then go back. WTF!? I pressed back button, page should be in the same position it was before! It randomly snapped to some post, up, down, whatever, but it is somewhere else and now again, where is the thing I was reading!?
I cannot understand how anybody thought this was good design. It is horrible. Besides issue 3 which presumably could be fixed, issues 1 and 2 are fundamental problems. You cannot have page that have dynamic height and at the same time have scrollbar that is remotely useful. If you really insist on dynamic loading (and I don't know why you would, plain old HTML page is faster anyway), you could preallocate page height so it will work properly, but then you're back to square one: you need pagination.
I think Discourse remembers where you were in a given thread and takes you back there when you enter is again.
I’ve never heard or noticed anybody doing this. You must go crazy on infinite scroll webpages.
I’m using the PageUp and PageDown keys for page wide navigation and the arrow keys for the lineheight movements. On a desktop machine I’m using the scroll wheel as well.
I would only use the scroll bar for pixel perfect positioning of the viewport.
And, though this is more subjective, I find the UI confusing. I end up browsing the github issues or even reddit for answers to questions just to avoid discourse on projects that use it (discuss.linuxcontainers.org - I'm looking at you).
Discourse's voodoo ends up being more annoying to me than useful, not unlike infinite scrolling.
(obviously this is all subjective..I can only speak to the fact that I get annoyed by it and thus instinctively avoid discourse when I can)
Except for long threads the start of the thread is usually irrelevant beyond the first page or so (if even that) so you can just jump to a few pages from the end and go from there. Good forum software remains comfortable to use at million-post threads, and will render 100-post pages in a small fraction of a second.
IME discourse's "infinite loading" nonsense is just slow and a mess. Go check the Rust discourse's crate of the week thread, it is a slow mess to navigate, the browser's scrollback gets hopelessly lost, and of course the in-page search is broken.
That's a thread of a thousand comments, it's quite literally nothing, and for all that it completely fucks up your history to boot.
It is only a location indicator (which is of course completely useless on infinite scroll pages).
Really, the scroll bar IS a fresh take on the page list, except it's actually useful for navigating the thread and doesn't force readers to deal with the useless concept of numbered pages when such arbitrary divisions are no longer the primary way of navigating the thread. Once you choose to not implement explicit pages (and accept that it's not possible to load the whole thread in one request), the thread scroller is a natural consequence.
Navigating with PageUp and PageDown in a Discourse thread feels smoother than in a phpBB where you eventually have to hunt for the “next page” link.
Every page takes a few seconds to load. If you open a page in a new tab, you still need to wait for it to load when you switch to the tab. The forum was the most annoying thing about using the language.
Go try it out: https://forum.nim-lang.org/
I'm regularly seeing 500ms on page loads. Very frustrating when you open pages in new tabs, but they're not loaded when you go to switch over.
Could definitely use a lot of minification.
If you wanted to integrate some Nim code in an existing JS application and your existing application already defines the name "raiseException", or "unhandledException", or "framePtr", or "lastJSError", or ... that's going to be a problem.
https://nim-lang.org/docs/backends.html#backends-the-javascr...
It appears that the way it does that creates a lot of global vars and functions.
How is code generated? Using llvm-lib, transpiling to C, js?
Interaction with other libraries?
(You have to install Tor Browser to open these onion links https://www.torproject.org/download/)
The source code is open - GPLv3 License.
(There are clearnet->tor gates, but you should not use them.)
(There are clearnet->tor gates, but you should not use them.)
But there don't seem to be filters, like only showing posts older than a certain date. Or with a certain comment threshold.
Pass.