Yes, you can use Node.js to write desktop applications which can act as a keylogger, communicate with device drivers and other system resources.
Most of the system interoperability has gone into providing cross-platform support for particular system event notifications and I/O. Be mindful that there are tall stacks for reading keyboard events that differ from platform to platform, so you will probably want to take a look around the Node.js ecosystem for packages like node-ffi, which may assist you at accessing system resources from your application's event loop.
Should you want to write your own system bindings that are exposed to V8 and accessible by your Node.js application, there is excellent support for going native, from packaging to creating asynchronous events for your Node.js application.