TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Discord/Reddit alternative with follow functionality (mongo/meteor.js)

8 点作者 ignasl超过 3 年前

1 comment

ignasl超过 3 年前
Hi, I have already showed my project here but now I introduced a pretty big new feature. Now you can follow any user&#x2F;channel&#x2F;thread and the latest 5 posts from your follow will appear on your personal wall on the homepage.<p>You might ask why only 5? Turns out personal wall is not as easy to solve without significant time investment if you want to keep it performant too. Simply naively aggregating posts would be costly on database and wouldn&#x27;t scale for sure and potentially wouldn&#x27;t even perform on small scale. Some smart architecture with smart caching for each user wall seemed complicated for that project that is already too big for one person. But then I thought of using things I already use - mongodb and meteor.js. My architecture is quite simple: there are tracker doc collection where document contain 5(or X) latest posts in an array and every-time something is posted this tracker is updated. Then there is userFollows collection with docs to connect users with trackers. From there I allow meteor.js to handle the rest. Once it subscribes to trackers that user follows all the posts of those trackers are shown on the front page with the added advantage that any new post if transferred right away because of meteor&#x27;s reactivity so front page is &quot;real time&quot;. I also use redis-oplog package for meteor which caches collections server side and made this pretty performant and very easy to implement. It&#x27;s not ideal but hopefully it will be good enough.