Supabase: How to use it as your multiplayer game backend, with dedicated game servers and Matchmaking

This guide shows you how to use Supabase as the backend of your multiplayer game, for sign-in, player profiles, match history and a live leaderboard, while Edgegap's dedicated game servers run the matches: one authoritative server per match, started near its players by Edgegap's matchmaker.
Once your game server is containerized, Edgegap deploys it worldwide to 615+ Edge Cloud locations (on-demand) from a simple API call and billed exclusively on usage: no entire server to rent, provision or keep running between matches. For persistent servers of reserved capacity, Edgegap offers Private Fleets. In this guide, Edgegap's Matchmaking starts the servers, so only signed-in players can find a match.
Each side does what it is built for. Supabase keeps everything that outlives a match and decides who may queue. Edgegap groups the players, starts a server near them and stops billing when the match ends. The server decides the result, so nothing a player changes in the browser reaches the leaderboard.
Built your game with Lovable? Lovable projects already run on Supabase: sign-in, a Postgres database, Edge Functions and Realtime. What they don’t have is a server that runs the match. This guide adds it: one authoritative game server per match on Edgegap, next to the Supabase backend your game already uses.
This guide covers:
Preparing your game, a Supabase project and your Edgegap account
Connecting your coding agent to Edgegap (optional)
Setting up Supabase: schema, Row Level Security and anonymous sign-in
Letting the game server check players, then containerizing it
Playing a match locally with Supabase
Adding matchmaking through a Supabase Edge Function
Recording results and showing a live leaderboard
Testing the full loop with two players
You can do it two ways, and mix them:
With a coding agent. Connect Claude Code, Cursor or another agent to the Edgegap MCP server and its agent skills. The
edgegap-supabaseskill writes the schema, the Edge Functions and the game server changes, and runs the Supabase CLI with your consent. You handle the sign-ins, the Edgegap dashboard and playtest.By hand. Every step below also works without an agent.
The guide uses Supabase Sumo Push: a Three.js party brawler from Edgegap's mini-games, with Supabase sign-in, profiles and a live leaderboard. It was tested end to end on 3 November 2026 with a hosted Supabase project on the free plan and Edgegap's free tier.
Who does what
Supabase does | Edgegap does |
|---|---|
Signs players in (anonymous sign-in, upgradable to email or OAuth later) | Groups players with the matchmaker |
Stores profiles, wins and match history (Postgres with Row Level Security) | Starts a dedicated server near them for each match |
Keeps the matchmaker token in an Edge Function and ties every ticket to a player | Gives the page a |
Records the results the game server reports, after checking each player's ticket | Bills the server only while the match runs: the server stops itself |
Pushes leaderboard changes to every open page (Realtime) |
The browser holds no secret, and the game server holds no Supabase key.

Step-by-Step Guide
Detailed Integration Steps
1. Before you start
A free Edgegap account. Verify your email. No credit card is needed to test.
A Supabase account. The free plan is enough. The Supabase CLI runs through
npx, so there's nothing to install.Node.js 22 or newer, and a containerization tool, running. We recommend Docker Desktop.
A browser game with its own Node.js WebSocket game server. No server yet? Start with the Browser Games guide: it builds the server this guide extends.
For the agent path: an Edgegap API token, from Dashboard → User Settings → Tokens. It is organization-wide, so treat it like a password: never put it in a client, your server image or a chat. This setup never needs it outside your agent.
Built with Lovable? Turn on its GitHub sync so the game server can live in the same repository. Then check where its backend lives. If you connected your own Supabase project, steps 3 and 6 work as written. If the app runs on Lovable Cloud, Lovable owns that Supabase project and the Supabase CLI can’t reach it: set secrets and deploy functions through Lovable instead (see step 6).
Shortcut: run the sample first. Clone Supabase Sumo Push, run
npm installandnpm run dev, thennpm run webin a second terminal. Openhttp://localhost:8080, select Local server and open a second tab to play against yourself. Without Supabase configured, the server lets anyone in and records nothing.
2. Connect your coding agent to Edgegap
Skip this step if you're doing everything by hand.
The Edgegap MCP server lets your agent create apps and versions, deploy servers, read logs and generate matchmaker configurations on your account. The edgegap-supabase skill gives it the files tested with Sumo Push: the database schema, the two Edge Functions, the game server's player check and the browser code. It builds on edgegap-threejs, which holds the game server itself. Creating a Supabase project, pushing the schema, setting secrets and deploying functions change your Supabase account, so the agent asks before it does them.
Claude Code: install the Edgegap plugin. It adds both the MCP server and the skills, and asks for your API token during install (stored in your system's credential store):
/plugin marketplace add edgegap/llm-agent-skills, then /plugin install edgegap@edgegap. Restart the session.
Only want the MCP server, without the plugin? Run this in your own terminal instead: claude mcp add --transport http edgegap https://mcp.edgegap.dev/mcp -H "Authorization: token YOUR_EDGEGAP_API_TOKEN" --scope user. Don't do both, or you'll have two edgegap servers.
Cursor, VS Code and other clients that send headers: add https://mcp.edgegap.dev/mcp with the header Authorization: token YOUR_EDGEGAP_API_TOKEN, and install the skills with npx skills add edgegap/llm-agent-skills --skill "*".
Claude Desktop: custom connectors can't send the header, so use the local server instead (Node 22): { "mcpServers": { "edgegap": { "command": "npx", "args": ["-y", "@edgegap/mcp"] } } }. It asks for the token on first use.
Check it works:
"List my Edgegap apps."
3. Set up your Supabase project
Supabase signs players in and keeps everything that outlives a match. The sample's schema is ready to use: adapt what a profile holds and what a match counts, and keep the ticket checks.
Create and link a project:
npx supabase login, thennpx supabase projects create <name> --org-id <your-org-id> --region <region>andnpx supabase link --project-ref <project-ref>.npx supabase orgs listshows your org ID.Push the schema:
npx supabase db push --remoteapplies the sample's migrations: profiles, tickets, matches, Row Level Security and therecord_match()function. A trigger creates a profile with a random name for every new player.Turn on anonymous sign-ins: on a project made for this game,
npx supabase config push. It sends every Auth setting inconfig.toml, so on an existing project use the dashboard instead: Authentication → Sign In / Providers → Allow anonymous sign-ins.Point the page at it: copy
client/config.jstoclient/config.local.jsand fill in the Project URL and Publishable key from Project Settings → API Keys. The publishable key is made to ship in pages: Row Level Security limits what it can do.
Players get an account without filling in a form. To keep their progress across devices, link an email or OAuth sign-in to the anonymous player later: the player, and their profile, stay the same.
Check before going further: a player can rename themselves, but can't change their wins, create tickets or call record_match().
With your agent:
"Load the edgegap-supabase skill. Create a Supabase project for my game, push the schema with profiles, tickets, matches and Row Level Security, turn on anonymous sign-ins, and check that a player can't change their own wins. Ask me before each change to my Supabase account."
4. Let the game server check players, then containerize it
The game server holds no Supabase key. When a player connects, it checks the player's Supabase access token against your project's public signing keys, and at the end of the match it reports the result through an Edge Function, with a shared secret.
Check players: the sample's
server/supabase.jsverifies access tokens with thejoselibrary, refuses players who aren't signed in, and keeps one connection per player. WithoutSUPABASE_URLset, it lets anyone in, for local development.Signing keys: new Supabase projects sign tokens with asymmetric keys. If
https://<project-ref>.supabase.co/auth/v1/.well-known/jwks.jsonlists no key, switch the project to asymmetric JWT signing keys in the dashboard first.Build and push: after
docker login registry.edgegap.comwith the username and token from the Container Registry page, rundocker build --platform linux/amd64 -t registry.edgegap.com/<project>/<image>:<tag> .anddocker push. Tag every build with its time, neverlatest.
Then create the application and its version in the dashboard:
Your image and tag.
Port 7777, protocol WS, name
gameport, with TLS Upgrade turned on.0.25 vCPU and 512 MB, and a max duration of 30 minutes as a safety net: the server stops itself.
Environment variables:
SUPABASE_URL(https://<project-ref>.supabase.co),GAME_SERVER_SECRET(a long random string, marked Secret; you need it again in step 6) andREQUIRE_TICKET=1, so only matched players get in.
With your agent:
"Using the edgegap-supabase skill, add the Supabase player check and result report to my game server, then containerize it for linux/amd64, push it with a new tag and create the app version: port 7777, protocol WS, TLS Upgrade on, named gameport, with SUPABASE_URL, a secret GAME_SERVER_SECRET and REQUIRE_TICKET=1."
5. Play a match locally with Supabase
Before going online, check that Supabase and your game work together on your machine:
Run the game server with your project:
SUPABASE_URL=https://<project-ref>.supabase.co npm run dev. It now refuses players who aren't signed in.Open the page (
npm run web, thenhttp://localhost:8080). The menu shows the player's generated name, their record and the leaderboard. Change the name: it's saved to the profile.npm testplays a full match with two headless players and checks the phases and the result.
Results are only recorded for matchmaker matches, because they need a ticket. That's the next step.
6. Add matchmaking through an Edge Function
The browser never calls Edgegap's matchmaker. A Supabase Edge Function holds the matchmaker's token, checks the player's session and ties every ticket to a player, so only signed-in players can queue.
Create the matchmaker: in the sample's
edgegap/matchmaker-config.json, set your application name and version. Its profile is a free-for-all of 2 to 8 players, and a lone player gets a match after 20 seconds, with bots filling the seats. In the dashboard, open Matchmaker, select Create Matchmaker, upload the file and select Create and Start. Copy its API URL and Auth Token.Store them in Supabase:
npx supabase secrets set EDGEGAP_MM_URL=<API URL> EDGEGAP_MM_TOKEN=<Auth Token> GAME_SERVER_SECRET=<same secret as step 4>.Deploy the functions:
npx supabase functions deploy matchmakingandnpx supabase functions deploy report-match. Both check their callers themselves:matchmakingwith the player's session,report-matchwith the shared secret.
Find Match then works in three calls to the matchmaking function: join (a player searching alone is a group of one; it cancels any earlier search), status (the page asks every 1.5 seconds, and gets the wss:// address once a server is assigned) and cancel. Closing the page mid-search also cancels it, so a search left behind doesn't start a server nobody joins.
With your agent:
"Using the edgegap-supabase skill, deploy the matchmaking and report-match Edge Functions with my matchmaker's API URL and Auth Token as Supabase secrets, and wire Find Match in my page to the matchmaking function, with cancel on page close."
On Lovable Cloud? The supabase secrets set and supabase functions deploy commands can’t reach a Lovable Cloud project. Add EDGEGAP_MM_URL, EDGEGAP_MM_TOKEN and GAME_SERVER_SECRET in Lovable’s Secrets panel instead, and let Lovable deploy the matchmaking and report-match functions. This path hasn’t been tested end to end yet.
7. Record results and show a live leaderboard
The server decides the result. Players only send inputs. The server owns positions, rounds and the winner.
The server reports it. At the end of the match, it posts the result to the
report-matchfunction with the shared secret.record_match()only accepts players with their own, unused ticket, so even a leaked secret can't award wins or replay a match.The leaderboard updates live. Supabase Realtime pushes profile changes to every open page.
Host the page anywhere that serves static files: GitHub Pages, Netlify, Vercel or Supabase Storage. If you later add email or OAuth sign-in, add the site's address under Authentication → URL Configuration.
8. Test the full loop with two players
Make sure no test deployment is still running. On the free tier, a leftover one blocks the matchmaker's deployment.
Open the page in two browser windows with different profiles, or one private window: two windows of the same profile share one Supabase session.
Select Find match in both within 20 seconds. Both land on the same Edgegap server.
When the match ends, the leaderboard updates on both pages and the server stops its own deployment. In our test, it stopped 14 seconds after the match.
To test without a browser: SUPABASE_URL=… SUPABASE_PUBLISHABLE_KEY=… node tools/e2e.mjs 2 signs in two headless players, plays a full match on Edgegap, reads the result back from Supabase and checks that the server stopped itself.
Before launch: set inspect to false in the matchmaker configuration, lower FIRST_JOIN_TIMEOUT_S for servers whose players never arrive, let players link an email or OAuth sign-in, and clean up old tickets rows. Supabase limits anonymous sign-ins to 30 per hour per IP address by default.
On the free tier, the matchmaker stops 3 hours after each start (restart it from the dashboard) and one deployment runs at a time. Not tested yet: game servers other than Node.js (Unity, Godot, Unreal) checking Supabase tokens, and email or OAuth sign-in.
Going live? Ask your agent to run the edgegap-launch skill's checklist.
Stuck? Ask your agent to load edgegap-troubleshoot, or ask our team and other studios on the Edgegap Discord.
Frequently Asked Questions
Common questions about using Supabase as your game backend with Edgegap's dedicated game servers.
Can Supabase host my real-time game server?
Supabase runs your database, sign-in, Edge Functions and Realtime updates. A real-time match needs a process that runs the game's rules for the whole match, near its players. Edgegap runs that process, one per match, and stops it when the match ends.
Does the game server need a Supabase key?
No. It checks each player's access token against your project's public signing keys, and reports results through an Edge Function with a shared secret. Your Supabase secret key never leaves Supabase.
Can players cheat their way onto the leaderboard?
The game server decides every result, Row Level Security stops players from changing their own wins, and record_match() only accepts players with their own, unused matchmaking ticket.
Do players need to create an account?
No form to fill in: they're signed in anonymously the first time they play, and come back as the same player on the same browser. Link an email or OAuth sign-in later to keep their progress across devices.
Does this work with Unity, Godot or Unreal game servers?
The schema, the Edge Functions and the Find Match flow are the same, over HTTP. The game server needs a JWT library that verifies ES256 tokens against your project's signing keys. Only the Node.js server has been tested on Edgegap.
Can I use this with a game built in Lovable?
Yes. Lovable projects use Supabase for their backend, so the sign-in, database and Edge Function parts of this guide fit them as they are. Sync the project to GitHub, add the game server, and host it on Edgegap. With your own Supabase project connected, follow the steps as written. On Lovable Cloud, set the secrets in Lovable’s Secrets panel and let Lovable deploy the functions: the Supabase CLI can’t reach those projects, and moving one to your own Supabase account later means migrating it by hand. The steps were tested with the Sumo Push sample, not yet with a Lovable project.

Clients
Learn more from clients who integrated Edgegap
31 case studies are available from studios that moved to Edgegap from another platform.

A Flawless Global Launch for Rivals of Aether 2
Aether Studios
Learn how Aether Studios quickly added Edgegap and delivered flawless launch & post-launch to their community.
Case Study

Overcome Latency Introduced by VR’s use of WiFi in Competitive Multiplayer
Halfbrick Studios
Discover how Halfbrick successfully launched & maintains a multiplayer-focused Early Access on META Quest's VR platform.
Case Study

MENA’s Social App Adds Online Games
WOLF
Learn how the highly popular MENA-region social app added matchmaking & multiplayer games orchestration easily to WOLF Qanawat.
Case Study

Hybrid Orchestration Keeps Kickoff Tactics Ready for Any Traffic
Birch Games
How hybrid orchestration helped Birch Games handle traffic, pairing egress-free Fleets with the regionless cloud.
Case Study

Authentic Online Warfare Requires the Ultimate Orchestration
Highwire Games
Learn how Highwire's need for performance required orchestration only Edgegap can deliver.
Case Study

22,000 Reviews, 4.8 Stars, and Infrastructure That Scaled Automatically
Sinn Studios
How a simple, Slack-supported integration got Sinn Studio's hit VR title online fast and keeps it there.
Case Study

Dynamic Server Orchestration
Under NDA - AAA Studio
Discover how one the world's biggest AAA studio improved its peer-to-peer multiplayer experience through edge computing.
Case Study

Near Zero Latency for AAA Fighting Game
AAA Studio - Under NDA
How an unannounced project delivered the lowest lag possible and improved fairness in its 1v1 game.
Case Study

Play Gods with Multiplayer Physics
Squido Studio
Learn how Squido uses Edgegap's highligh optimized game servers to deliver mind-bending & chaotic VR gameplay.
Case Study

A Fully Managed Solutions that Saves Time for Indies Multiplayer VR Horror
Dirty Pearl Studios
Discover how Dirty Pearl Studios saved development time thanks to Edgegap’s easy integration and automated orchestration alongside its Nakama integration.
Case Study

7 Days Blood Moons
The Fun Pimps & iLLOGIKA
Learn how Illogika dramatically reduced server costs & ensured the online experience the 7 Days to Die franchise expects.
Case Study

Instant Global Server Deployment for Collaborative XR Medical Education
AlensiaXR
How AlensiaXR uses Edgegap to deliver low-latency, always-available shared anatomy sessions to medical students worldwide.
Case Study

The Lightkeepers: A VR Social Co-op Game with Dedicated Servers
Spectral Games
How Spectral Games used Edgegap Matchmaking and Server Browser to launch dedicated servers for its VR social lobby, with no prior server experience.
Case Study

Fast & reliable deployments worldwide for PvPvE challenger Gravebound
Crater Studios
How Edgegap’s orchestration and matchmaking helped Crater Studios dramatically helped a small them focus on gameplay instead of infrastructure.
Case Study

Rapid Scaling of Web Metaverse
Hiber
Learn how Hiber eliminated the guesswork out of its server capacity planning with Edgegap.
Case Study

High Hardware Requirements & Custom Game Server Pools
Alderon Games
Learn how Alderon Games instantly leverages a custom pool of game servers across multiple providers worldwide for its popular MMO.
Case Study

Easy Integration for Indie Devs
WhaleFood Games
Read how WhaleFood Games "kicked out" its netcode issues with Edgegap.
Case Study

Cutting-edge tech that powers South-East Asia’s first-ever eSports title.
Anantarupa Studios
Learn how Edgegap transformed South-East Asia’s gaming landscape streamlining complex infrastructure and cutting-edge tech with one seamless solution.
Case Study

One Strike. Global Reach.
Triple Hill Interactive
How Triple Hill Interactive leverages Edgegap's orchestration to deliver low latency and improve fairness in a genre where every millisecond counts.
Case Study

Fast-paced Team Battle Royale... with Gun-totting Animal Plushes!
SANDYFLOOR
Discover how a Korea-based Indie Studio launched it multiplayer worldwide.
Case Study

Mobile Horse Racing Goes Global with Instant, Cost-Efficient Servers
Mirai Labs
How Mirai Labs powers Pegaxy Blaze's worldwide multiplayer races with just-in-time server deployment and fractional vCPU to keep cost per player low.
Case Study

Server Management & Distribution
Matrioshka Games
Read how Matrioshka Games were able to ship a Battle Royale in early access with limited ressources.
Case Study

At my Signal, Unleash Hell!
TyGames
Discover how Indie studio TyGames immerses players in third-person gladiatorial combat multiplayer.
Case Study

Instant Worldwide Orchestration
Soliton Interactive
Discover how Soliton Interactive did the impossible… Ship it's first playable as multiplayer!
Case Study

Competitive play with server-side physics ensures ideal sub-50 ms latency
NS7
Discover why solely Edgegap could enable an indie studio to deliver on its vision for a AAA-quality F2P sports gameplay through server-side physics and authority.
Case Study

Regional Deployments for iGaming
X1 Contra 1
X1 Contra 1 delivers real-time PvP casual games to its Brazilian player base through cost-effective hosting & regional deployments, ensuring data and legal compliance.
Case Study

Pay Only When Players Play: Affordable Multiplayer Infrastructure
Meltdown Interactive
How Edgegap helped indie developer Meltdown Interactive Media solve cost-effective scaling and matchmaking without the complexity, so they could focus on building the game.
Case Study

One Edgegap platform, three very different networking profiles
Warped Games
How Warped Games runs a social hub, real-time co-op, and turn-based co-op, all on the same Edgegap deployment API and the same container pipeline.
Case Study

Pool Live Tour Max
RETA Games
Case Study

Korea’s Web3 POP Extraction Shooter Goes Global, Instantly
NDUS Entertainment
How XOCIETY easily added Edgegap orchestration & integrated custom matchmaking working alongside Edgegap Ping Beacons to optimize latency.
Case Study

Multiplayer in Every Dimension
Arcadia.tv
Discover how Arcadia.tv uses Edgegap's edge network to deliver an innovative, team and location-based athletic VR sport.
Case Study

F2P Mobile Fighter Cuts Infrastructure Costs With Just-in-Time Servers
Game Changers Worldwide
How Game Changer Worldwide hosted Rumble Rush's real-time 3v3 PvP globally on mobile.
Case Study
Key reasons why they chose Edgegap
Discover the impact of Edgegap's automated game server orchestration for a flawless multiplayer experience.









