Self-hosting overview
Run GoPayLocal on your own Cloudflare account and Postgres database. What you deploy, what you need, which Cloudflare plan, and the order of the setup steps.
The GoPayLocal server is open source. You can run the same code as the hosted service on your own Cloudflare account, with your own Postgres database.
A self-hosted install runs in self-hosted mode (SELF_HOSTED="true"). Every organization is unlimited, the “Powered by GoPayLocal” link on the banner is off, and billing is switched off. Every feature is included. Differences from hosted lists the rest.
What you deploy
Section titled “What you deploy”| Part | Runs as | Needed? |
|---|---|---|
API (apps/api) |
A Cloudflare Worker with Hyperdrive, two KV namespaces, rate limiters and three cron triggers | Yes. It serves the banner, the SDK endpoints, the dashboard’s API, sign-in and provider webhooks. |
Dashboard (apps/dashboard) |
A Cloudflare Worker that serves static files | Yes, to manage products, campaigns, integrations and your team. |
Admin app (apps/admin) |
A Cloudflare Worker that serves static files | Optional. Platform admin screens: overview, organizations, users, alerts and audit log. |
Docs (apps/docs) |
A Cloudflare Worker that serves static files | Optional. |
Marketing site (apps/web) |
Not deployed | No. It is the gopaylocal.com landing site. |
| Postgres | Your database provider | Yes. |
Requirements
Section titled “Requirements”- A Cloudflare account. See Cloudflare plan below for Free versus Paid.
- A domain with its DNS on Cloudflare (recommended). You need one to serve the Workers on your own hostnames: a Custom Domain requires an active Cloudflare zone (Custom Domains). See Domains and sign-in cookies.
- Postgres 15 or newer, reachable by Cloudflare Hyperdrive over TLS. The schema needs 15 (it uses a
NULLS NOT DISTINCTunique constraint); CI tests on 18. See Database and migrations. - A Google OAuth client or a GitHub OAuth app, or both. Public email sign-up is disabled, so OAuth is how people create accounts. See OAuth setup.
- On your computer: Git; Node.js at a version allowed by the
enginesfield of the rootpackage.json(22.23.4 or newer on the 22 line, 24.11 or newer on the 24 line, or 26 and later); and pnpm at the version pinned in itspackageManagerfield. Runningcorepack enableonce makes Corepack fetch and use exactly that version (on Node 26, install it first withnpm install -g corepack).
Cloudflare plan
Section titled “Cloudflare plan”Figures from Cloudflare’s documentation, checked November 2026. Follow the links for current values.
| Workers Free | Workers Paid | |
|---|---|---|
| Price | $0 | Minimum $5 per month per account (pricing) |
| CPU time per HTTP request | 10 ms | 30 s by default, up to 5 min (limits) |
| CPU time per cron run | 10 ms | 15 min for schedules that run hourly or less often; 30 s for more frequent ones (limits) |
| Requests per day | 100,000 (limits) | Billed by usage (pricing) |
| Hyperdrive | Included: 100,000 queries per day, about 20 database connections per configuration | Included: unlimited queries, about 100 connections (pricing, limits) |
| KV | 100,000 reads and 1,000 writes per day, 1 GB stored (limits) | Billed by usage |
| Cron triggers per account | 5 (GoPayLocal uses 3) | 250 |
| Static files (dashboard, admin, docs) | Free and unlimited | Free and unlimited |
What needs Workers Paid: the daily VPN data refresh. The 30 9 * * * cron rebuilds the VPN, datacenter and Tor IP dataset. That took 0.2 to 0.3 seconds of CPU in our Node measurements, far more than the Free plan’s 10 ms per cron run. On Free, the run stops before it writes anything, and you build and upload the data from your computer instead: see VPN detection: Workers Free. Until the data is loaded, VPN detection only checks the visitor’s network against a built-in list of datacenter and VPN networks. The 40 */6 * * * cron refreshes the exchange rates used for local prices. Its CPU use has not been measured on Workers Free. If it has not run, banners still work and show exact prices in your product’s currency, with no converted estimate.
Nothing else in the configuration is documented by Cloudflare as Paid-only. Hyperdrive “is included in both the Free and Paid Workers plans”. Cloudflare’s rate limiting binding page does not say which plans include it.
Domains and sign-in cookies
Section titled “Domains and sign-in cookies”Put the API, the dashboard and the admin app on hostnames under one domain, for example api.example.com, app.example.com and admin.example.com.
Sign-in uses a session cookie that the API sets with SameSite=Lax (Better Auth’s default). Browsers send that cookie with the dashboard’s requests to the API only when both are on the same site, meaning the same registrable domain. Hostnames on two different domains do not work.
The workers.dev hostnames of one Cloudflare account (<worker>.<account>.workers.dev) also count as one site, because workers.dev is on the Public Suffix List. The hosted service uses custom domains, and a workers.dev-only setup has not been tested.
Setup, in order
Section titled “Setup, in order”- Database and migrations: create the database and apply the schema.
- Cloudflare setup: create the Cloudflare resources, write
wrangler.toml, set secrets, deploy the API and the dashboard. - OAuth setup: create the Google or GitHub OAuth app that people sign in with.
- First admin user: sign in and give yourself the admin role.
Reference pages:
- Configuration reference: every variable, secret and binding.
- Upgrading: pulling new versions and running new migrations.
- Differences from hosted.
The source of truth for the API’s configuration is apps/api/wrangler.example.toml in the repository. Every binding, variable and secret in it has a comment saying what it is for and whether it is required.