---
title: How it works
description: "The build and deploy pipeline: from a JavaScript file to a running sprout behind Caddy."
---

1. **Write the handler**

    `src/index.js`: `export default { fetch(request) { ... } }`. See [The handler](/concepts/handler).

2. **Build**

    `sproutboat build` runs Porffor + Zig on your machine and produces a single `linux-x86_64` executable (the "sprout"). Your source never leaves the machine.

3. **Deploy**

    `sproutboat deploy` uploads the executable plus `sproutboat.jsonc`-derived sidecars (`bindings.json`, static assets) to the control plane.

4. **The control plane starts it**

    The control plane stores the artifact, starts the sprout behind Caddy, and issues a TLS cert on the first request.

5. **Bindings come online**

    If the deployment declares bindings, the control plane also starts a broker process next to the sprout. The sprout reaches it over loopback for every `env.*` call.

## Cold start and lifetime

Cold start is a process exec plus a socket bind — tens of milliseconds. The process then stays warm and answers in a few milliseconds, and is evicted after about ten minutes idle.

:::note
This is the deployed-sprout lifecycle. A [standalone binary](/get-started/standalone) skips the control plane, Caddy, and the broker entirely.
:::
