npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

plugin-database-plus-manager

v1.3.0

Published

Advanced multi-datasource database tooling, streaming log console, slow SQL monitor, audit diff trail, request tracing, external storage backup/offload, alerting, and AI diagnostics.

Readme

plugin-database-plus-manager

Database Plus Manager is a NocoBase 2.x plugin that unifies multi-datasource database tooling and real-time Logs & Audit observability under a single shared DataSource selector.

  • Supports NocoBase Main (PostgreSQL, MySQL, MariaDB, SQLite), External SQL (PostgreSQL, MySQL, MariaDB, MSSQL), and External Non-SQL (e.g. Elasticsearch) data sources connected through dataSourceManager.
  • Zero Schema Pollution on external databases: All 7 observability/audit tables (dpmLogConfigs, dpmAuditLogs, dpmSlowQueries, dpmAlertRules, dpmAlertLogs, dpmAiRecords, dpmLogBackups) live strictly in NocoBase's main database with a dataSourceKey discriminator; external databases are never modified.
  • External Storage Backup & Offload: Integrates directly with NocoBase File Storage Management (@nocobase/plugin-file-manager — storages collection, supporting local, AWS s3 / MinIO / Cloudflare R2, ali-oss, tx-cos, s3-private, and sftp-private) to compress, archive, and offload rotated log files (.log.gz) and Audit/Slow-SQL records (.jsonl.gz) off local disk/DB while keeping online streaming preview and 1-click DB restore available.
  • Dual-runtime client support (client v1 and client-v2) with full localization (en-US, vi-VN, zh-CN).

Feature Summary

1. Shared Multi-DataSource Header

  • Single top-level Data source selector automatically discovers all active data sources from dataSourceManager with capability flags (supportsSql, supportsIndexes, supportsKeyset, supportsAggregate).
  • Workspace switcher toggles between Database Tools and Logs & Audit.
  • In Logs & Audit mode, an All data sources option aggregates metrics, files, slow queries, audit records, and traces across every connected data source.

2. Database Tools (5 Tabs)

| Tab | Capabilities | | --- | --- | | Pagination | Configure global default pagination mode (offset, keyset, cursor), defaultLimit, and per-source/collection overrides (${dataSource}:${collection}). Includes a Cursor / Keyset Playground supporting custom primary keys and NULL-safe ordering. | | Statistics | Inspect collections, physical tables/views, row counts, estimated sizes, schemas, primary keys, and field/column metadata across SQL and Non-SQL data sources, with an Include system collections toggle. | | Indexes | List, create (single/composite, ASC/DESC, UNIQUE), and drop SQL indexes on main and external SQL data sources with custom schema support. Displays a clear capability notice for Non-SQL sources. | | SQL Console | Read-only SQL console (SELECT / WITH only) with write/DDL blocking, dialect-aware row limiting (including MSSQL ORDER BY + OFFSET ... FETCH NEXT), tabular result viewer, and truncation metadata. | | Aggregate | Visual aggregate query builder (COUNT, SUM, AVG, MIN, MAX) with multi-dimension grouping, sorting, and collection/field/row-level ACL enforcement. |

3. Logs & Audit (8 Tabs + AI Diagnostics Drawer)

| Tab / Surface | Capabilities | | --- | --- | | Overview | Daily KPIs (audits, errors, slow queries, alerts, log file count & disk usage), 7-day operation/error trend chart, Top Slow Queries, Top Active Users, and Top Modified Collections. | | Log Console | Browse NocoBase system/request/SQL logs alongside per-DataSource daily rotating logs (storage/logs/<app>/datasources/<safeKey>/sql_YYYY-MM-DD.log, operations_YYYY-MM-DD.log). Includes byte-offset Live Tail, level/keyword/ReDoS-safe Regex search, Natural-Language filter (EN/VI), truncate/delete, and .tar.gz archive download. | | Slow Queries | Captures slow SQL queries on main, external SequelizeDataSource connections, and slow Non-SQL repository operations with normalized SQL fingerprints and reqId correlation. Provides 1-click jump directly to Database Tools -> SQL Console (pre-filled SQL + target DataSource), Indexes, or AI Diagnose. | | Audit & Diff | Captures write operations (create, update, destroy, batch*, and sensitive plugin admin actions) with Visual Field Diff (old vs new), automatic sensitive-field masking (password, secret, token, apiKey, etc.), zero-diff skip, multi-field filtering, and formula-injection-safe CSV (UTF-8 BOM) / JSON export. | | Request Trace | Reconstructs full request Lifecycle Waterfalls by X-Request-Id (reqId), correlating HTTP inbound/outbound, Audit records, Slow SQL entries, and matching log file lines. | | Alerts | Rule-based anomaly alerting for error_log, status_5xx, slow_sql, and keyword events with per-DataSource scoping, silence windows (silenceMinutes), and delivery history. Supports NocoBase Notification Manager, NocoBase Workflow, Slack, Teams, Telegram, WeCom, DingTalk, Feishu, and Custom Webhooks with SSRF protection (blocking private/loopback/metadata IPs). | | External Storage | Integrates with NocoBase File Storage Management (storages: S3, MinIO, Cloudflare R2, OSS, COS, s3-private, sftp-private, local) across 3 modes (local_only, backup_copy, offload_external) with global or per-DataSource overrides. Includes live connection probe, SHA-256 verified .log.gz / .jsonl.gz archiving, immediate local file/DB purge on offload, online remote .gz stream preview (with search + AI Diagnose), .gz download, and 1-click DB restore into dpmAuditLogs / dpmSlowQueries. | | Config & Retention | Hot-reload runtime settings (log level, SQL logging, slow query threshold, audit collection/action filters) with per-DataSource overrides synced across HA nodes via Redis PubSub (syncMessageManager). Includes disk/DB storage stats, HA-locked scheduled sync & cleanup (app.lockManager), and batched cleanup protecting .audit.json. | | AI Diagnostics & SQL Advisor | Diagnoses errors and slow queries using NocoBase AI Employees / LLM services or the Built-in Rule Engine fallback. Sanitizes PII/tokens before dispatch, automatically attaches target table schema & existing indexes, renders formatted Markdown reports, and persists diagnosis history. |


Quick Start Guide

1. Install & Enable

  1. Install or copy plugin-database-plus-manager into NocoBase's plugin storage directory (or install from npm).
  2. Enable Database Plus Manager in Plugin Manager (Settings -> Plugin manager).
  3. When upgrading from 1.1.x/1.2.x to 1.3.x, NocoBase automatically syncs the 7 dpm* tables on main (yarn nocobase upgrade or container startup --quickstart).

2. Configure Permissions (ACL)

  • pm.plugin-database-plus-manager: Full admin access to the Database Plus Manager settings page, SQL/Index/Aggregate tools, and all Logs & Audit endpoints.
  • pm.plugin-database-plus-manager.cursor (and default loggedIn allowance on databasePlusManager:cursor): Allows authenticated users to invoke cursor/keyset pagination without exposing admin SQL/index/log endpoints.

3. Using Database Tools & External DataSources

  1. Open Settings -> Database Plus Manager (/v/admin/settings/database-plus-manager).
  2. Select a data source from the top Data source dropdown (for example Main (postgres), an external PostgreSQL/MySQL/MSSQL connection, or an Elasticsearch data source).
  3. Use Pagination, Statistics, Indexes, SQL Console, or Aggregate against the selected source.
    • Non-SQL data sources automatically disable raw SQL and index DDL with an informational notice while keeping Statistics and Logs & Audit available.

4. Using Logs & Audit

  1. Switch the top-right segmented toggle to Logs & Audit.
  2. Choose either All data sources for global visibility or a specific data source to isolate its KPIs, log files, slow queries, and audit trail.
  3. Investigate a Slow Query:
    • Open Slow Queries and inspect high-latency entries.
    • Click SQL Console to jump straight into read-only SQL Console with the data source and query pre-filled, click Indexes to inspect/add missing indexes on the target table, or click AI Diagnose to analyze the query with schema & index context.
  4. Tune Runtime Logging Without Restart:
    • Open Config & Retention, select either Global (All data sources) or a specific DataSource to create scoped overrides (for example lowering slow_query_threshold_ms temporarily on one external database), and click Apply & Save.
    • In multi-node HA clusters, config updates automatically broadcast to peer nodes via syncMessageManager.
  5. Configure External Storage Backup & Offload:
    • Prerequisite: Configure any desired storage engine in NocoBase File Manager (Settings -> File manager -> Storages, e.g., AWS S3, MinIO, Cloudflare R2, Aliyun OSS, Tencent COS, s3-private, sftp-private, or a secondary path).
    • Open Logs & Audit -> External Storage (select All data sources for global policy or a specific DataSource for scoped overrides).
    • Choose a Storage Mode:
      • local_only (default): Keep log files and DB audit/slow-SQL rows locally only.
      • backup_copy: Compress rotated log files (.log.gz) and dpmAuditLogs / dpmSlowQueries batches (.jsonl.gz) to external storage with SHA-256 verification while keeping local copies until retention_days.
      • offload_external: Upload compressed .gz archives to external storage, verify SHA-256, record index metadata in dpmLogBackups, and immediately purge/truncate local log files and DB rows older than offload_local_hot_hours to keep local disk & DB lean.
    • Click Test Storage Connection to verify live upload/read/delete permissions, Save Policy to persist, and Sync / Offload Now (or Force Include Today & Hot Window) to trigger immediate archiving.
    • From the External Log & Audit Archives table below, click Preview to stream and search lines directly from remote .gz files (with AI Diagnose support), Download to fetch the .gz file, or Restore to DB on .jsonl.gz archives to re-hydrate dpmAuditLogs / dpmSlowQueries for SQL/UI filtering.

API Endpoints (databasePlusManager)

  • Database Tools: getSettings, saveSettings, cursor, statistics, listIndexes, addIndex, removeIndex, runSql, aggregate
  • Logs & Files: logsDashboard, logsFiles, logsReadLines, logsTail, logsClearFile, logsDeleteFile, logsDownload
  • Slow SQL, Audit & Trace: logsSlowQueries, logsAuditList, logsAuditExport, logsRecentTraces, logsTrace, logsNlFilter
  • External Storage & Offload: logsStorageOptions, logsTestStorage, logsSyncExternalStorage, logsListBackups, logsPreviewBackup, logsDownloadBackup, logsDeleteBackup, logsRestoreBackup
  • Runtime Config & Retention: logsGetConfigs, logsUpdateConfigs, logsResetConfigs, logsStorageStats, logsClean, logsCleanCount, logsCleanBatch
  • Alerts & AI Diagnostics: logsListAlertRules, logsSaveAlertRule, logsDeleteAlertRule, logsTestAlert, logsListAlertLogs, logsAiMeta, logsAiAnalyze, logsAiHistory, logsDeleteAiRecord

Development, Testing & Packaging

Run from the repository root (PowerShell on Windows):

# Client unit/component tests
yarn test packages/plugins/plugin-database-plus-manager/src/client-v2/__tests__/logs-workspace.test.tsx --run
yarn test packages/plugins/plugin-database-plus-manager/src/client-v2/__tests__/panes.test.tsx --run

# Server unit & integration tests (run sequentially)
yarn test packages/plugins/plugin-database-plus-manager/src/server/__tests__/external-datasource-and-logs-unit.test.ts
yarn test packages/plugins/plugin-database-plus-manager/src/server/__tests__/logs-integration.test.ts
yarn test packages/plugins/plugin-database-plus-manager/src/server/__tests__/actions-integration.test.ts

# Lint, build, and pack
yarn eslint --fix "packages/plugins/plugin-database-plus-manager/src"
yarn nocobase build plugin-database-plus-manager --no-dts
Set-Location "packages/plugins/plugin-database-plus-manager"; npm pack

License

Apache-2.0