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

graphmysql

v1.0.3

Published

Display MySQL objects in a graph

Readme

graphmysql

Read and Display MySQL objects and their relationship in a force-directed graph.

Demo

MySQL have a sample database called sakila and the demo below is the the result of analyzing the information_schema

Sakila DEMO

Why

There are already tools that can read Entity-Relationship Diagrams and display the cardinality and foreign keys of each objects. The problem with ERD is once the number of tables got higher than 20 or so, displaying such diagram can be hard to read.

graphmysql addresses this problem by only displaying the table names as circles, then the relationship as lines. This gives you a gist of which tables is connected to which in lets say a 100+ tables database. The interactivity it also provides natural way of "weeding" out unrelated tables by dragging away the node from the majority through force-directed graphs.

This tool is useful for the following use-cases:

  • Getting an overview of how each tables is all related in the big picture
  • Change management - if you drop a certain table, which ones will be affected
  • Partial Updating/Resetting of database - if the production data is very huge, grabbing an entire db dump might not be ideal, determining only related tables is more practical.
  • Share with backend developer the relationship of each tables (table names, foreign keys) in order to create Models in (MVC).
  • Non-technical tool to communicate business objects with stakeholders.

Requirements

  • MySQL Server 5.7 or higher
  • NodeJS 18 or higher

Usage

$ npm install -g graphmysql
$ graphmysql COMMAND
running command...
$ graphmysql (--version)
graphmysql/1.0.3 darwin-x64 node-v20.11.0
$ graphmysql --help [COMMAND]
USAGE
  $ graphmysql COMMAND
...

Commands

graphmysql build GRAPH

generate a static html file that allows you to browse graph data

USAGE
  $ graphmysql build GRAPH

ARGUMENTS
  GRAPH  Path to a JSON file that constains the graph data

DESCRIPTION
  generate a static html file that allows you to browse graph data

EXAMPLES
  $ graphmysql build ./graph.json

See code: src/commands/build.ts

graphmysql explore DATABASE HOST PASSWORD USERNAME

Connect to MySQL database and generate a json graph data.

USAGE
  $ graphmysql explore DATABASE HOST PASSWORD USERNAME

ARGUMENTS
  DATABASE  MySQL database
  HOST      MySQL Host
  PASSWORD  MySQL password
  USERNAME  MySQL username

DESCRIPTION
  Connect to MySQL database and generate a json graph data.

EXAMPLES
  $ graphmysql explore your_db 127.0.0.1 yourpassword youruser > graph.json

See code: src/commands/explore/index.ts

graphmysql help [COMMANDS]

Display help for graphmysql.

USAGE
  $ graphmysql help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for graphmysql.

See code: @oclif/plugin-help

graphmysql plugins

List installed plugins.

USAGE
  $ graphmysql plugins [--json] [--core]

FLAGS
  --core  Show core plugins.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List installed plugins.

EXAMPLES
  $ graphmysql plugins

See code: @oclif/plugin-plugins

graphmysql plugins:install PLUGIN...

Installs a plugin into the CLI.

USAGE
  $ graphmysql plugins add plugins:install PLUGIN...

ARGUMENTS
  PLUGIN  Plugin to install.

FLAGS
  -f, --force    Run yarn install with force flag.
  -h, --help     Show CLI help.
  -s, --silent   Silences yarn output.
  -v, --verbose  Show verbose yarn output.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Installs a plugin into the CLI.
  Can be installed from npm or a git url.

  Installation of a user-installed plugin will override a core plugin.

  e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
  will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
  the CLI without the need to patch and update the whole CLI.


ALIASES
  $ graphmysql plugins add

EXAMPLES
  $ graphmysql plugins add myplugin 

  $ graphmysql plugins add https://github.com/someuser/someplugin

  $ graphmysql plugins add someuser/someplugin

graphmysql plugins:inspect PLUGIN...

Displays installation properties of a plugin.

USAGE
  $ graphmysql plugins inspect PLUGIN...

ARGUMENTS
  PLUGIN  [default: .] Plugin to inspect.

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Displays installation properties of a plugin.

EXAMPLES
  $ graphmysql plugins inspect myplugin

See code: @oclif/plugin-plugins

graphmysql plugins:install PLUGIN...

Installs a plugin into the CLI.

USAGE
  $ graphmysql plugins install PLUGIN...

ARGUMENTS
  PLUGIN  Plugin to install.

FLAGS
  -f, --force    Run yarn install with force flag.
  -h, --help     Show CLI help.
  -s, --silent   Silences yarn output.
  -v, --verbose  Show verbose yarn output.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Installs a plugin into the CLI.
  Can be installed from npm or a git url.

  Installation of a user-installed plugin will override a core plugin.

  e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
  will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
  the CLI without the need to patch and update the whole CLI.


ALIASES
  $ graphmysql plugins add

EXAMPLES
  $ graphmysql plugins install myplugin 

  $ graphmysql plugins install https://github.com/someuser/someplugin

  $ graphmysql plugins install someuser/someplugin

See code: @oclif/plugin-plugins

graphmysql plugins:link PLUGIN

Links a plugin into the CLI for development.

USAGE
  $ graphmysql plugins link PLUGIN

ARGUMENTS
  PATH  [default: .] path to plugin

FLAGS
  -h, --help          Show CLI help.
  -v, --verbose
      --[no-]install  Install dependencies after linking the plugin.

DESCRIPTION
  Links a plugin into the CLI for development.
  Installation of a linked plugin will override a user-installed or core plugin.

  e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
  command will override the user-installed or core plugin implementation. This is useful for development work.


EXAMPLES
  $ graphmysql plugins link myplugin

See code: @oclif/plugin-plugins

graphmysql plugins:uninstall PLUGIN...

Removes a plugin from the CLI.

USAGE
  $ graphmysql plugins remove plugins:uninstall PLUGIN...

ARGUMENTS
  PLUGIN  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ graphmysql plugins unlink
  $ graphmysql plugins remove

EXAMPLES
  $ graphmysql plugins remove myplugin

graphmysql plugins reset

Remove all user-installed and linked plugins.

USAGE
  $ graphmysql plugins reset [--hard] [--reinstall]

FLAGS
  --hard       Delete node_modules and package manager related files in addition to uninstalling plugins.
  --reinstall  Reinstall all plugins after uninstalling.

See code: @oclif/plugin-plugins

graphmysql plugins:uninstall PLUGIN...

Removes a plugin from the CLI.

USAGE
  $ graphmysql plugins uninstall PLUGIN...

ARGUMENTS
  PLUGIN  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ graphmysql plugins unlink
  $ graphmysql plugins remove

EXAMPLES
  $ graphmysql plugins uninstall myplugin

See code: @oclif/plugin-plugins

graphmysql plugins:uninstall PLUGIN...

Removes a plugin from the CLI.

USAGE
  $ graphmysql plugins unlink plugins:uninstall PLUGIN...

ARGUMENTS
  PLUGIN  plugin to uninstall

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Removes a plugin from the CLI.

ALIASES
  $ graphmysql plugins unlink
  $ graphmysql plugins remove

EXAMPLES
  $ graphmysql plugins unlink myplugin

graphmysql plugins update

Update installed plugins.

USAGE
  $ graphmysql plugins update [-h] [-v]

FLAGS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Update installed plugins.

See code: @oclif/plugin-plugins

graphmysql serve GRAPH PORT

Render Graph data to a simple HTTP Server.

USAGE
  $ graphmysql serve GRAPH PORT

ARGUMENTS
  GRAPH  Path to a JSON file that constains the graph data
  PORT   which port to serve the http server

DESCRIPTION
  Render Graph data to a simple HTTP Server.

EXAMPLES
  $ graphmysql serve ./graph.json 8086

See code: src/commands/serve/index.ts

Sample database

We use https://github.com/sakiladb/mysql for testing purposes.

docker run -d -p 3306:3306 --name mysql-sakila sakiladb/mysql:5.7

dev

npm run build
./bin/run.js explore sakila 127.0.0.1 'p_ssW0rd' sakila > graph.json
./bin/run.js serve ./graph.json 8086
./bin/run.js build ./graph.json > graph.html

deploy

if non-npm

npx oclif pack tarballs

via npm

npm version (major|minor|patch) # bumps version, updates README, adds git tag
npm publish