---
name: azion-build-with-hono
description: >-
  Create a Hono project with the Azion CLI, run it locally, and deploy it to an Azion domain.
---

# Build with Hono

Use the [Azion CLI](/en/documentation/devtools/cli/) to create a Hono project from a template, run it on your computer, and deploy it. When the deploy ends, the project runs on Azion and answers on an Azion domain.

Azion runs a Hono project as a [function](/en/documentation/platform/functions/). The `azion init` picker offers Hono as a starting point, and the project builds with the `typescript` preset. The deploy creates a function, a function instance, and a rule that runs the function on every request. It creates no storage bucket. For the other frameworks that Azion builds, refer to [Frameworks compatibility](/en/documentation/devtools/runtime/frameworks/frameworks-compatibility/).

---

## Prerequisites

- An Azion account. To create one, refer to [Create an account](/en/documentation/fundamentals/creating-account/).
- The Azion CLI, installed and logged in. For the setup, refer to [Azion CLI quickstart](/en/documentation/devtools/cli/quickstart/).
- Node.js 18 or later, with npm.
- A terminal and a code editor.

---

## Deploy the project

The CLI creates the project, builds it, runs it locally, and creates the resources that serve it on Azion.

To create the project, run `azion init` with a name:

```bash
azion init --name my-app
```

The command asks its questions in order. Give these answers:

1. At `Choose a preset:`, select *Hono*. You can type `Hono` to filter the list.
2. At `Choose a template:`, select *Hono Boilerplate*. This guide uses that template.
3. At `Do you want to install project dependencies?`, answer `Y`.
4. At `Do you want to start a local development server?`, answer `n`.
5. At `Do you want to deploy your project?`, answer `n`.

For every question and the flags that skip them, refer to [Azion CLI init](/en/documentation/devtools/cli/init/). The command prints this output:

```text
? Choose a preset: Hono  [Use arrows to move, type to filter]
> Hono
? Choose a preset: Hono
? Choose a template:  [Use arrows to move, type to filter]
  Azion React Agent
> Hono Boilerplate
? Choose a template: Hono Boilerplate

Fetching selected template...

Template successfully fetched
Template successfully configured
🤔 Do you want to install project dependencies? This may be required to generate initial configuration file (Y/n) Y
Installing application dependencies

added 2 packages, and audited 3 packages in 1s

found 0 vulnerabilities
…
[Azion] [Build] › ℹ  info      Using preset: typescript
[Azion] [Build] › ✔  success   Build completed successfully with only azion.config
[Azion] [IaC] › ✔  success   Manifest generated successfully at <project-dir>/my-app/.edge/manifest.json
🤔 Do you want to start a local development server? (y/N) n
If you want to start a local development server later, run 'azion dev'
Make sure to change to the new working directory before running building or deploying your project
🤔 Do you want to deploy your project? (y/N) n
If you want to deploy your application later, run 'azion deploy'
Make sure to change to the new working directory before running building or deploying your project
Your application my-app was initialized successfully
```

The project is in the `my-app` folder. Its `azion.config.ts` file sets the `typescript` preset and `src/index.ts` as the entry. For every setting in that file, refer to [azion.config.js](/en/documentation/devtools/cli/azion-config-js/). The entry holds the Hono app:

```typescript
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) => c.text('Hello Hono Azion!'))

app.fire()
```

The template's `package.json` has no `dev` or `build` script. Use `azion dev` and `azion build` instead.

To build the project, go to the project folder and run `azion build`:

```bash
cd my-app
azion build
```

Azion Bundler builds the entry with the `typescript` preset and writes one function file to `.edge/functions/index.js`. The build prints a warning about the handler pattern and completes:

```text
Building your Application. This process may take a few minutes
Running build step command:

$ npx --yes  @aziontech/bundler@1.1.4 build --preset typescript
…
[Azion] [Build] › ℹ  info      Using preset: typescript
[Azion] [Pre-Build] › ℹ  info      Starting pre-build...
[Azion] [Pre-Build] › ℹ  info      Pre-build completed successfully
[Azion] [Build] › ℹ  info      Using entry point(s): src/index.ts
[Azion] [Build] › ⚠  warning   Unsupported handler pattern detected. Generating Service Worker wrapper as fallback.
[Azion] [Build] › ℹ  info      Consider updating your handler to use ES Modules pattern.
[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] [IaC] › ✔  success   Manifest generated successfully at <project-dir>/my-app/.edge/manifest.json
Your Application was built successfully
```

To run the project on your computer, run `azion dev` from the project folder:

```bash
azion dev
```

The command builds the project again and serves the function on port `3333`:

```text
…
[Azion] [Build] › ℹ  info      Using preset: typescript
[Azion] [Pre-Build] › ℹ  info      Starting pre-build...
[Azion] [Pre-Build] › ℹ  info      Pre-build completed successfully
[Azion] [Build] › ℹ  info      Using entry point(s): src/index.ts
[Azion] [Build] › ⚠  warning   Unsupported handler pattern detected. Generating Service Worker wrapper as fallback.
[Azion] [Build] › ℹ  info      Consider updating your handler to use ES Modules pattern.
[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.
```

In a second terminal, request the local server:

```bash
curl -i http://localhost:3333/
```

The function returns the text of the Hono route:

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

Hello Hono Azion!
```

The server keeps running until you stop it. For the flags of the command, refer to [Azion CLI dev](/en/documentation/devtools/cli/dev-command/).

To deploy the project, run `azion deploy` from the project folder:

```bash
azion deploy
```

The CLI uploads the project and opens a Console page where you can follow the deploy. If the browser does not open, use the URL of that page, which the CLI also prints. At the end, the CLI prints the URL of the project's domain:

```text
Running deploy command
Uploading source files

Upload completed successfully!
Please visit https://console.azion.com/create/deploy/00000000-0000-0000-0000-000000000001 in case it did not open automatically, to follow up the full deploy process
Your Application was deployed successfully

To visualize your application access the Domain: https://xxxxxxxxxx.map.azionedge.net
Your application is being deployed to all Azion Locations and it might take a few minutes.
```

The deploy creates a function and a function instance. It also creates an [application](/en/documentation/platform/applications/) with a rule named `Execute Function`, which runs the function on every request, and a workload that serves the application on the domain. The output does not list them; `azion/azion.json` in the project folder records their IDs. For the flags of the command, refer to [Azion CLI deploy](/en/documentation/devtools/cli/deploy/).

---

## Check the project

At the end of the deploy, `azion deploy` prints the URL of the project's Azion domain, in the form `https://xxxxxxxxxx.map.azionedge.net`. Request that URL, with your domain in place of `<your-domain>`:

```bash
curl -i https://<your-domain>/
```

After the deploy reaches the location that answers your request, the function returns the Hono route:

```text
HTTP/2 200
date: Thu, 01 Jan 2026 12:15:00 GMT
content-type: text/plain;charset=UTF-8
x-azion-request-id: 0123456789abcdef0123456789abcdef
alt-svc: h3=":443"; ma=86400

Hello Hono Azion!
```

The first deploy can take several minutes to answer from every location. Until a location receives the project, the domain answers with a `404` page that reads `There's nothing here yet`, and that page can return for a while after the first successful response. If you get that page, wait and request the URL again.

The function answers every path. A path that the Hono app does not define returns the plain-text `404 Not Found` of Hono, not the `There's nothing here yet` page.

---

## Next steps

- [Frameworks compatibility](/en/documentation/devtools/runtime/frameworks/frameworks-compatibility.md): See the frameworks and presets that Azion builds.
- [Azion CLI deploy](/en/documentation/devtools/cli/deploy.md): Read the deploy output and the flags that change a deploy.
- [Functions](/en/documentation/platform/functions.md): Learn how the function that runs the Hono project works.
- [azion.config.js](/en/documentation/devtools/cli/azion-config-js.md): Change the function, rules, and workload of the Hono project.
