nappjs

NodeJS application stack

Usage no npm install needed!

<script type="module">
  import nappjs from 'https://cdn.skypack.dev/nappjs';
</script>

README

nappjs

NodeJS application stack

Build Status

Structure

  • schema - folder containing schema versions (if you have )
  • plugins (optional) - connect middlewares that are included into rest api
  • middlewares (optional) - similar as plugins, but for project specific logic
  • seeds (optional) - seed data in folder structure

Plugins

Plugins can also be load from local and global node_modules. Each module must have prefix nappjs- to be loaded. Loading global modules is disabled by default, but you can enable it by setting environment variable: LOAD_GLOBAL_PLUGINS=true

There are public plugins you can use right away:

  • nappjs-api - plugin exposing http interface (expressjs)
  • nappjs-graphql - plugin exposing http interface with GraphQL interface
  • nappjs-core-data - js-core-data wrapper which can be used to add ORM in your app
  • nappjs-core-data-graphql - autogenerated GraphQL api from js-core-data schema

So for example if you need to create backend app with GraphQL api, simply run:

npm install --save nappjs nappjs-core-data-graphql

Then you can continue with implementation according to each plugin specifications.

Installation

This stack aims mainly to containerized deployment, but for local development you can install cli:

npm install --save nappjs

Usage

When you have all you plugins installed (see previous section), you can use following scripts in package.json (and call them with npm run ...):

{
    "start": "nappjs start",
    "run-blah": "nappjs run blah", // runs script named `blah`
    "start-blah-cron": "nappjs cron '*/5 0 0 0 0 0' blah", // start repeating `blah` script each 5 seconds
}

Example

You can see full feature example at nappjs accounts service (OAuth2 compliant backend service).