plushie/dev_server

Dev server: file watcher and recompiler for live reload.

Watches source directories for .gleam file changes, runs gleam build, detects changed BEAM modules, reloads them, and tells the runtime to re-render. The UI updates without losing application state.

Started automatically when dev: True is set in StartOpts.

Requires the file_system Hex package (an Elixir library) as a project dependency, and Elixir installed in your environment. Without it, the dev server starts but file watching is disabled and a warning is logged. See the Getting Started guide for setup.

Types

Messages handled by the dev server actor.

pub opaque type DevMessage

Values

pub fn start(
  runtime: process.Subject(runtime.RuntimeMessage),
) -> Nil

Start the dev server actor, watching src/ for changes.

pub fn start_supervised(
  runtime: process.Subject(runtime.RuntimeMessage),
) -> Result(
  actor.Started(process.Subject(DevMessage)),
  actor.StartError,
)

Start the dev server under a supervisor.

Returns Started for use as a supervisor child spec.

pub fn stop(subject: process.Subject(DevMessage)) -> Nil

Send a shutdown message to the dev server actor.

Stops the file watcher process and exits the actor cleanly. Call this explicitly during runtime shutdown to clean up the file watcher; OTP supervisor shutdown signals do not trigger custom message handlers.

Search Document