defmodule Nex.Supervisor do @moduledoc """ Framework-level supervision tree responsible for managing Nex framework's core processes. Supervised processes: - `Phoenix.PubSub` - For WebSocket hot reload broadcasting - `Nex.Store` - Page-level state storage - `Nex.Reloader` - Hot reload file watcher These processes are completely transparent to users and automatically managed by the framework. If any process crashes, it will automatically restart without affecting the user application. """ use Supervisor def start_link(opts \\ []) do Supervisor.start_link(__MODULE__, opts, name: __MODULE__) end @impl true def init(_opts) do children = [ # PubSub for hot reload WebSocket communication {Phoenix.PubSub, name: Nex.PubSub}, # Page-level state storage Nex.Store, # Hot reloader (development environment only) Nex.Reloader ] # one_for_one: If one process crashes, only that process restarts, not others Supervisor.init(children, strategy: :one_for_one) end end