WIP - An opinionated API template for Node.js backends
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
lib
spec
.editorconfig
.env.example
.gitignore
Dockerfile
LICENSE
README.md
docker-compose.yml
eslintrc.json
package.json
yarn.lock

README.md

node-api-seed

An opinionated API template for Node.js backends

About

Extracted from apps I've built in the past

Installation

$ git clone git@github.com:joshbeitler/node-api-seed.git node-api-seed
$ cd node-api-seed
$ yarn

Configure database

Before you dive into building out your API, it is important to set up the seed's required configuration values.

Apps built with this API seed can load sensitive config values from an environment file. An example is provided as .env.example. To get started, rename or copy the example and modify your .env file to meet your needs.

$  cp .env.example .env

You'll notice there are some default values in the example .env - these are the default values used by both the server and the database. If you just leave it as is the app will run just fine, but I highly recommend replacing them with more secure credentials.

Other configuration

Additionally, there is a config.js file located in the lib/config folder that can be used to store non-sensitive values, such as the API root. Go ahead and check that out as well, but the defaults are sensible and don't nessesarily need to be changed.

Usage

$ docker-compose up

Testing

Deploying

Features

  • based on koa
  • editorconfig
  • [-] easy to develop for (nodemon, yarn, babel, etc)
    • nodemon
    • yarn
    • babel
  • docker and docker-compose support
  • pre-built auth and scope middleware
  • database connection - sequelize
  • eslint for standard.js
  • ready for tests and CI runners
  • a nice collection of pre-installed middleware
    • kcors
    • koa-force-ssl ?
    • koa-helmet
    • koa-rest-router
    • koa-passport ?
    • koa-jwt ?
    • koa-logger
    • koa-bodyparser
    • koa-validate
  • easy to configure
  • support for .env files
  • easy to deploy
  • nice command line to generate resources
  • [-] Paw document for prototyping API

License

Copyright 2017 Joshua Beitler

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.