Sidecar makes it easy to run sidecar processes alongside your main
application. This is especially useful in development when you may want to
spin up a process like npm run dev
or an ngrok proxy.
If available in Hex, the package can be installed
by adding sidecar
to your list of dependencies in mix.exs
:
def deps do
[
{:sidecar, "~> 0.5.0"}
]
end
First, configure your sidecar processes:
config :sidecar, processes: [
ngrok: "ngrok http 4000",
npm: "npm run dev"
]
Then, add the Sidecar supervisor to your application's supervision tree:
def start(_type, _args) do
children = [
# ...etc.
Sidecar.Supervisor
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/sidecar.