Posted by & filed under Node.js.

The NodeJS Console Object Debug Inspector, or simply node-codein, is a tool for providing a visual debugger of global node variables, as well as executing code inside of your running process. Think of it as a GUI REPL for a running node process.

This GUI is run in a browser (it works best with Chrome, maybe only with Chrome). It provides expandable and collapsable nodes when dealing with hierarchal data, has syntax highlighting depending on the type of data involved. It will mirror your console.log() commands (they are shown in both the terminal as well as the GUI). One thing I really like is how easy it is to use; simply require the module from your project, you don’t otherwise need to write any special code to make it work (save for the gotcha’s below).

The interface feels a lot like the JavaScript console provided in modern browsers. Just like the JS console of a browser, one can interact with objects declared within the global scope, including reading/setting their values, running functions, etc.

Getting node-codein

The project is hosted at github/ketamynx/node-codein. From there you can watch it, check it out, and perform pull requests to fix things. But, to get it into your project easily, all you need to do is:

npm install node-codein -g

Example Usage

Here’s a quick little script I threw together to show how the project works. Notice that it displays the URL that the debugger is available at. Sometimes it tells me localhost, sometimes Copy and paste this into your address bar and off you go.


var codein = require("node-codein");

x = 100;

setTimeout(function() {
}, 10000);

blah = function() {
    x = 200;

Terminal Output

$ node test.js 
Debugger server started at:
{ y: 100 }


node-codein screenshot

node-codein screenshot


Notice how many times I said “global” in this post. If you want to inspect variables, you will need to console.log them, or assign them to the global scope. Most apps will not have code assigned to the global scope (since that’s a naughty thing). But, if you want to change things on the fly or run functions at your leisure, you’ll need to anchor it to the global object (hint, writing var x = 100; at the top level of your script does not make it a global, you need to remove the var operator).


It feels pretty solid to be honest.

One slight bug is that the dark color theme doesn’t have good contrast (I’m a big fan of light on dark colors). I think it is using the same foreground colors as the light theme.

node-codein dark theme

node-codein dark theme

Thomas Hunter II

Support Thomas on Patreon. Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.