Redis Hackathon Submission: “Fauxrem”, a reimplementation of Forem using Redis as the only data store

redis-hackathon-submission:-“fauxrem”,-a-reimplementation-of-forem-using-redis-as-the-only-data-store

Overview of My Submission

For the Redis Hackathon, I’ve reimplemented portions of Forem, the software that runs this website. I’ve named it “Fauxrem” (pronounced foh-rem) because it’s a fake version of Forem. 😄 The code is available on GitHub, available under the MIT license, and you can see a demo of the app running on Heroku.

Some of the features:

  • User accounts
  • Authentication
  • Posting
    • Drafts vs published posts
    • Tags
    • Commenting (though currently no threading)
    • Likes
    • Reading List
    • Notifications on likes/comments
  • Users can follow users
  • Users can follow tags
  • The feed
    • Similar to Forem, the logged-in feed is a bit different from the feed shown to anonymous users
    • The feed shown to anonymous users shows the highest-rated content over the feed duration (the past few weeks), with “highest-rated” being based on:
      • the amount of time people spent viewing your post
      • the number of comments
      • the number of likes
    • Your personalized feed contains posts only from users you follow and tags you follow, in reverse-chronological order
    • You can mute words from your feed, so if there’s too much content you didn’t want (for example, if you’re not a JavaScript developer), you can actively filter out those terms
  • Full-text search
    • Includes advanced search (such as author:jgaskins title:redis body:hackathon to search for my posts that have “redis” specifically in the title and “hackathon” specifically in the body), which Forem does not support since the removal of Elasticsearch
  • Moderator/Admin roles
    • Moderation
      • Users can report posts
      • Mods can unpublish posts in response to a report or ignore the report altogether
    • Administration
      • Banish users
      • Edit static pages
  • Rate limiting to mitigate the following:
    • Bot scraping, a big problem for content sites
    • Pressure on the Redis database
    • Manipulation of post ratings

Redis Modules

  • RediSearch provides all querying of multiple entities, including full-text search
    • Also, I believe if you use Redis Enterprise, you can search across an entire cluster, so if you have a cluster, you only need to change one line of code to use the Cluster adapter
  • RedisJSON is used to store the Post, User, and Comment entities, allowing for atomic updating rather than the fetch-mutate-persist cycle
  • RedisTimeSeries for storing/querying metrics on how your content is performing

Submission Category

Wacky Wildcards

Language Used

Crystal, using my own Redis client.

GitHub logo

jgaskins
/
fauxrem-redis

Redis/DEV Hackathon 2022 entry

Fauxrem (Forem clone using Redis)

This is a project I created for the 2022 Redis Hackathon. It’s a Forem clone using Redis exclusively as the datastore.

Screenshot of the app, showing the title of the app, followed by a navigation element containing links for posts, users, tags, account, notifications, moderation, and admin. Below the navigation is a search form. That concludes the header. Below the header is the main site content showing the post feed, with one entry in it. The post is titled Hello World, written by jgaskins, with the tag welcome, followed by the timestamp of the post. That concludes the main body content. Below the main body content is a footer containing a copyright notice.

Overview video (Optional)

Here’s a short video that explains the project and how it uses Redis:

[Insert your own video here, and remove the one below]

How it works

How the data is stored:

Data for entities such as users, posts, comments, and a few others are stored as JSON objects using RedisJSON. Most are stored in a key of the format #{entity_type}:#{entity_id}, so for example a user with the id jamie would be stored in the key user:jamie.

  • Users
    • id : String
      • Equivalent to the username field in Forem — we have no need for the numeric id
    • name : String
  • Posts
    • id : String
      • stored as #{author_id}-#{parameterized_title}-#{random_noise}
      • example: jamie-hello-world-ad142c
    • author : String
      • The id of the user that…

Additional Resources / Info

Screenshots

The feed

Screenshot of the app showing the feed, containing only a single entry, which is a copy of this post

Notifications

Screenshot of the app showing a notification, which reads "jgaskins commented on your post"

Users can search for tags and follow them

Screenshot of the tags list page. There are 3 tags: meta, redishackathon, and welcome. The first two have an "unfollow" button next to them and the last has a "follow" button, indicating that the current user is already following the first two.

Similarly, users can search for other users and follow them

Screenshot of the user list page. There is one user named jgaskins listed, with a follow button next to their username.

Reporting posts

Reporting posts for abuse/spam. Each post has a “report” section down by the comments.

Screenshot showing the report form on a post. The heading says "Report" with a red flag emoji. Underneath is a text area to describe the report, and a submit button.

Moderators can read those reports and either unpublish the post or ignore the report.

Screenshot of the app showing the list of reported posts to a moderator, with buttons to unpublished the post or ignore the report

Admins can add static content using Markdown. They look like posts, but do not appear in the feed. They can be used for adding nav links (not yet implemented), similar to the sidebar here on DEV.

Screenshot of the app that shows a list of pages in the admin section. This list contains one entry, labeled "my first page"

Collaborators

None

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
3-ways-to-share-state-in-swiftui-that-you-need-to-know-

3 ways to share state in SwiftUI that you NEED to know 🚀💯

Next Post
learn-opengl-with-rust:-first-triangle

Learn OpenGL with Rust: first triangle

Related Posts