hono-cluster is a lightweight module for running Hono applications with optional clustering support. It allows you to efficiently utilize multiple CPU cores by spawning worker processes.
npm install hono-cluster
// -- server.ts
import { serve } from 'hono-cluster';
import { App } from './app';
serve(
{
fetch: App.fetch,
port: 3000,
workers: true, // Use all available CPU cores
},
(_server, info) => {
console.log(`Listening on http://${info.address}:${info.port}`);
}
);
import { Hono } from 'hono';
import { serveStatic } from 'hono-cluster';
const App = new Hono();
App.use('*', serveStatic({ root: './public' }));
// ...
For all configuration options, please see the API docs.
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub
Thanks again for your support, it is much appreciated! 🙏
MIT © Shahrad Elahi and contributors.