Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time

What is this?

FakeRelay is a tool for Mastodon admins to load statuses into their instances.

More importantly, FakeRelay is NOT:

  • A relay. Even if from Mastodon's point of view it is a relay, if multiple instances are connected to it it won't share their posts.
  • A scraper. FakeRelay receives a post's url and sends that to the registered instance.

Why is it needed?

If you're an admin of an instance, it's not really that easy to tell it "hey, index this post!". One thing any user can do is hit the /api/v2/search endpoint using resolve=true. That does accomplish the goal of fetching the post, but it's a synchronous call so it can take some seconds.

FakeRelay exposes an API to use the ActivityPub /inbox endpoint as if it were a relay. And then, the request is queued and eventually processed.

What can I use it for?

I use it to load content with #hashtags I care about. How? well, that's a separate project: GetMoarFediverse.

Other people have built other things on top of FakeRelay:

  • Abhinav wrote an article showing how you can achieve something similar to GetMoarFediverse in Python
  • Raynor built Fake Firehose, a tool that streams content from other instances and pushes that to FakeRelay.

How can I use it?

You need to get an api key

Ask the operator for an api key. If you want an api key for, I'm Send me a toot with your instance domain and I'll get you one. The API key will be associated with your domain.

I'm hosting this behind Cloudflare Workers. So if you have a lot of traffic, I'll ask you to run it on your infrastructure :)

Add the relay to your instance

Your instance will receive traffic from this site as if it were a relay. But don't worry, it won't send anything except from the statuses you tell it to index.

You need to go to /admin/relays and add as a relay. That's it! and you can remove it whenever you want.

Figure what you want to index

Use whatever logic you want to find stuff to index. On this example, I want to index

Do a simple request

And all you need to do is a post asking for the site to index it to your site!

curl -X "POST" "" \
     -H 'Authorization: Bearer {apiKey}' \
     -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
     --data-urlencode "statusUrl="

Can I see a demo?

Sure! I recorded one here.

I want to run this myself!

Sure thing! The easiest way is doing so via docker-compose. One important thing to notice is that all the instances that use your FakeRelay will treat it as a real relay. That means they will send traffic your way.

FakeRelay ignores this traffic, but that will still count against your badwidth. What I did is I set up Cloudflare so that it only forwards POSTs to /inbox if the type is Follow.

Setting up docker compose

I'm using this docker-compose.yml:

version: '2'
    image: ''
    command: web
    hostname: fakerelay
      - ASPNETCORE_URLS=http://+:5000
      - CONFIG_PATH=/data/config.json
    restart: always
      - '/local/path/to/data:/data'
      - 5000:5000
    image: ''
      - '/local/path/to/data:/data'

That will store the configuration files at /local/path/to/data (they are a couple json files).

Setup SSL reverse proxy

The relay needs to be accessible via a domain name with https. The subdomain can be served via a reverse proxy that also handles the SSL encryption.

Nginx config file

server {
  listen 443 ssl http2;
  listen [::]:443 http2 ssl;

  # Uncomment and change these lines if you want to restrict access to fakerelay
  # allow Your-Instance-IPv6-address;
  # allow Your-Instance-IPv4-address;
  # allow GetMoarFediverse-Container-IP;
  # deny all;

  server_name relay.domain.tld;

  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_max_temp_file_size 0;

    #ssl_certificate /etc/letsencrypt/live/relay.domain.tld/fullchain.pem; # managed by Certbot
    #ssl_certificate_key /etc/letsencrypt/live/relay.domain.tld/privkey.pem; # managed by Certbot

Configure the app

The first time you run this it needs to create a key, you can trigger that using:

docker-compose run --rm cli config ${RELAY_HOST}

If you want requests to the homepage to redirect visitors somewhere, you can add a "HomeRedirect" entry on the generated config.json. The file would look like this:

    "PublicKey": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----",
    "PrivateKey": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----",
    "Host": "",
    "HomeRedirect": ""

List authorized instances

g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli list-instances
│ Instance        │ Key                                                                                      │
│    │ KlYKnm9GJcM0B1p8K98vw8FSpWzWOimZ7/3C9kTdWGUmK3xmFEJJwTZ1wqERVTugLH/9alYILFehqu9Ns2MEAw== │
│ │ 1TxL6m1Esx6tnv4EPxscvAmdQN7qSn0nKeyoM7LD8b9mz+GNfrKaHiWgiT3QcNMUA+dWLyWD8qyl1MuKJ+4uHA== │

Add authorized instance

When you add an instance, the system will generate a token to index stuff on it and return that:

g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance add
Key generated for

Rotate a key

You can use instance update to rotate a instance's key:

g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance update
Key generated for

Remove an instance

If you want to revoke a instance's key, you can use instance delete:

g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance delete
Key deleted for


An API to index statuses on Mastodon acting as a relay








No releases published

Contributors 4