Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 29, 2022 09:33 pm GMT

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.

Link to Code

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

Image description

Collaborators

None


Original Link: https://dev.to/jgaskins/redis-hackathon-submission-fauxrem-a-reimplementation-of-forem-using-redis-as-the-data-store-5615

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To