If you haven't heard about Nodal yet, or you have but you're unsure of where to begin, this tutorial is for you! Make sure you keep up with Nodal on GitHub to follow project updates.

Advertisement

Nodal is a Node.js server platform and framework that enables you to develop API services easily. With products growing increasingly multi-platform (web, mobile, IoT) we need to start thinking about our backend architecture using a service-oriented approach to begin with instead of as an afterthought.

The goal of Nodal is to build an encyclopedia around Node.js that allows any developer — newbie or veteran, back-end or front-end — to join in and begin creating web applications effortlessly.

Nodal has built-in PostgreSQL support, makes frequent use of modern ES6 syntax and idioms, and encourages fairly rigid software design patterns. This allows Nodal to make a bunch of decisions for you so that you can get your applications built and deployed quickly, with more confidence. Get to writing the code that powers your product faster and let Nodal do the heavy lifting.

While Nodal's core competency is not being used as a traditional monolithic webserver, it can still be used for that purpose. It's out of scope of this tutorial, but by sniffing around documentation you'll be able to find out how to get Nodal to do whatever you'd like - serving a static branding website, template support, etc.

Our First Nodal Project

While a lot of Nodal will be familiar to you if you've worked with an MVC framework such as Django or Ruby on Rails before, we'll start with getting a basic API Server set up and generate a few models. It's good to start with a sample project so let's make a Twitter clone called Instatweet.

For reference, you can find a completed version of the project used for this tutorial at keithwhor/instatweet-api on GitHub.

Setting Up Nodal

In order to install Nodal and get it working with a database we'll need to do the following:

Install Node.js 4.x or higher

Install PostgreSQL

Install Nodal

Installing Node.js

To make sure you're running a recent version of Node.js, just head over to Nodejs.org and download the most recent 4.x version or higher. Nodal has been developed explicitly for 4.x, so that's what's recommended at present time.

Installing PostgreSQL

If you're using Mac OS X I strongly recommend using Postgres.app to get PostgreSQL up and running on your machine. Make sure you configure your $PATH to get access to the command line tools. Once Postgres.app is installed and you've followed the instructions to set up the CLI, make sure there's a postgres superuser named postgres (no password) with:

$ createuser postgres -s

For a Windows installation, you can check out the PostgreSQL website.

Installing Nodal

You're almost ready to start setting up API servers in a flash. :)

To install Nodal, simply open up your Terminal command line and type:

$ npm install nodal -g

This will install the Nodal command line tools and the current version of the Nodal core. You're all ready to begin!