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.

There are also other non-RedisJSON data structures used for various purposes:

How the data is accessed:

Refer to this example for a more detailed example of what you need for this section.

Querying the feed:

How to run it locally?

Prerequisites

If you're using Homebrew, you can install Redis Stack and the Crystal compiler by pasting these lines in your terminal:

brew tap redis-stack/redis-stack # if you don't already have it tapped
brew install redis-stack-server
brew install crystal

If your Redis Stack server isn't already running:

redis-stack-server

Local installation

Clone the repo

git clone https://github.com/jgaskins/fauxrem-redis.git
cd fauxrem-redis

Build the app server and related tools with shards build and run the app. You will need to set the REDIS_URL environment variable if it is not running on localhost:6379, such as if you're using it with a Redis Cloud instance — the URL format is redis://username:password@host:port.

shards build
bin/fauxrem_redis

The RediSearch indexes will be provisioned automatically when the app boots. Then you can open your browser to http://localhost:4040 to see the site working.

Deployment

To make deploys work, you need to create free account on Redis Cloud, and you'll need a Redis Stack instance in order to use RedisJSON and RediSearch.

More Information about Redis Stack

Here some resources to help you quickly get started using Redis Stack. If you still have questions, feel free to ask them in the Redis Discord or on Twitter.

Getting Started

  1. Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
  2. Based on the language/framework you want to use, you will find the following client libraries:

The above videos and guides should be enough to get you started in your desired language/framework. From there you can expand and develop your app. Use the resources below to help guide you further:

  1. Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
  2. Redis Stack getting started page - Lists all the Redis Stack features. From there you can find relevant docs and tutorials for all the capabilities of Redis Stack.
  3. Redis Rediscover - Provides use-cases for Redis as well as real-world examples and educational material
  4. RedisInsight - Desktop GUI tool - Use this to connect to Redis to visually see the data. It also has a CLI inside it that lets you send Redis CLI commands. It also has a profiler so you can see commands that are run on your Redis instance in real-time
  5. Youtube Videos