# honojs/hono architecture

> Architecture diagram of the GitHub repository honojs/hono, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/honojs/hono
- Repository: https://github.com/honojs/hono
- Video tour (about a minute): https://gitdiagram.com/honojs/hono/video

## Overview

Hono is a lightweight, Web-standards-based web framework. The main workflow is that an application registers routes and middleware, a runtime adapter accepts platform requests, and the framework matches a route and produces a response. Other major capabilities include JSX rendering, a typed RPC client, validation, and middleware. The map includes these documented capabilities, but several of their implementations were not sampled; those links are omitted or marked unverified rather than inferred from names alone.

Main entry points: [`src/hono.ts`](https://github.com/honojs/hono/blob/main/src/hono.ts) (Hono app), [`src/hono-base.ts`](https://github.com/honojs/hono/blob/main/src/hono-base.ts) (App routing API), [`src/jsx/streaming.ts`](https://github.com/honojs/hono/blob/main/src/jsx/streaming.ts) (JSX streaming), [`src/jsx/base.ts`](https://github.com/honojs/hono/blob/main/src/jsx/base.ts) (JSX elements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_framework["Framework core"]
  node_hono["Hono app<br/>[hono.ts]"]
  node_hono_base["App routing API<br/>[hono-base.ts]"]
  node_router["Router interface<br/>[router.ts]"]
  node_regexp_router["RegExp router<br/>[router.ts]"]
  node_smart_router["Smart router<br/>[router.ts]"]
  node_context["Request context<br/>[context.ts]"]
  node_request["Request parsing<br/>[request.ts]"]
end

subgraph group_rendering["JSX rendering"]
  node_jsx_base["JSX elements<br/>[base.ts]"]
  node_jsx_context["JSX context<br/>[context.ts]"]
  node_jsx_stream["JSX streaming<br/>[streaming.ts]"]
  node_jsx_dom_server["DOM server rendering<br/>[server.ts]"]
  node_html_utils["HTML escaping<br/>[html.ts]"]
end

subgraph group_capabilities["Web capabilities"]
  node_middleware["Built-in middleware"]
  node_validator["Input validation<br/>[validator.ts]"]
  node_rpc_client["Typed RPC client<br/>[client.ts]"]
end

subgraph group_platforms["Runtime adapters"]
  node_aws_adapter["AWS Lambda adapter<br/>[handler.ts]"]
  node_workers_adapter["Cloudflare adapters"]
  node_deno_adapter["Deno adapter"]
  node_bun_adapter["Bun adapter"]
  node_other_adapters["Other platform adapters"]
end

node_developer(("Application developer"))

node_developer -->|"configures routes"| node_hono
node_hono -->|"extends"| node_hono_base
node_hono -->|"selects router"| node_smart_router
node_hono -->|"configures router"| node_regexp_router
node_context -->|"constructs request"| node_request
node_jsx_base -->|"escapes markup"| node_html_utils
node_jsx_context -->|"renders children"| node_jsx_base
node_jsx_stream -->|"renders elements"| node_jsx_base
node_jsx_stream -->|"resolves HTML"| node_html_utils
node_jsx_dom_server -->|"streams output"| node_jsx_stream
node_hono_base -.->|"uses routing"| node_router
node_hono_base -.->|"dispatches middleware"| node_middleware
node_hono_base -.->|"creates context"| node_context
node_hono_base -.->|"supports validation"| node_validator
node_hono_base -.->|"exposes typed routes"| node_rpc_client
node_aws_adapter -.->|"dispatches requests"| node_hono
node_workers_adapter -.->|"dispatches requests"| node_hono
node_deno_adapter -.->|"dispatches requests"| node_hono
node_bun_adapter -.->|"dispatches requests"| node_hono
node_other_adapters -.->|"dispatches requests"| node_hono

click node_hono "https://github.com/honojs/hono/blob/main/src/hono.ts"
click node_hono_base "https://github.com/honojs/hono/blob/main/src/hono-base.ts"
click node_router "https://github.com/honojs/hono/blob/main/src/router.ts"
click node_regexp_router "https://github.com/honojs/hono/blob/main/src/router/reg-exp-router/router.ts"
click node_smart_router "https://github.com/honojs/hono/blob/main/src/router/smart-router/router.ts"
click node_context "https://github.com/honojs/hono/blob/main/src/context.ts"
click node_request "https://github.com/honojs/hono/blob/main/src/request.ts"
click node_middleware "https://github.com/honojs/hono/tree/main/src/middleware"
click node_validator "https://github.com/honojs/hono/blob/main/src/validator/validator.ts"
click node_rpc_client "https://github.com/honojs/hono/blob/main/src/client/client.ts"
click node_jsx_base "https://github.com/honojs/hono/blob/main/src/jsx/base.ts"
click node_jsx_context "https://github.com/honojs/hono/blob/main/src/jsx/context.ts"
click node_jsx_stream "https://github.com/honojs/hono/blob/main/src/jsx/streaming.ts"
click node_jsx_dom_server "https://github.com/honojs/hono/blob/main/src/jsx/dom/server.ts"
click node_html_utils "https://github.com/honojs/hono/blob/main/src/utils/html.ts"
click node_aws_adapter "https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts"
click node_workers_adapter "https://github.com/honojs/hono/tree/main/src/adapter/cloudflare-workers"
click node_deno_adapter "https://github.com/honojs/hono/tree/main/src/adapter/deno"
click node_bun_adapter "https://github.com/honojs/hono/tree/main/src/adapter/bun"
click node_other_adapters "https://github.com/honojs/hono/tree/main/src/adapter"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hono,node_hono_base,node_router,node_regexp_router,node_smart_router,node_context,node_request toneBlue
class node_jsx_base,node_jsx_context,node_jsx_stream,node_jsx_dom_server,node_html_utils toneAmber
class node_middleware,node_validator,node_rpc_client toneMint
class node_aws_adapter,node_workers_adapter,node_deno_adapter,node_bun_adapter,node_other_adapters toneRose
class node_developer toneIndigo
```

## Components

### Framework core

- [Hono app](https://github.com/honojs/hono/blob/main/src/hono.ts): `src/hono.ts`
- [App routing API](https://github.com/honojs/hono/blob/main/src/hono-base.ts): `src/hono-base.ts`
- [Router interface](https://github.com/honojs/hono/blob/main/src/router.ts): `src/router.ts`
- [RegExp router](https://github.com/honojs/hono/blob/main/src/router/reg-exp-router/router.ts): `src/router/reg-exp-router/router.ts`
- [Smart router](https://github.com/honojs/hono/blob/main/src/router/smart-router/router.ts): `src/router/smart-router/router.ts`
- [Request context](https://github.com/honojs/hono/blob/main/src/context.ts): `src/context.ts`
- [Request parsing](https://github.com/honojs/hono/blob/main/src/request.ts): `src/request.ts`

### JSX rendering

- [JSX elements](https://github.com/honojs/hono/blob/main/src/jsx/base.ts): `src/jsx/base.ts`
- [JSX context](https://github.com/honojs/hono/blob/main/src/jsx/context.ts): `src/jsx/context.ts`
- [JSX streaming](https://github.com/honojs/hono/blob/main/src/jsx/streaming.ts): `src/jsx/streaming.ts`
- [DOM server rendering](https://github.com/honojs/hono/blob/main/src/jsx/dom/server.ts): `src/jsx/dom/server.ts`
- [HTML escaping](https://github.com/honojs/hono/blob/main/src/utils/html.ts): `src/utils/html.ts`

### Web capabilities

- [Built-in middleware](https://github.com/honojs/hono/tree/main/src/middleware): `src/middleware`
- [Input validation](https://github.com/honojs/hono/blob/main/src/validator/validator.ts): `src/validator/validator.ts`
- [Typed RPC client](https://github.com/honojs/hono/blob/main/src/client/client.ts): `src/client/client.ts`

### Runtime adapters

- [AWS Lambda adapter](https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts): `src/adapter/aws-lambda/handler.ts`
- [Cloudflare adapters](https://github.com/honojs/hono/tree/main/src/adapter/cloudflare-workers): `src/adapter/cloudflare-workers`
- [Deno adapter](https://github.com/honojs/hono/tree/main/src/adapter/deno): `src/adapter/deno`
- [Bun adapter](https://github.com/honojs/hono/tree/main/src/adapter/bun): `src/adapter/bun`
- [Other platform adapters](https://github.com/honojs/hono/tree/main/src/adapter): `src/adapter`

### Other components

- **Application developer**

## Connections

- Application developer → Hono app: configures routes
- Hono app → App routing API: extends (evidence: `src/hono.ts`)
- Hono app → Smart router: selects router (evidence: `src/hono.ts`)
- Hono app → RegExp router: configures router (evidence: `src/hono.ts`)
- Request context → Request parsing: constructs request (evidence: `src/context.ts`)
- JSX elements → HTML escaping: escapes markup (evidence: `src/jsx/base.ts`)
- JSX context → JSX elements: renders children (evidence: `src/jsx/context.ts`)
- JSX streaming → JSX elements: renders elements (evidence: `src/jsx/streaming.ts`)
- JSX streaming → HTML escaping: resolves HTML (evidence: `src/jsx/streaming.ts`)
- DOM server rendering → JSX streaming: streams output (evidence: `src/jsx/dom/server.ts`)
- App routing API → Router interface: uses routing
- App routing API → Built-in middleware: dispatches middleware
- App routing API → Request context: creates context
- App routing API → Input validation: supports validation
- App routing API → Typed RPC client: exposes typed routes
- AWS Lambda adapter → Hono app: dispatches requests (evidence: `src/adapter/aws-lambda/handler.ts`)
- Cloudflare adapters → Hono app: dispatches requests
- Deno adapter → Hono app: dispatches requests
- Bun adapter → Hono app: dispatches requests
- Other platform adapters → Hono app: dispatches requests (evidence: `src/adapter/aws-lambda/handler.ts`)
