Self-hosting Revolt with custom revite

This is just a little tutorial for setting up revolt with a modified Revite client. Note that there may be a few typos because I wrote this pretty fast. If you have any questions or want to know how to do something, just ping me on my Revolt server.

Main Tutorial

Make sure that port forwarding is setup for ports 5000, 8000, 9000, 3000, and 7000.

First, we need to setup the API. (This tutorial will be using Docker so it assumes that it is already installed) Note that “cp” is “copy” on Windows.

git clone https://github.com/revoltchat/self-hosted revolt-api
cd revolt
cp .env.example.env

Change anything that says “local.revolt.chat” to whatever your domain name is. Also, this tutorial does not go into setting up email or captcha so make sure to set “REVOLT_UNSAFE_NO_EMAIL” and “REVOLT_UNSAFE_NO_CAPTCHA” to 1.

Now, you should be able to run “docker-compose up -d” and the API and the vanilla version of Revite.

Now that the API is up and running, you can get your custom version of revite ready.

Make sure that “VITE_API_URL” is set to “yourdomainname:8000”

Also due to a few weird issues, you have to set the “replacement” variable inside of “scripts/inject.js” to be “yourdomainname:8000”

git submodule init
git submodule update
yarn
yarn build:deps
yarn build
yarn start:inject

Now, your custom Revolt instance will be running at “yourdomainname:5000” Please note that if you changed anything outside of the “public” folder, you must have “yarn start:inject” always running while the API is running in order for the changes to work.

Tips & Tricks

Please note that these tutorials use MongoDB Compass . To connect to to your database in MongoDB compass, you must shutdown your API using “docker-compose down” and then creating a file name called “docker-compose.override.yml” and adding the following text:

# docker-compose.override.yml
services:
  database:
    ports:
      - "27017:27017"

You can now turn your API back on by using “docker-compose up -d”

Now, you can connect to “youripaddress:27017” inside of MongoDB compass and you should be in. To verify, you should see a database called “revolt”

Making your instance invite-only

Connect to your database by connecting to “youripaddress:27017” and expand the “revolt” database. You should see a folder called “invites” Once you open it, “Add Data” and then “Insert Document” Then, delete all of the text, and paste in the following text (Replace “YOUR INVITE CODE HERE” with your invite code obviously):

{
  "_id": "YOUR INVITE CODE HERE"
}

Now, take your API down by running the command “docker-compose down” and then setting “REVOLT_INVITE_ONLY” to 1 inside of the .env file. Once you turn your API server back on using the command “docker-compose up -d”, when you try to create an account it will force you to put in your invite code.

Giving badges to a user

Before you do anything you must get an integer corresponding to what badges you want to give. All you have to do is add up the value for each badge and save the integer for later.

    Developer = 1
    Translator = 2
    Supporter = 4
    Responsible Disclosure = 8
    Founder = 16
    Platform Moderation = 32
    Active Supporter = 64
    Paw = 128
    Early Adopter = 256
    Reserved Relevant Joke Badge 1 = 512
    Reserved Relevant Joke Badge 2 = 1024

Connect to your database using “youripaddress:27017” and the expand the “revolt” database and click on “users” Find the user that you want to give the badge to. (They can be easily be located by trying to find their user ID in the “_id” field.) Hover over their entry and press the pencil icon to edit it. Now, hover over the last field of their entry and click the plus icon and then “Add field after x” Before the colon, type in “badges” After the colon, type in the integer that you got earlier. Now, on the right side of the field, change the type from “String” to “Int32” You can now press “update” and the badges should show up.

Creating custom server invite links

Before you start, make sure that you have created an invite link and wrote down the invite code.

Connect to your database using “youripaddress:27017” and expand the “revolt” database and click on “channel_invites” Find the invite you want to modify by finding the invite code that you had written down in the “_id” field. Once you have found, hover over it and click on the pencil icon. Then, replace the field after the semicolons for “_id” with you custom invite code. Then, you just have to click “Save” You should now be able to go to “yourdomainname:5000/invite/yourinvitecode”

Leave a Reply

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