The domain layer of Gamend — an open-source Elixir game server for real-time multiplayer games. This package holds the contexts, schemas and migrations; gamend_web adds the REST API, WebSocket channels, LiveView admin and the generated client SDKs.

You call these modules from a plugin: a small OTP application the server loads at boot, implementing the Gamend.Hooks behaviour. That is the supported way to add game-specific rules without forking anything.

What it gives you

AreaWhat you get
AccountsEmail/password, magic link, device (guest) and OAuth for Discord, Google, Apple, Facebook and Steam. JWT access/refresh plus browser sessions, per-user revocation, presence.
LobbiesCreate/join/leave with capacity, passwords, visibility and a server-owned lifecycle state. Membership lives on the user, so a player is in at most one.
MatchmakingA ticket queue grouping players by exact parameters into hidden lobbies; parties queue as an indivisible unit, blocks are honoured while groups form, and a hook can replace the matcher outright.
Ready checks"Everyone must answer before this proceeds", one row per participant, resolving to a pass or fail your game acts on.
SocialFriends and a blacklist in one table, groups with roles and join requests, parties, and chat across lobbies, groups and DMs with read cursors.
ProgressionQuests covering achievements, dailies, seasonal events and chains; leaderboards with set/best/incr/decr operators and seasons; bracket tournaments with timed rounds.
EconomyVirtual-currency wallets and an inventory, each backed by an append-only, idempotent ledger, so a retried grant cannot pay out twice.
PaymentsStripe, Google Play, App Store and Steam, reconciled into one purchase ledger and entitlement model.
StoragePer-user, per-lobby and global key-value entries, plus object storage on local disk or S3/R2.
DeliveryIn-app notifications and push over FCM and APNs, routed per device token.
OperationsRate limiting, IP bans, caching (Nebulex, optional Redis L2), background jobs (Oban), scheduling, and retention that bounds every table which would otherwise grow forever.

Everything runs on SQLite or PostgreSQL — the same migrations target both.

Installation

def deps do
  [
    {:gamend_core, "~> 1.0.0"}
  ]
end

Where to start

  • Guides — deployment, OAuth provider setup, client SDKs and a walkthrough of each subsystem.
  • HTTP API — every endpoint, generated from the OpenAPI spec.
  • Gamend.Hooks — the plugin behaviour. Every callback is optional; before_* may veto an operation, after_* observes one that already committed.

Each domain has one context module as its entry point, so Gamend.Lobbies, Gamend.Quests and Gamend.Economy are the first three worth reading. The schema modules beneath them (Gamend.Lobbies.Lobby and so on) carry the field types and changesets.