NodeJS application stack
- 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 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 interfacenappjs-core-data
-js-core-data
wrapper which can be used to add ORM in your appnappjs-core-data-graphql
- autogenerated GraphQL api fromjs-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.
This stack aims mainly to containerized deployment, but for local development you can install cli:
npm install --save nappjs
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
}
You can see full feature example at nappjs accounts service (OAuth2 compliant backend service).