Last Updated: 3/11/2026
Deno
Deno is a JavaScript runtime built on V8. Hono works seamlessly on Deno with full TypeScript support.
Install Deno
Install the deno command. See the official guide .
Setup
Create a new Deno project:
deno init --npm hono --template=deno my-app
cd my-appNo explicit installation of Hono is needed—Deno handles imports automatically.
Hello World
Edit main.ts:
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Deno!'))
Deno.serve(app.fetch)Run Locally
Start the development server:
deno task startAccess http://localhost:8000 in your browser.
Change Port
Specify the port in main.ts:
Deno.serve({ port: 8787 }, app.fetch)Serve Static Files
Use serveStatic from hono/deno:
import { Hono } from 'hono'
import { serveStatic } from 'hono/deno'
const app = new Hono()
app.use('/static/*', serveStatic({ root: './' }))
app.use('/favicon.ico', serveStatic({ path: './favicon.ico' }))
app.get('/', (c) => c.text('You can access: /static/hello.txt'))
Deno.serve(app.fetch)Directory structure:
./
├── favicon.ico
├── main.ts
└── static
├── hello.txt
└── images
└── logo.pngOptions
rewriteRequestPath: Map URLs to different paths:
app.get(
'/static/*',
serveStatic({
root: './',
rewriteRequestPath: (path) => path.replace(/^\/static/, '/statics'),
})
)mimes: Add custom MIME types:
app.get(
'/static/*',
serveStatic({
mimes: {
m3u8: 'application/vnd.apple.mpegurl',
ts: 'video/mp2t',
},
})
)precompressed: Serve pre-compressed files (.br, .gz):
app.get(
'/static/*',
serveStatic({
precompressed: true,
})
)Testing
Write tests using Deno.test and @std/assert:
deno add jsr:@std/assertimport { Hono } from 'hono'
import { assertEquals } from '@std/assert'
Deno.test('Hello World', async () => {
const app = new Hono()
app.get('/', (c) => c.text('Please test me'))
const res = await app.request('http://localhost/')
assertEquals(res.status, 200)
})Run tests:
deno test hello.tsnpm and JSR
Hono is available on both npm and JSR . Configure in deno.json:
{
"imports": {
"hono": "jsr:@hono/hono"
}
}Or use npm:
{
"imports": {
"hono": "npm:hono"
}
}For middleware, use directory syntax:
{
"imports": {
"hono/": "npm:/hono/"
}
}Deno Deploy
Deno Deploy is a serverless platform for Deno applications. Hono works seamlessly on Deno Deploy with GitHub integration.