tools for stack generation from templates and an api
Last updated 20 days ago by yisroel .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install no-stack-cli 
SYNC missed versions from official npm registry.


Tools for stack generation from templates and an api.

Getting Started

If you are ever confused about the commands, run nostack --help. If you want to know the parameters for any command, just run the command with '--help'. But relax--if you are missing one you will be told. :)

The four standard steps for creating an app are the following:

  1. create a no-stack-app nostack newapp -a <appName>
  2. create a new moderator and stack nostack quickstarter -e <moderatorEmail> -w <password> -l <licenceId> -u <moderatorName> -s <stackName>
  3. spin up stack (call from the same directory as step 1): nostack spinstack -u <moderatorName> -t dir/to/template/<templateFile> -s <stackName> -e <emailFor Moderator>
  4. generate code (call from the same directory as step 1): nostack makecode -a <appName>

The first step by far takes the most time. Not only does it call create-react-app, but it installs every dependency, which can take 10 minutes. Therefore, a 5 second alternative is to specify an appBase, which is a locally stored empty no-stack app. You can specify it with the -b flag: ns newapp -a app${currentNumber} -b ${appBase}.

The best practice is usually to create one initially by calling this:

ns newapp -a ${appBase}

Then you can call it as you like. The drawback of using an appBase is that if any of the dependencies change you will not see the changes.

There is also a recommended shortcut command to get started: nostack quickStarter -e ${email} -w ${password} -l ${license} -u ${moderator} -s ${stackName} -a${appName} -t ${appTemplate} -b ${appBase}

That will give you everything you need for your first app. Note that you will need to provide a license and a template. You can apply for a license at Documentation for creating templates is in the pipeline right now.

The test directory contains a few sample templates in /test/testData/.

NoStack Concepts

It is useful to understand two things:

  1. NoStack stores types of data and their instances. Instances contain an autogenerated id and a value. For instance, you might have in your application a type restaurant and it may have 300 instances, each of which has a name and an autogenerated id.
  2. types are declared and used in "sources". A source is fundamentally a hierarchy of types. For instance, a source might contain at its root restaurant, with cuisine and rating as children.

Also, every source is assigned to a given user class, and a generated server has auth built in.

More details are given in the "Creating Templates" section below.

Creating Templates

The templates are text files which contain series of declarations using the NoStack Flow Specification language (NFS).

An template file treats each line as a different declaration. Any line that does not begin with a reserved command word is ignored.

NFS Commands

The commands are expected to change soon, but currently these are available:

  • newUserClass <class>
  • newSource <source> <class>
  • newType <type> <source> <parent> [<data type> ] [<association type>]
  • newSelection <source> <selected type>
  • newConstraint <constraint value> <source> <type> ID|Value
  • connectSources <childSource> <parentSource> <connecting type>

Command Explanations

newUserClass A user class is a type of user. A source is an interface unit that is permitted to a user class. A source contains a hierarchy of types, starting from some root type. A source also can include actions that can be performed with data.

Types are loosely data entities and/or properties. A type declaration contains the name of the type and a parent type. [Important note: a user class declaration also results in a type being created for the user class. In other words, each user is an instance of their class or classes.] By default, a type is a string. But optionally a type can be set.
Currently, only booleans and strings are supported, but that will change soon.

A type declaration can also optionally contain a association type. Association types can specify whether a child is required for the parent (always exists) or not, and the number of children for a type. The default is not required and multiple. Currently, the only declarable association type is singleRequired, which is useful for declaring properties.

A selection means a type in a source that gets returned to the front end. It is analagous to a field that shows up in the "SELECT" clause of an SQL query.

A constraint limits the data returned. A source and the type to be constrained must be specified. Also, a constraint value is required. That is normally a variable name which can then be set in front end code. There are two types of costraints: ID and Value. Constraining by id returns the instance having the id specified. Constraining by value will return any instances that satisfy the condition provided. There are a few reserved words for constraints. The main one is currentUser, which is the id for the current user. If you set the constraint value to currentUser, then the code generated will set it as such. Otherwise, it's just a string used for a variable name that gets set in the code. [Note: the name that you give for the constraint value for an ID contraint is purely for code readability.]

Two sources can be "connected", which will affect frontend code generated. A connecting type must be shared between the sources. Usually, a connecting type will be a constrained type for the child source. When a source A is connected to parent source B, a component generated for B will contain A as a subcomponent with an instance for every instance of the connecting type.

Version Downloads/week License


$ npm install -g no-stack-cli
$ nostack COMMAND
running command...
$ nostack (-v|--version|version)
no-stack-cli/0.2.5 linux-x64 node-v12.11.1
$ nostack --help [COMMAND]
  $ nostack COMMAND


nostack callapi

Make a call to the nostack api. Takes care of auth for the user. You need to specify a file with the graphql query and another one with a json of the variables, if anyare used.

  $ nostack callapi

  -h, --help                         show CLI help
  -q, --queryFile=queryFile          graphql file containing a single query
  -s, --stack=stack                  stack
  -u, --user=user                    moderator for stack
  -v, --variablesFile=variablesFile  json file with query variables

  $ nostack callapi -u irnold1y -s TestStack1y -q ~/projects/no-stack-queries/queries/unitData1y.graphql -v 

See code: src/commands/callapi.ts

nostack createstack

Creates a new moderator and stack. Also logs in the moderator locally.

  $ nostack createstack

  -e, --email=email          moderator email
  -f, --force
  -h, --help                 show CLI help
  -l, --licenseId=licenseId  license id for the organization of the user
  -s, --stack=stack          stack
  -u, --user=user            moderator to create
  -w, --password=password    moderator password

  $ nostack createStack -u franky -s tempstack, -e -w franky12$

See code: src/commands/createstack.ts

nostack help [COMMAND]

display help for nostack

  $ nostack help [COMMAND]

  COMMAND  command to show help for

  --all  see all commands in CLI

See code: @oclif/plugin-help

nostack makecode

generates a starter app from a json provided by NoStack

  $ nostack makecode

  -a, --appName=appName  application name
  -f, --force
  -h, --help             show CLI help

See code: src/commands/makecode.ts

nostack newapp

create an empty new no-stack app. Effectively combines create-react-app with apollo stuff and the no stack package.

  $ nostack newapp

  -a, --appName=appName  name of application
  -b, --baseApp=baseApp  directory of the base app to copy. If it does not exist, it is created.
  -h, --help             show CLI help

See code: src/commands/newapp.ts

nostack quickstarter

Creates a new moderator and stack. Also logs in the moderator locally.

  $ nostack quickstarter

  -a, --appName=appName      name of application
  -b, --baseApp=baseApp      directory of the base app to copy. If it does not exist, it is created.
  -e, --email=email          moderator email
  -f, --force
  -h, --help                 show CLI help
  -l, --licenseId=licenseId  license id for the organization of the user
  -s, --stack=stack          stack
  -t, --template=template    template from which to spin up a stack
  -u, --user=user            moderator to create
  -w, --password=password    moderator password

  $ nostack quickstarter -u franky -s tempstack, -e -w franky12$

See code: src/commands/quickstarter.ts

nostack resetstack

Resets the stack, meaning that the moderator remains and the stack is completely empty. Essentially returns the status to before 'spinstack'. WARNING: this is not reversable and will remove EVERYTHING, including your users!!!!

  $ nostack resetstack

  -h, --help         show CLI help
  -s, --stack=stack  stack
  -u, --user=user    moderator for stack

See code: src/commands/resetstack.ts

nostack spinstack

Spins up a fully functional backend from a provided template. The same template can then be used to generate front end code using the command 'makeCode'.

  $ nostack spinstack

  -a, --appName=appName          application name
  -e, --email=email              email to be used by sample users
  -h, --help                     show CLI help
  -s, --stack=stack              stack
  -t, --template=template        template from which to spin up a stack
  -u, --user=user                moderator for stack
  -x, --addedSuffix=addedSuffix  added suffix for sample instances generated

See code: src/commands/spinstack.ts

Current Tags

  • 0.2.5                                ...           latest (20 days ago)

18 Versions

  • 0.2.5                                ...           20 days ago
  • 0.2.4                                ...           a month ago
  • 0.2.3                                ...           a month ago
  • 0.2.2                                ...           a month ago
  • 0.2.1                                ...           a month ago
  • 0.2.0                                ...           a month ago
  • 0.1.0                                ...           2 months ago
  • 0.0.11                                ...           2 months ago
  • 0.0.10                                ...           2 months ago
  • 0.0.9                                ...           2 months ago
  • 0.0.8                                ...           2 months ago
  • 0.0.7                                ...           2 months ago
  • 0.0.6                                ...           2 months ago
  • 0.0.5                                ...           2 months ago
  • 0.0.4                                ...           2 months ago
  • 0.0.3                                ...           2 months ago
  • 0.0.2                                ...           2 months ago
  • 0.0.1                                ...           2 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 100
Dependencies (27)
Dev Dependencies (13)
Dependents (0)

Copyright 2014 - 2016 © |