Skip to content

Repository files navigation

Honolus

npm version license

Honolus is a type-safe Sonolus server framework built on Hono. It provides typed routes, pluggable databases, search and cursor pagination, Pack import, asset delivery, durable jobs, authentication, and production observability.

Requirements

  • Node.js 20 or later
  • TypeScript is recommended

Installation

npm install @untitledsekai/honolus

Quick start

import { Honolus, createSonolusDatabase } from '@untitledsekai/honolus'

export const database = createSonolusDatabase({ driver: 'memory' })

export const sonolus = new Honolus({
    database,
    version: '1.1.3',
})

export default sonolus.getApp()

Pass the returned Hono application to the runtime adapter used by your project. With a database configured, Honolus registers the standard item info, list, and detail routes automatically.

For production, use a shared PostgreSQL database and shared session/rate-limit stores instead of Memory or JSON storage.

import { Pool } from 'pg'
import { PostgresExecutor, createSonolusDatabase } from '@untitledsekai/honolus'

const pool = new Pool({ connectionString: process.env.DATABASE_URL })
const executor = new PostgresExecutor({ pool, statementTimeoutMs: 5_000 })

export const database = createSonolusDatabase({
    driver: 'sql',
    executor,
    cursorSecret: process.env.CURSOR_SECRET,
    autoMigrate: false,
})

The PostgreSQL driver itself is intentionally not bundled. Install the pg version selected by your application.

CLI

honolus generate project ./my-server
honolus generate route levels ./my-server
honolus routes --module ./dist/app.js
honolus openapi --module ./dist/app.js --output openapi.json
honolus db migrate --module ./dist/app.js

Documentation

The full VitePress documentation is maintained in docs-site. Design notes and compatibility information are available in docs.

Example

A runnable Node.js project is available in example.

cd example
npm install
npm run dev

Development

npm install
npm run check
npm run docs:dev

License

ISC

About

A type-safe Sonolus server framework built on Hono

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages