# Node.js Embedded Development on the Raspberry Pi

## Why node.js?

![](https://cdn-learn.adafruit.com/assets/assets/000/021/906/medium800thumb/raspberry_pi_demo.jpg?1448314329)

Why is it&nbsp;worth exploring [node.js](http://nodejs.org/ "node.js")&nbsp;development in an embedded environment? JavaScript is a widely known language that was designed to deal with user interaction in a browser. &nbsp;Thanks to node.js, we can now use JavaScript outside of the browser, and even interact with hardware on devices such as the Raspberry Pi.

Here's a brief overview of some of the features that make node.js great for embedded development.

## npm

[npm](https://www.npmjs.com/ "npm")&nbsp;is one of the best things to happen to node.js. npm is the package manager for node. &nbsp;It makes managing third-party node dependencies a breeze, and makes it easy for mere mortals like myself to publish node.js packages.

Why is this important? &nbsp;Community. Because npm is so great at managing dependencies, you can include&nbsp;open source libraries&nbsp;in your project&nbsp;hassle-free. Since it's easy to include&nbsp;community libraries, the community has grown exponentially, and the number of available packages is&nbsp;mesmerizing. Have&nbsp;you ever tried to install an Arduino library? No offense to Arduino, but it's not the most user friendly experience. Thankfully, they are [working on adding a package manager](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification)&nbsp;to the Arduino IDE.

## Events

Events&nbsp;are a great way to deal with user interaction. &nbsp;What's an event? &nbsp;Maybe it would be easiest to give you a few examples of events. Toggling a switch, clicking a mouse, and pressing a key on your keyboard are all examples of events.

The great thing about using event listeners is that you can write a chunk of code that will be called whenever an event happens. No longer do you have to constantly check the state of a button to see if the state has changed in a loop. Instead, the button will let you know when it was pressed!&nbsp;

## Streams

The node.js stream API combines the power of events, with the power of the [Unix pipeline](https://en.wikipedia.org/wiki/Pipeline_%28Unix%29). &nbsp;If you know how to pipe commands in Unix environments, you know it's a game changer. We'll dig deeper into streams after taking a look at how to setup the node.js environment on a Raspberry Pi.

- [Next Page](https://learn.adafruit.com/node-embedded-development/connecting-via-ssh.md)

## Featured Products

### Raspberry Pi 1 Model B+ Starter Pack - Includes a Raspberry Pi 1

[Raspberry Pi 1 Model B+ Starter Pack - Includes a Raspberry Pi 1](https://www.adafruit.com/product/2125)
You're going to work hard with your Raspberry Pi B+. &nbsp;You're going to have to solder, code, and Linux your Maker heart out. &nbsp;That's why we've tried to make it as easy as possible to start -&nbsp;by combining the Raspberry Pi B+ with what we think are the best...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2125)
[Related Guides to the Product](https://learn.adafruit.com/products/2125/guides)
### Raspberry Pi 2 or Model B+ Starter Pack (Without Raspberry Pi)

[Raspberry Pi 2 or Model B+ Starter Pack (Without Raspberry Pi)](https://www.adafruit.com/product/2126)
You're going to work hard with your Raspberry Pi 2 Model B or Raspberry Pi 1 Model B+. &nbsp;You're going to have to solder, code, and Linux your Maker heart out. &nbsp;That's why we've tried to make it as easy as possible to start -&nbsp;by combining the Raspberry Pi with what...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2126)
[Related Guides to the Product](https://learn.adafruit.com/products/2126/guides)
### Raspberry Pi 1 Model B Starter Pack - Includes a Raspberry Pi

[Raspberry Pi 1 Model B Starter Pack - Includes a Raspberry Pi](https://www.adafruit.com/product/1014)
You want to get hacking with your Pi fast, right? Get everything you need to start with the Adafruit Starter Pack for Raspberry Pi. It's the perfect accompaniment to your new Pi, everything you need to boot up your Pi Model B and get going. **We pre-assemble the Cobbler for you, no...**

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1014)
[Related Guides to the Product](https://learn.adafruit.com/products/1014/guides)
### Raspberry Pi Model B starter pack Doesn't include Raspberry Pi 1

[Raspberry Pi Model B starter pack Doesn't include Raspberry Pi 1](https://www.adafruit.com/product/955)
You want to get hacking with your Pi fast, right? Get everything you need to start with the Adafruit Starter Pack for Raspberry Pi. It's the perfect accompaniment to your new Pi, everything you need to get a distro image loaded and running. **We even pre-assemble the Cobbler for you,...**

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/955)
[Related Guides to the Product](https://learn.adafruit.com/products/955/guides)
### USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

[USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi](https://www.adafruit.com/product/954)
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB\<-\>Serial conversion chip and at the end of the 36" cable are four wire - red power, black ground, white RX into USB port, and green TX out...

In Stock
[Buy Now](https://www.adafruit.com/product/954)
[Related Guides to the Product](https://learn.adafruit.com/products/954/guides)
### Ethernet Cable - 10 ft long

[Ethernet Cable - 10 ft long](https://www.adafruit.com/product/730)
We have so many Internet-connected goodies in the shop, we figured it's time to carry a cable so you can easily connect them up! This cable is 10 feet long, black and has all 8 wires installed. Perfect for use with the [BeagleBone](http://www.adafruit.com/products/513), <a...></a...>

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/730)
[Related Guides to the Product](https://learn.adafruit.com/products/730/guides)
### Espruino 1.4 - Open Source Javascript Microcontroller

[Espruino 1.4 - Open Source Javascript Microcontroller](https://www.adafruit.com/product/1887)
Try the JavaScript of things with the **Espruino** - the world's first open-source JavaScript microcontroller! This little board has an STM32 microcontroller pre-programmed with Espruino all ready to go so you can start playing with Javascript-microcontrollers....

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1887)
[Related Guides to the Product](https://learn.adafruit.com/products/1887/guides)
### Assembled Pi T-Cobbler Plus - GPIO Breakout

[Assembled Pi T-Cobbler Plus - GPIO Breakout](https://www.adafruit.com/product/2028)
 **This is the assembled version of the Pi T-Cobbler Plus. &nbsp;It only works with the Raspberry Pi Model Zero, A+, B+, Pi 2, Pi 3, Pi 4, and Pi 5!** (Any Pi with 2x20 connector)  
  
The Raspberry Pi has landed on the Maker World like a 40-GPIO pinned, quad-USB ported,...

In Stock
[Buy Now](https://www.adafruit.com/product/2028)
[Related Guides to the Product](https://learn.adafruit.com/products/2028/guides)

## Related Guides

- [Basic Resistor Sensor Reading on Raspberry Pi](https://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi.md)
- [CircuitPython Libraries on Linux and ODROID C2](https://learn.adafruit.com/circuitpython-libaries-linux-odroid-c2.md)
- [CircuitPython Libraries on Linux and Google Coral](https://learn.adafruit.com/circuitpython-on-google-coral-linux-blinka.md)
- [Adafruit's Raspberry Pi Lesson 12. Sensing Movement](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-12-sensing-movement.md)
- [Single Channel LoRaWAN Gateway for Raspberry Pi](https://learn.adafruit.com/raspberry-pi-single-channel-lorawan-gateway.md)
- [Adafruit's Raspberry Pi Lesson 13. Power Control](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-13-power-control.md)
- [Raspberry Pi E-mail Notifier Using LEDs](https://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds.md)
- [Windows IoT Core Application Development: Headless Blinky](https://learn.adafruit.com/windows-iot-application-development-headless-application.md)
- [IoT Temperature Logger with Analog Devices ADT7410, Raspberry Pi, and Adafruit IO](https://learn.adafruit.com/iot-temperature-logger-with-python-and-adafruit-io.md)
- [Playing sounds and using buttons with Raspberry Pi](https://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi.md)
- [Adding Basic Audio Ouput to Raspberry Pi Zero](https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero.md)
- [Windows IoT Core Application Development: Headed Blinky](https://learn.adafruit.com/windows-iot-application-development-headed-blinky.md)
- [Adafruit's Raspberry Pi Lesson 11. DS18B20 Temperature Sensing](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing.md)
- [Adafruit's Raspberry Pi Lesson 10. Stepper Motors](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-10-stepper-motors.md)
- [Capacitive Touch Sensors on the Raspberry Pi](https://learn.adafruit.com/capacitive-touch-sensors-on-the-raspberry-pi.md)
