Run your Express app on Hono. A migration-first Express compatibility layer for Node.js, Cloudflare Workers, Deno and Bun.
ExpHono re-implements the Express API on top of Hono, so an existing Express app can run unmodified on runtimes Express itself cannot reach — Cloudflare Workers, Deno and Bun — while still working on Node.js. The goal is migration, not a rewrite: keep writing app.get(...), req.query, res.json(...) and the middleware you already have.
npm install exphonoThe default export behaves like express(), and app is still a callable function so app.use('/sub', subApp) and http.createServer(app) keep working on Node.js.
import express from 'exphono'
const app = express()
app.get('/', (req, res) => {
res.json({ hello: 'world' })
})
app.listen(3000)On Cloudflare Workers, Deno and Bun, deploy the app with app.worker instead of the app itself. A function default export is misread as a Durable Object class on Workers, so the export has to be a plain object:
import express from 'exphono'
const app = express()
app.get('/', (req, res) => {
res.json({ hello: 'world' })
})
export default app.workerExpress 4 and 5 differ in a few places — the query parser, whether req.host strips the port, and which deprecated APIs still exist. exphono follows Express 5 semantics by default; import exphono/v4 or exphono/v5 to pin one explicitly, independent of whichever module loaded first:
import express from 'exphono/v4'Anything ExpHono degrades or cannot reproduce on the current runtime is surfaced with a stable EXPHONO_E0xx code rather than failing silently. By default each code warns once and execution continues; enable strict mode to throw instead:
import { configure } from 'exphono'
configure({ strict: true })See docs/errors.md for what each code means and how to resolve it.
ExpHono is verified against the real Express test suite, not just its own tests -- and enforced in CI, not just locally. As of the last recorded run, it passes 1113 of 1116 Express 5 tests (about 100%) and 1179 of 1198 Express 4 tests (about 98%, exphono/v4); the failure count for each is tracked as a ratchet so it can only improve. See test/express-suite/ for how the suite is run.
Some gaps are structural rather than missing work — anything that needs a real filesystem or a TCP listener (app.listen(), res.sendFile, on-disk view lookups) has no equivalent on Cloudflare Workers, and ExpHono reports that with a diagnostic code instead of pretending to support it.
- Node.js >= 20 (Node.js is not required on Bun, Deno or Workers deployments)
Contributions are welcome! See CONTRIBUTING.md for details.
Distributed under the MIT License.