{"id":16637,"library":"koishi-plugin-dataview","title":"Koishi DataView Plugin","description":"koishi-plugin-dataview is a plugin for the Koishi chatbot framework, providing a web-based console interface to view and interact with various database tables directly within the Koishi Console. It leverages Koishi's existing database connectivity to present data in a structured, browsable format, enhancing debugging and administrative capabilities. The current stable version is 2.7.8. Koishi plugins generally follow the release cadence of the Koishi core framework, with frequent updates to ensure compatibility and introduce new features. Its key differentiator is its seamless integration into the Koishi Console, offering a unified management experience for bot operations and underlying data, which is crucial for complex bot applications needing direct data inspection without external tools, simplifying bot administration and data inspection.","status":"active","version":"2.7.8","language":"javascript","source_language":"en","source_url":"https://github.com/koishijs/koishi-plugin-dataview","tags":["javascript","bot","chatbot","koishi","plugin","database","typescript"],"install":[{"cmd":"npm install koishi-plugin-dataview","lang":"bash","label":"npm"},{"cmd":"yarn add koishi-plugin-dataview","lang":"bash","label":"yarn"},{"cmd":"pnpm add koishi-plugin-dataview","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for providing the Koishi web console interface where DataView operates.","package":"@koishijs/plugin-console","optional":false},{"reason":"Core Koishi framework dependency.","package":"koishi","optional":false}],"imports":[{"note":"The plugin is typically imported as a default export for use with `ctx.plugin()`.","wrong":"const DataViewPlugin = require('koishi-plugin-dataview')","symbol":"DataViewPlugin","correct":"import DataViewPlugin from 'koishi-plugin-dataview'"},{"note":"Import the type for configuration schema if you need to define custom plugin options.","symbol":"DataViewPluginConfig","correct":"import type { Config as DataViewPluginConfig } from 'koishi-plugin-dataview'"},{"note":"Koishi plugins are activated via `ctx.plugin()` rather than direct instantiation.","wrong":"new DataViewPlugin(ctx, options)","symbol":"KoishiContextUse","correct":"ctx.plugin(DataViewPlugin, options)"}],"quickstart":{"code":"import { App, Schema } from 'koishi';\nimport { Console } from '@koishijs/plugin-console';\nimport DataViewPlugin from 'koishi-plugin-dataview';\n\nconst config = {\n  port: 8080,\n  host: 'localhost',\n  logLevel: 'info',\n  database: {\n    // Use 'memory' for a quick demo. For production, configure a real database\n    // like 'mysql', 'sqlite', or 'mongo' to see persistent data.\n    protocol: 'memory'\n  }\n};\n\nconst app = new App(config);\n\n// Koishi Console plugin is a peer dependency and must be loaded.\napp.plugin(Console);\n\n// Load the DataView plugin without specific options for default behavior.\napp.plugin(DataViewPlugin, {\n  // Optional: configure specific tables to display or other plugin settings.\n  // Example: maxRows: 100, // Limit number of rows per table displayed\n});\n\napp.start().then(() => {\n  console.log('Koishi application started successfully.');\n  console.log('Access the Koishi Console at http://localhost:8080/console');\n  console.log('DataView will be available under the \"Data\" tab in the console.');\n}).catch(err => {\n  console.error('Failed to start Koishi application:', err);\n});","lang":"typescript","description":"This quickstart demonstrates how to set up a minimal Koishi application, load the Koishi Console, and then integrate the DataView plugin to inspect database tables via the web interface. It uses an in-memory database for quick demonstration."},"warnings":[{"fix":"Ensure `koishi-plugin-dataview` version is compatible with your `koishi` and `@koishijs/plugin-console` versions. Refer to the plugin's `package.json` for peer dependency ranges.","message":"Major version updates of Koishi or its console plugin often require corresponding updates to koishi-plugin-dataview due to API changes. Always check the changelog when upgrading Koishi core.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Add `app.plugin(Console)` to your Koishi application initialization script before loading `DataViewPlugin` and ensure `@koishijs/plugin-console` is installed.","message":"The DataView plugin requires `@koishijs/plugin-console` to be installed and loaded in your Koishi application. Without the console, the DataView interface will not be accessible.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Configure Koishi with a persistent database protocol (e.g., `mysql`, `sqlite`, `mongo`) in your `App` configuration to view and manage your actual application data effectively.","message":"DataView only displays data from the database configured for Koishi itself. If Koishi is not connected to a database, or is using an ephemeral in-memory database, DataView will show limited or temporary data.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Run `npm install @koishijs/plugin-console` or `yarn add @koishijs/plugin-console`.","cause":"The peer dependency `@koishijs/plugin-console` is not installed.","error":"Error: Cannot find module '@koishijs/plugin-console'"},{"fix":"Upgrade or downgrade your `koishi` package to a compatible version as specified in `koishi-plugin-dataview`'s `package.json` peer dependencies, or update the plugin.","cause":"Koishi core version mismatch with the plugin's peer dependency requirements.","error":"Error: Plugin koishi-plugin-dataview requires version X of koishi, but you have version Y."},{"fix":"Ensure `app.plugin(Console)` is called before `app.plugin(DataViewPlugin)` in your application entry file.","cause":"This error typically indicates that the Koishi Console plugin (`@koishijs/plugin-console`) was not loaded or initialized before `koishi-plugin-dataview`.","error":"TypeError: Cannot read properties of undefined (reading 'registerTab')"}],"ecosystem":"npm"}