Quick Start
Create a new Hono project for Deno:Installation
No installation needed! Import Hono directly from a CDN:Basic Usage
Create your application inmain.ts:
main.ts
Deno’s
Deno.serve() expects a fetch function. Pass app.fetch directly.Running Your App
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:
- Go to Deno Deploy
- Click “New Project”
- Connect your GitHub repository
- Select the entry file (e.g.,
main.ts) - Deploy
Using Deno KV
Integrate with Deno’s built-in key-value database:Environment Variables
Access environment variables:.env file with a library like dotenv.
Configuration
Create adeno.json configuration file:
deno.json
Using JSX
Hono’s JSX works great with Deno:Best Practices
Use import maps
Use import maps
Define imports in
deno.json for cleaner import statements.Lock dependencies
Lock dependencies
Use
deno.lock to lock dependency versions for reproducible builds.Minimize permissions
Minimize permissions
Only grant the permissions your app needs (e.g.,
--allow-net, --allow-read).Leverage Deno KV
Leverage Deno KV
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
Resources
Deno Manual
Official Deno documentation
Deno Deploy
Deploy to the edge with Deno Deploy