Skip to content

TypeScript · ESM · Plugin Runtime

Zhin.js

A multi-channel IM framework built for assistant bots. Plugins are Lego blocks, hot reload is the norm, and Console lives in your browser.

IM core <10MBNode ≥20.19MIT
zsh
$ npm create zhin-app my-bot
$ cd my-bot && pnpm dev
✔ IM golden path started — no model key required

Why Zhin.js

01

Plugin-based Core

A package.json#zhin manifest plus a plugin.ts is all you need. Commands, components, and adapters are discovered from convention directories. Edit a file, get instant hot reload.

02

Multi-platform, One Message Flow

QQ, OneBot, Discord, Telegram, Slack, KOOK, DingTalk, Lark, WeCom, LINE… 20+ adapters mount on demand, all sharing the same send chain.

03

Zero-deploy Console

Host exposes only API. Open your browser to manage plugins, view instances, browse logs, and edit config — the frontend does not need to run alongside the bot.

04

Opt-in AI

Only the IM core ships by default. Install @zhin.js/agent when you need it — providers, MCP, sub-agents, and scheduled tasks unlock layer by layer.

05

Plugin as Application

Drop a zhin.config.yml in a plugin directory and zhin runtime start runs it directly. No host project required.

06

Unidirectional Layers

basic → kernel → ai → core → agent → zhin. Dependencies only flow downward. Each layer is usable standalone — kernel is a pure plugin engine, ai is a pure LLM engine.

One file, one bot

bot.ts — your entire bot can be just this one file.

ts
import { defineCommand } from 'zhin.js/command';
import { definePlugin } from 'zhin.js/plugin-runtime';

export default definePlugin({
  name: 'my-bot',
  setup({ addCommand }) {
    addCommand('hello', defineCommand({
      description: 'Say hello',
      execute: () => 'Hello from Zhin!',
    }));
  },
});

Three steps to get running (no model key needed):

bash
npm create zhin-app my-bot -y
cd my-bot && pnpm dev

Open console.zhin.dev → Sandbox → /hello.

Want convention directories instead? Default-export the same defineCommand(...) from commands/hello.ts — see minimal-bot.

Full single-file example: single-file-bot. Database, cron, proactive push, Agent? Check out definePlugin overview for what setup can do.