The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 61 lines 2.78 KB
Raw
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 ## Environment variables
39
40 | Variable | Description |
41 | -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
42 | `ALCHEMY_WORKERD_PATH` | Path to the `workerd` binary every local Workers runtime runs, instead of the one from npm (e.g. on NixOS) |
43 | `ALCHEMY_WORKERD_V8_FLAGS` | Extra V8 flags for every local Workers runtime, separated by whitespace (e.g. `--max-old-space-size=4096`) |
44
45 A Worker's `dev.workerd` option sets the same things for that Worker alone, and wins over these.
46
47 ## Examples
48
49 ```sh
50 # Start dev mode (stage dev_$USER)
51 alchemy dev
52
53 # Emulate the prod program locally (replaces that stage's local/live mode)
54 alchemy dev --stage prod
55 ```
56
57 ## Where next
58
59 - [logs](/cli/logs) fetches past logs or tails them with `--tail`
60 - [deploy](/cli/deploy) — deploy for real
61 - [Local development](/environments/local-development) — how dev mode works under the hood