# Azion CLI dev

The Azion CLI `dev` command builds the project in the current directory and starts a local development server, so you can test an application or a function on your machine before you deploy it. Run it from the root folder of a project that [Azion CLI init](/en/documentation/devtools/cli/init/) created or that [Azion CLI link](/en/documentation/devtools/cli/link-command/) set up. For an existing project that is not set up for Azion, run `azion link` first. The options every command accepts, such as `--debug`, `--format`, and `-y`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Usage

`azion dev` builds the project with the preset in its configuration, then serves the build on `http://localhost:3333`:

```bash
azion dev [flags]
```

| Flag                     | Short | Type | Default | Description                             |
| ------------------------ | ----- | ---- | ------- | --------------------------------------- |
| `--port`                 | —     | int  | `3333`  | Port the development server listens on. |
| `--skip-framework-build` | —     | —    | —       | Skips the framework build phase.        |

After the first build, the command prints `Initial scan complete. Ready for changes.` and watches the project. When a file changes, it prints `Rebuilding with the new changes...`, builds the project again, and serves the new build on the same port. The server keeps running until you stop it.

---

## Examples

Each example shows the command and the output it prints.

### Run a function locally

This command starts the development server for a JavaScript project that `azion init` created from the Hello World template:

```bash
azion dev
```

The command builds the function and prints the address of the server:

```text
…
[Azion] [Build] › ℹ  info      Using preset: javascript
[Azion] [Pre-Build] › ℹ  info      Starting pre-build...
[Azion] [Pre-Build] › ℹ  info      Pre-build completed successfully
[Azion] [Build] › ℹ  info      Using preset default entry: index.js
[Azion] [Build] › ⚠  warning   DEPRECATED: Migrate handler to → export default { fetch: (request, env, ctx) => {...} }
[Azion] [Build] › ℹ  info      Starting build...
[Azion] [Build] › ✔  success   Build completed successfully
[Azion] [Post-Build] › ℹ  info      Starting post-build...
[Azion] [Post-Build] › ✔  success   Post-build completed successfully
[Azion] [Server] › ✔  success   Function running on port 0.0.0.0:3333, url: http://localhost:3333
[Azion] [Server] › ℹ  info      Initial scan complete. Ready for changes.
```

While the server runs, send a request to it from another terminal. The function in this project returns a message, the request path, and the request method as JSON:

```bash
curl -s -i 'http://localhost:3333/hello?x=1'
```

```text
HTTP/1.1 200 OK
content-type: application/json;charset=UTF-8
Date: Thu, 01 Jan 2026 12:00:00 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked

{"message":"Hello from my-function","path":"/hello","method":"GET"}
```

### Serve a static site on another port

This command starts the development server for an HTML site on port `4444` instead of the default port:

```bash
azion dev --port 4444
```

The last lines of the output show the port you passed:

```text
…
[Azion] [Build] › ℹ  info      Using preset: html
[Azion] [Pre-Build] › ℹ  info      Starting pre-build...
[Azion] [Pre-Build] › ℹ  info      Pre-build completed successfully
[Azion] [Build] › ℹ  info      Using built-in handler from "html" preset.
[Azion] [Build] › ℹ  info      Starting build...
[Azion] [Build] › ✔  success   Build completed successfully
[Azion] [Post-Build] › ℹ  info      Starting post-build...
[Azion] [Post-Build] › ✔  success   Post-build completed successfully
[Azion] [Storage] › ℹ  info      Using provided prefix for storage 'my-site': 20260101120000
[Azion] [Server] › ✔  success   Function running on port 0.0.0.0:4444, url: http://localhost:4444
[Azion] [Server] › ℹ  info      Initial scan complete. Ready for changes.
```

A request to the root of the site on that port returns status `200`:

```bash
curl -s -o /dev/null -w '%{http_code}' http://localhost:4444/
```

```text
200
```

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `--debug`, `--log-level`, and `--silent`.
- [Azion CLI build](/en/documentation/devtools/cli/build.md): The command that builds the project without starting a server.
- [Azion CLI deploy](/en/documentation/devtools/cli/deploy.md): The command that deploys the project to Azion after you test it locally.
- [Write and test a function](/en/documentation/guides/application-development/functions-and-runtime/first-steps.md): How to write the handler of a function and check its response in Azion Console.
