Skip to main content
Deno is a modern, secure runtime for JavaScript and TypeScript. Hono works seamlessly with Deno with full TypeScript support out of the box.

Quick Start

Create a new Hono project for Deno:
Select “deno” as your template when prompted.

Installation

No installation needed! Import Hono directly from a CDN:
Or use npm specifiers:

Basic Usage

Create your application in main.ts:
main.ts
Deno’s Deno.serve() expects a fetch function. Pass app.fetch directly.

Running Your App

Or with custom port:
main.ts

Adapter Features

The Deno adapter provides several utilities:

Static Files

Serve static files from a directory:

WebSocket Support

Upgrade HTTP connections to WebSocket:

Connection Info

Get connection information including IP address:

Static Site Generation (SSG)

Generate static files from your Hono app:

Deno Deploy

Deploy your Hono app to Deno Deploy’s edge network.
1

Create your app

Create a Hono application:
main.ts
2

Deploy with deployctl

Install and use deployctl:
3

Deploy via Git

Alternatively, connect your Git repository:
  1. Go to Deno Deploy
  2. Click “New Project”
  3. Connect your GitHub repository
  4. Select the entry file (e.g., main.ts)
  5. Deploy

Using Deno KV

Integrate with Deno’s built-in key-value database:

Environment Variables

Access environment variables:
Run with environment variables:
Or use a .env file with a library like dotenv.

Configuration

Create a deno.json configuration file:
deno.json
Run tasks:

Using JSX

Hono’s JSX works great with Deno:

Best Practices

Define imports in deno.json for cleaner import statements.
Use deno.lock to lock dependency versions for reproducible builds.
Only grant the permissions your app needs (e.g., --allow-net, --allow-read).
Use Deno KV for built-in, distributed key-value storage.

Development Features

Watch Mode

Auto-reload on file changes:

Type Checking

Deno type-checks TypeScript by default. Skip checking for faster startup:

Testing

Write tests using Deno’s built-in test runner:
main.test.ts
Run tests:

Resources

Deno Manual

Official Deno documentation

Deno Deploy

Deploy to the edge with Deno Deploy