Self-hosting
How to stand the entire platform up from source. The authoritative reference
for scripts and workspace layout is the repository's root README.md; this
guide is the ordered path through it.
Requirements
- Node.js >= 26 and pnpm (version pinned by the root
packageManagerfield — enable corepack and it resolves itself). - Docker with the compose plugin, for MongoDB, MinIO and production images.
Install and run in development
corepack enable
pnpm install
docker compose -f docker-compose.dev.yml up # the whole platform, containerized
Or run the infrastructure in Docker and the apps from the host in watch mode:
pnpm run dev # every workspace's watch mode
Each app also runs alone: pnpm run dev --filter=<app> (api, admin,
widget, site, docs).
Configuration: one env file
.env.example at the repository root is the single committed reference —
every variable the platform reads, one section per app, with a placeholder
wherever a real value goes. Copy it and fill it in (or paste it, filled,
straight into Dokploy's Environment tab):
cp .env.example .env
| Variables | What they configure | Where the value comes from |
|---|---|---|
APP_NAME | The deployment's brand — what makes a replica of the platform this company's | You. Baked into the documentation site at image build. |
PUBLIC_DOMAIN | The site's public hostname; every other service origin derives from it (sportsbook.example.com → sportsbook-admin.example.com, -docs, -api, -cdn) | The domain you bought — see Domains. ADMIN_PUBLIC_URL exists as an override for a non-conforming hostname. |
MONGO_URI | The platform's MongoDB | Your database server — see Servers and hosting |
MONGO_DB_NAME | Which database on that server the platform opens | Optional, sportsbook by default. Set it when two environments share one server. It is not taken from the URI path — see the note below. |
ADMIN_JWT_SECRET | Signs back-office tokens | Generate one: openssl rand -hex 32 |
MAIL_* | Mail over SMTP: the back-office's links to its staff, and an internal page's mail to its players | Your SMTP provider's credentials — production runs on Mailtrap; any SMTP service works. See Player mail; host empty = mail goes to the log |
TURNSTILE_* | Captcha on the back-office login and onboarding, and on an internal page's player sign-in and registration | The keys of one Cloudflare Turnstile widget, whose hostname list holds the back-office domain and every page domain — see Captcha; both empty = captcha off |
PLAYER_GOOGLE_* | «Continue with Google» on an internal page's player sign-in and registration | An OAuth 2.0 web client from the Google Cloud console — see Google sign-in; both empty = off |
S3_* | Object storage: media and template assets | Bucket and keys from any S3-compatible service — Spaces, S3, or your own MinIO |
LSPORTS_* | The sports data feeds, PreMatch and InPlay | Your LSports account credentials |
Three details that bite: a literal $ in any value must be escaped as $$
(docker compose interpolates single $); the Turnstile site key is
baked into the admin UI at image build — changing it means redeploying,
not just restarting; and the database name lives in MONGO_DB_NAME, not in
MONGO_URI. A connection string that ends in /?authSource=admin names no
database, and MongoDB's answer to that is test, its scratch database — so the
three services pass the name explicitly and refuse to start on test or on
MongoDB's own system databases (admin, config, local).
Build for production
One Dockerfile builds every image by target:
docker build --target api . # operations API
docker build --target admin . # back-office
docker build --target feed . # LSports consumer — run exactly one instance
docker build --target cdn . # embeddable widget on nginx
docker build --target site . # white-label Next.js host
docker build --target docs . # this documentation site
docker-compose.yml drives all of them as one deployment, plus MinIO.
MongoDB is deliberately not part of it: it runs on its own server (see
Servers and hosting) and every service reaches it through the
required MONGO_URI variable.
Deploy
With Dokploy, the recommended path (see Deployment for why): install it on the application server following the official documentation, create a Compose service pointing at this repository, paste the filled environment into the service's Environment tab, and assign each public domain to its service. From then on, a push to the deploy branch is the deploy.
With plain Docker, three things stand the platform up: Docker Engine
with the compose plugin, a MongoDB server reachable at MONGO_URI, and the
filled .env next to docker-compose.yml:
docker compose up -d
TLS and domain routing are then yours: put a reverse proxy — nginx, Caddy or Traefik — in front of the stack.
Domains
Each public-facing service gets its own hostname, derived from
PUBLIC_DOMAIN — the site's own hostname — by inserting the service name
into the first label, and pointed at the application server:
| Service | Suggested hostname | Container port |
|---|---|---|
site | sportsbook.example.com | 3002 |
api | sportsbook-api.example.com | 3000 |
admin | sportsbook-admin.example.com | 3100 |
cdn | sportsbook-cdn.example.com | 80 |
docs | sportsbook-docs.example.com | 80 |
That is the recommended naming, one environment shown; see Domain naming for the pattern and for how a second environment shares the same registered domain.
Buy the domain wherever you like — the platform does not care who the registrar is. GoDaddy is what we use; Namecheap, Cloudflare Registrar and Porkbun serve the same purpose. For operators who prefer to stay anonymous, Njalla registers the domain in its own name on the operator's behalf — the operator never appears in WHOIS.
Create one A record per hostname pointing at the server. Dokploy
provisions TLS certificates automatically (Let's Encrypt); deploying
without it, your reverse proxy does.
On Dokploy, add the five domains by hand on the compose service's Domains tab — one entry per service with its container port from the table above, HTTPS with Let's Encrypt. The panel applies the routing on its next deploy.
Captcha
Cloudflare Turnstile protects every form that takes a password, with one widget and one pair of keys for the whole deployment. It is free, invisible to most humans, and optional: leave the pair empty and the captcha is off — sensible until the deployment faces the open internet.
TURNSTILE_SITE_KEY/TURNSTILE_SECRET_KEY— the back-office login, onboarding and password recovery, and an internal page's player sign-in, registration and mail requests.- The widget's hostname list (Cloudflare → Turnstile → the widget →
Hostname Management) must hold every host a form is drawn on: the
back-office domain (
sportsbook-admin.example.com) and the domain of each internal page (casino.example.com, …). A listed domain covers its subdomains. On a host missing from the list Cloudflare answers Domain not authorized and nobody can sign in there, so add a page's domain to the widget when you create the page. Cloudflare's free plan allows 10 hostnames per widget.
Either key set without the other refuses every sign-in.
Alternatives exist — hCaptcha, Google reCAPTCHA and Friendly Captcha among them. Turnstile is the integration that ships, but its verification lives in one small adapter, so replacing the provider is a contained change, not a rewrite.
Google sign-in
An internal page can let its players sign in with Google. It is optional: leave the pair empty and no page draws the button.
PLAYER_GOOGLE_CLIENT_ID/PLAYER_GOOGLE_CLIENT_SECRET— an OAuth 2.0 client of type Web application, created in the Google Cloud console under APIs & Services → Credentials, with its consent screen published.- Under Authorized redirect URIs, add the root of every page domain, with
its trailing slash:
https://casino.example.com/and, where the page also answers there,https://www.casino.example.com/. Google refuses a sign-in that returns to an address missing from that list.
A new player picks their Google account and then completes the registration form, which asks for no password. A player whose email already has an account types that account's password once, which links the two. Either value set without the other leaves Google sign-in off, and the API names the missing one when it starts.
Player mail
An internal page mails its own players through the MAIL_* account, the same
one the back-office mails its staff through:
- A welcome that confirms the email. A new account cannot be signed into until its player followed the link in that message. The link works once, for 24 hours; signing in with an email still unconfirmed mails a new one.
- A link to a new password, which the player asks for on the sign-in form. It works once, for one hour.
Each message is sent under the page's name, wears its logo and colour, is
written in the language the player was reading and links to the page's own
domain. The address it comes from is MAIL_FROM for every page, so that is
the domain to authorize at your SMTP provider (SPF and DKIM).
With MAIL_HOST empty nothing is delivered, so no player is asked to confirm
an email: a registration signs them in at once. Set it, and every account —
those opened before it included — confirms its email on its next sign-in.
First run
The platform starts empty on purpose: the first admin user is created in the back-office onboarding screen on first visit — there are no seeded credentials anywhere in the configuration.