Nodejs Starter - Choose a Javascript Boilerplate and start fast

Hello coders,

When we start a new project, usually takes a lot of time to set up the environment, all the tools and technologies until we can effectively, start coding. A quick solution is to use a starter, sometimes called a boilerplate, with a structure closer to our setup.

This article was originally published on Dev.to, and based on the community feedback, I decided to write more about this hot topic.

The goal of  this article is to present a curated list of Nodejs starters, already equipped with a basic set of features, ready to be used as a code base for a production project.

A short introduction about Node.js and Boilerplates for newcomers and beginners.

Nodejs

Nodejs is a JavaScript runtime environment. This is the official explanation, but how does that work?

The Nodejs run-time environment includes everything you need to execute a program written in JavaScript. With Nodejs, the Javascript code execution was extended to become executable in almost any operating system, just like Python or Ruby.

Starters (boilerplates)

In programming, a boilerplate is a piece of software that can be reused over and over without changing a single line of code. The whole idea behind a starter, or a boilerplate is to skip coding that piece of code common to many projects. You may read here more about boilerplates.

Let's move forward with our list of Nodejs starters

Nodejs Starter Hackathon

This boilerplate for Nodejs, has more than 26k Github start and is equipped with may useful features like authentication, Bootstrap4 integration, SaaS support, modular and very easy to use.

Nodejs Starter Hackathon - Banner Image.

Hackathon Starter Dependencies

Let's built and use this starter. Sources can be downloaded in zip format or we can use git to get the source code:

$ git clone https://github.com/sahat/hackathon-starter.git
$ cd hackathon-starter
$ yarn # install dependencies
$ yarn start
$    yarn run v1.15.2
$    node app.js
     ✓ App is running at http://localhost:8080 in development mode
     Press CTRL-C to stop

If your environment is properly set up, please visit localhost:8080 in your preferred browser and start playing with the app.

Hackathon Starter features

  • MongoDB database
  • Authentication: basic ( via user / pass), OAuth 1.0, 2.0 via Twitter, Google
  • Full authentication flow: Change, Reset password
  • MVC architecture
  • Bootstrap, SaaS integration
  • API examples: Facebook, Stripe

As we can easily see, this Nodejs starter provides a generous code-base to help us start fast with a Nodejs project.


Nodejs Starter API Kit

Boilerplate and tooling for authoring data API backends with Nodejs and GraphQL. It is best suited for developing a GraphQL API endpoint as a standalone (micro)service (demo), backing up web front-ends and/or mobile apps. With more than 2.8k Github starts, this boilerplate is definitively a winner if your future project replaces the old school REST API with GraphQL.

Starter features

  • Common Node.js stack: Express, Passport, Session, Cors
  • PostgresSQL as DMBS, along with Redis
  • Localization and translations
  • Nodemailer, Handlebars templating
  • Deployment: via Docker

How to build the app

$ git clone https://github.com/kriasoft/nodejs-api-starter.git 
$ cd nodejs-api-starter
$ docker-compose up

The app has the batteries included to run under Docker. The alternate option, is to execute the app by typing yarn && yarn start, old school commands.


Nodejs Starter Serverless

Nodejs Starter Serverless is a Nodejs starter for the Serverless Framework with async/await and unit test support. The project is actively supported by Frank Wang with 450 Github stars. This starter got my attention mainly for the serverless concept, which is a raising concept in web development nowadays. Features:

  • Integrate serverless-webpack plugin
  • ES7 syntax in handler functions
  • Support for unit tests (via Jtest)

Before running the app, we need to install Serverless Framework and configure the AWS CLI. To test the app, without leaving this page, just type:

$ 
$ git clone https://github.com/AnomalyInnovations/serverless-nodejs-starter.git
$ cd serverless-nodejs-starter
$ yarn # install app dependencies 
$ npm install -g serverless # install AWS serverless
$

The key files in the project:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
export const hello = async (event, context) => {
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: `Go Serverless! ${(await message({ time: 1, copy: 'Your function executed successfully!'}))}`,
    }),
  };
};

const message = ({ time, ...rest }) => new Promise((resolve, reject) =>
  setTimeout(() => {
    resolve(`${rest.copy} (with a delay)`);
  }, time * 1000)
);
Execute the code, locally
$ 
$ serverless invoke local --function hello
$ 
$ {
$     "statusCode": 200,
$     "body": "{\"message\":\"Go Serverless! Your function executed successfully! (with a delay)\"}"
$ }
$

Other Nodejs Starters

  • Nodejs starters - index provided by Boilrplate.com
  • AEboilerplate Nodejs Starter - A full-stack React/Node/Typescript web project starter that focuses primarily on ease-of-use and simplicity.
  • Nodejs Starter Kit - This repo is a starter kit for working with Node.js, Handlebars (both server and client side), Sass (via node-sass), and Babel (via spire-of-babel).
  • Nodejs Website Boilerplate - A website template that satisfies some common website requirements including dynamic pages, blog articles, author management, SEO ability, contact form and website search. Content powered by Cosmic JS.
  • Vue Express Mongo Boilerplate - MEVN Full stack JS web app boilerplate with NodeJS, Express, Mongo and VueJS
  • Nodejs Passport Boilerplate - User system in nodejs illustrating the use of passport in express, jade and mongoose environment together with front pages for login, signup and profile mock built with Twitter Bootstrap. Includes login with Facebook, Twitter, Github and Google together with Passport LocalStrategy.
  • Nodejs Starter - starter provide by AppSeed

Show Comments

Get the latest posts delivered right to your inbox.