gremlin-console is a frontend library that generates a console to query gremlin-server (or gremlin-server enabled graph databases like Titan). It is compatible with Apache TinkerPop3. It can be extended via plugins to support visualization and output format (amongst other things)
This is the gremlin-console library used for www.gremlinbin.com. gremlin-console can :
npm install gremlin-console
;//create a console + input combo by passing css selectors to GremlinConsoleconst gc = ;
<!-- ... -->
//create a console + input combo by passing css selectors to GremlinConsolevar gc = GremlinConsole;
The available options are :
host: The host gremlin-server can be reached on (defaults to
port: The port to connect to gremlin-server on (defaults to
--WARNING-- Due to the nature of gremlin-console being executed locally in the browser and communicating directly with gremlin-server, there are some security implications. If you can't trust your users or are using
gremlin-console-js outside of the scope of a secure network (ie : public network) you will need to enable sandboxing (amongst other things) on gremlin-server. This configuration is required to ensure that people running queries in the console don't get access to secure server side information.
Another option (though not a replacement to sandboxing) is to use
gc-ajax-plugin which will allow you not to expose the gremlin-server websocket. This has more overhead but it will provid the added benefit that you can handle Authentication and Authorization on your server app level. (see plugin section)
You can prepare the state of the graph as well as the queries and results display in the console upon initializing by providing a history object in the options:
// Start an instance of gremlin-consolevar gc = ;// Provide a history array to populate the graph// In this case we create a modern graph "graph", with a traversal object "g".gc;
What happens under the hood : gremlin-console will concatenate the n-1 queries from the provided history and submit them to the server. Essentially setting the graph's state. Then it will rerun the last query so as to trigger the proper events.
You can register lambdas against events as follows :
const gc = ;gc;
There are currently only two supported events :
err: An object with an
The following plugins are currently available for
gc-graphson-text-plugin: Modifies the output display. Makes the console show the results in the same way the Apache TinkerPop terminal console displays it's results.
gremlin-consolerun it's queries against an
httpweb page instead of directly against the gremlin-server's
websocket. This can help provide more control over Authentication and Authorization of users on your website.
gc-cytoscape-plugin: highly experimental A graph visualization tool for
gremlin-console. This is only useful for very small data sets.
If you're interested in developping plugins check the plugin documentation.
You can find the API here.
npm run buildand find file
npm run build:umdand find file
npm run build:minand find file
npm run testwill run mocha coverage (firefox required)
npm run build:docswill generate an