{
  "id": 1646576,
  "title": "Building Distributed Systems in Elixir: Part 5 — Supervisor From Scratch",
  "url": "https://urgent.news/2026/08/18/building-distributed-systems-in-elixir-part-5-supervisor-from-scratch",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-18T05:41:06.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/pckrishnadas88/building-distributed-systems-in-elixir-part-5-supervisor-from-scratch-32mh"
  },
  "original_language": "en",
  "account": "In the latest installment of this series, we dive into crafting a supervisor from scratch in Elixir. A supervisor is a process that monitors the health of worker processes and takes action when a worker fails. Our supervisor will manage two workers, restarting only the failed worker while leaving the other ones running. To achieve this, we will utilize the spawn/1, spawn_link/1, Process.flag(:trap_exit, true), send/2, and receive/1 functions. Our supervisor won't rely on GenServer or OTP supervisor, but rather, we'll utilize the BEAM's built-in features for failure detection and restart policy. We will create a manual supervisor process, two workers, and a restart loop that uses the link between the supervisor and workers, along with exit signals and exit trapping, to monitor worker health and implement a restart policy.",
  "summary": "In the previous part of this series, we explored process links. A linked worker that crashes sends an exit signal to the process linked to it. By default, that failure propagates and can terminate both processes. We also saw that a process can trap exits: Process . flag ( :trap_exit , true ) Once exit trapping is enabled, an incoming exit signal becomes a mailbox message: { :EXIT , pid , reason }…",
  "key_points": [
    "Supervisor process created manually in Elixir",
    "Two workers managed by supervisor, only failed restarted",
    "Utilizes BEAM's built-in features for failure detection"
  ],
  "editors_take": "Building a supervisor from scratch in Elixir enables developers to create a custom process that monitors and selectively restarts failed worker processes without relying on existing OTP supervisor or GenServer.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}