| 1 | --- |
| 2 | title: dev |
| 3 | description: Run your stack in development mode with hot reloading — resources deploy to the cloud while Workers run in the local dev runtime. |
| 4 | --- |
| 5 | |
| 6 | ```sh |
| 7 | alchemy dev [options] |
| 8 | ``` |
| 9 | |
| 10 | Run your stack in development mode with hot reloading. Resources are deployed to the cloud while Workers run in the local dev runtime; file changes trigger automatic rebuilds and hot reloads. |
| 11 | |
| 12 | ## How it works |
| 13 | |
| 14 | `dev` re-runs your stack under `bun --watch` (or `node --watch` with type-stripping flags on supported Node versions) via `alchemy/bin/exec`. |
| 15 | |
| 16 | `--yes` and dev mode are implied, so approval prompts never appear. |
| 17 | |
| 18 | A failed apply keeps dev alive so healthy resources keep serving — fix the error and save to redeploy. |
| 19 | |
| 20 | ## Flags |
| 21 | |
| 22 | | Option | Description | |
| 23 | | ------------------- | ------------------------------------------------------------------ | |
| 24 | | `--stage <name>` | Stage to use for dev (defaults to `$ALCHEMY_STAGE` or `dev_$USER`) | |
| 25 | | `--force` | Force updates for resources that would otherwise no-op | |
| 26 | | `--profile <name>` | Auth profile to use (defaults to `$ALCHEMY_PROFILE` or `default`) | |
| 27 | | `--env-file <path>` | Load environment variables from a file | |
| 28 | | `--config, -c <file>` | Stack file to run (defaults to `alchemy.run.ts`) | |
| 29 | |
| 30 | `alchemy deploy` defaults to `live_$USER`. Using a different default |
| 31 | here means a bare `alchemy dev` will not replace a stage you deployed. |
| 32 | Pass `--stage` (or `$ALCHEMY_STAGE`) to run local emulation against a specific |
| 33 | stage — including one you also deploy. |
| 34 | |
| 35 | Tear the default local-dev stage down with |
| 36 | `alchemy destroy --stage dev_$USER`. |
| 37 | |
| 38 | ## Examples |
| 39 | |
| 40 | ```sh |
| 41 | # Start dev mode (stage dev_$USER) |
| 42 | alchemy dev |
| 43 | |
| 44 | # Emulate the prod program locally (replaces that stage's local/live mode) |
| 45 | alchemy dev --stage prod |
| 46 | ``` |
| 47 | |
| 48 | ## Where next |
| 49 | |
| 50 | - [logs](/cli/logs) fetches past logs or tails them with `--tail` |
| 51 | - [deploy](/cli/deploy) — deploy for real |
| 52 | - [Local development](/environments/local-development) — how dev mode works under the hood |