/gm_express_service

Fast Services

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Express Service

This is the backend web project that supports the GMod Express Addon.

Deploy your own

Deploy on Cloudflare ☁️


It's super straightforward to run your own Express instance on Cloudflare!

It should only take a couple of minutes, just click this button! (more instructions below):

Deploy to Cloudflare Workers

When it asks you to make a new API Token, be sure you select the "Edit Cloudflare Workers" template:

chrome_88omaNQrgW

Then, set the Account Resources and Zone Resources to "All accounts" and "All zones" respectively:

chrome_S79PHew0KS

Click "Continue to summary"

chrome_KGNhnsgTi7

Click "Create Token"

chrome_YB68lnT9rj

Copy your API Token into the setup page

chrome_HxAtd02BXx

chrome_5xgZ8Z0zRg

Self-Hosted 🛳️


The Express Service comes out-of-the-box ready to self-host.

The included docker-compose.yml has everything you need to get started. All you need is Docker Compose.

Once you clone the repository, you just start it with Compose:

docker compose up --build -d

The Express Service will (by default) be available at both 127.0.0.1:3000 and your public IP, port 3000.

You can change the address that Express binds to by changing the API_HOST/API_PORT settings in the .env file. For example, if you were going to serve Express from behind a Reverse Proxy, you might want to set API_HOST=127.0.0.1.


Configuring the addon for self-hosting

If you host your own Express instance, you'll need to change a couple of convars.


express_domain

This convar tells both the Server and Client what domain they can find Express at. By default, it's gmod.express - the public & free Express instance.

If you run Express from Cloudflare, you'll need to update this convar with whatever your Cloudflare Worker URL is. By default it's a *.workers.dev domain, but if you configure it to use one of your domains, you'll of course want to set that instead.


express_domain_cl

This convar lets you set a specific domains for Clients. If you leave it empty, both Server and Client will use express_domain.

This convar is useful if you self-host Express on the same machine that runs your Garry's Mod server. In that setup, you'll want to do something like this:

# Tell the server to find Express locally
# (me.cfc.gg redirects to 127.0.0.1 to get around Gmod's localhost HTTP restrictions)
express_domain "me.cfc.gg:3000"

# Tell the clients to find it at your server's public IP (or, ideally, HTTPS-ready Domain)
express_domain_cl "23.227.174.90:3000"

If you host on Cloudflare, you should leave this convar empty (express_domain_cl "")