Building Forbidden Nublar
What I learned building a multiplayer board game with Elixir and Phoenix LiveView
The first five years of my career were mostly frontend and full-stack work. My side projects owned the whole stack, but they leaned on simple setups like Supabase, so I never got very deep into backend and infrastructure.
After 2.5 years on Knock’s product team working with Elixir and React, I wanted to round out that side of my skill set, so I rotated onto the platform team in June 2026. I started by identifying gaps in my knowledge and writing a personal syllabus covering Elixir/OTP, databases, and distributed systems.
To practice the first part, Elixir and OTP, I built a multiplayer game. It hit the technical points I cared about, it was a fun challenge, and as a personal project it gave me complete freedom over the architecture and code.
What I built
Over the summer I built Forbidden Nublar, a Jurassic Park–themed take on the co-op board game Forbidden Island, using Elixir and Phoenix LiveView.

Up to four players gather in a lobby, then take turns moving around the park, repairing breached sectors, trading access fragments, and recovering four assets before the outbreak gets out of hand. Every turn ends by drawing cards that breach more sectors, so the board slowly falls apart around you.
The game is fully playable from lobby to win or loss, though there are rough edges around board readability and UX.
How the game state works
The core idea is one process per match. That process owns the game state, and everything else, like the database, the LiveViews, and reconnects, hangs off of it.
Application supervisor
│
Game.System
┌────────┴─────────┐
Registry DynamicSupervisor
(match_id → pid) │
┌───────────┼───────────┐
Game.Server Game.Server Game.Server one per active match
│
┌────────────┼──────────────┐
Game.apply/2 Postgres row PubSub "match:<id>"
(pure engine) (upsert/move) │
┌─────────┼─────────┐
GameLive GameLive GameLive one per player tab
A pure engine
The rules live in plain functions with no processes involved. Every player action is a command struct, and Game.apply/2 either rejects it or returns the new game plus the events it produced:
def apply(%Game{} = game, command) do
with :ok <- ensure_playable(game, command),
:ok <- ensure_actor(game, command),
{:ok, game, events} <- dispatch(game, command) do
{:ok, %{game | status: Outcome.status(game)}, events}
end
end
defp dispatch(game, %Move{} = command), do: Actions.move(game, command)
defp dispatch(game, %Repair{} = command), do: Actions.repair(game, command)
defp dispatch(game, %Trade{} = command), do: Actions.trade(game, command)
# ...
Pattern matching on the command struct made it easy to delegate and handle each kind of in-game event, and with keeps the validation readable. Each action is a pipeline of checks followed by state changes:
def move(game, %Move{player: pid, to: to}) do
from = player(game, pid).position
with :ok <- ensure_actions_left(game),
:ok <- ensure_adjacent(game, from, to),
:ok <- ensure_enterable(game, to) do
game
|> move_player(pid, to)
|> spend_action()
|> commit([%PlayerMoved{player: pid, from: from, to: to}])
end
end
Each match also has a random seed. Setup and card draws derive from it, so the same match always lays out the same way, which made bugs reproducible and tests deterministic.
One GenServer per match
A Game.Server wraps the engine. It holds the current %Game{}, applies commands one at a time, saves the result, and broadcasts it to everyone watching:
def handle_call({:command, command}, _from, %{game: game} = state) do
case Game.apply(game, command) do
{:ok, game, events} ->
persist(state.match_id, game)
broadcast(state.match_id, game, events)
{:reply, {:ok, game, events}, %{state | game: game}, @idle_timeout}
error ->
{:reply, error, state, @idle_timeout}
end
end
Because a process handles one message at a time, two players clicking at once can’t race each other. They’re simply queued, with no locks needed.
Servers are started on demand. A Registry maps match ids to pids, and a DynamicSupervisor owns the servers:
def find_or_start(match_id) do
case Registry.lookup(@registry, match_id) do
[{pid, _}] ->
{:ok, pid}
_ ->
case DynamicSupervisor.start_child(@dynamic_supervisor, {Server, match_id: match_id}) do
{:error, {:already_started, pid}} -> {:ok, pid}
res -> res
end
end
end
The :already_started branch covers two players opening the same match at the same moment. Only one server wins the registration, and the other caller gets its pid.
Persistence and recovery
After every successful command, the server upserts a single row per match containing the whole game serialized with :erlang.term_to_binary/1. It’s not queryable, but it’s simple, and I kept a few denormalized columns like status and turn_no for the things I did want to query.
Saving every move means the process is disposable:
- Idle matches stop. A server shuts itself down after 30 minutes without a message, and the next visit reloads it from the database.
- Crashes recover. Servers are
:temporary, so a crash isn’t restarted automatically. Instead, each LiveView monitors its server, and when the server goes down it callsfind_or_start/1again to get a fresh one.
Real-time updates
Each player’s LiveView subscribes to a match:<id> PubSub topic when it mounts. The server broadcasts {:game_updated, game, events} after every move, so every tab, including the one that acted, re-renders from the same state. The lobby uses Phoenix Presence to track who’s connected and seats exactly those players when the match starts.
What I learned
I reread Elixir in Action, which clarified a lot of fuzzy concepts and things I’d forgotten. It’s easy to gloss over language features you don’t see every day, so a tour of the language was a helpful reminder of things like tail call optimization and the differences between exits, throws, and exceptions.
While reading about more obscure features, I grepped Knock’s codebase to find where we actually use them, which was incredibly helpful. It also made it easier to read the process model underneath libraries we rely on, like Phoenix, Oban, and Broadway.
OTP really clicked this time. Building the server, registry, and supervisor myself, and deciding things like restart strategy and idle timeouts, taught me more than reading about them ever had.
What I learned about learning
It’s easy to grow complacent in a role or with a technology. This study time helped me recognize gaps in my knowledge and find opportunities to use new tools. For example, I spent more time on Exercism problems and was amazed at how powerful the Elixir standard library is for writing concise, legible code (e.g. all of the Enum functions like zip and chunk_every).
Reading alone can create the illusion of competency. Active recall and building are what really reinforce understanding. Going forward, I want to incorporate more active recall, exercises, and project-driven learning.
Learning with AI
Figuring out how to fit AI into the learning process is top of mind. It’s easy to fall into the illusion of learning by having AI explain things or generate code for you. You have to make yourself try things and spend time struggling for them to stick. I tried Claude Code’s Explanatory output style, which was interesting. On some tasks I had it write part of the code and leave pieces for me to fill in.
It also raises a question I don’t have an answer to yet: how crucial is writing code by hand now, and where does it fit in the learning process?
Going forward, I’m going to use AI throughout the learning process to:
- Build personal syllabuses and study plans
- Act as a Socratic tutor to question my understanding
- Generate quizzes, practice exercises, and other learning resources like Anki decks
Why I’m leaving it here
I only completed the first few months of my learning plan, because my daily work started covering the data pipeline topics I’d planned to explore next. The project served its purpose, and I’m comfortable leaving further features and polish unfinished.
Next, I’m starting a new learning plan that focuses on operating systems and computer architecture, then networking and security. You can follow along in my backend learning logs.