Skip to main content

Command-line interface (CLI)

Util tool for manage, get information and run small tasks in your We.js project.

To see all commands after install we cli type we in your terminal (after install we npm mobule globaly).


npm install -g we

Commands API

On run we cli program the cli will load all commands in commands/ folder in project and in all installed plugins.

Command file example:

Use this feature if you need to run custom commands with we.js features like database or email.

 * Simple command to log "Hello world" in command line
 * @param  {Object} program program from command.js npm module
 * @param  {Object} helpers we.js helpers, with methods like ".getWe()" that load return the we.js app instance
module.exports = function helloWorld (program, helpers) {
  .option('-n, --name [someoneName]', '')
  .description('Log hello world in terminal with optional user name')
  .action(function run (roleName, opts) {
    const we = helpers.getWe();

    if ( {`Hello world ${}!`);
    } else {`Hello world!`);

    // for use we.js models and database you need to bootstrap the project with:
      // we.db.models is fullfiled
      // write all code how needs project or plugin resources

Commands avaible in we.js core:

Run we command to see all avaible commands and options


Get current we cli version

Usage: we version


Get data about your project like all models and controllers loaded Usage: we status


Print all project routes in terminal with suport to filter by model, controller or path starts with. Usage: we routes


Start a node.js RELP console with your we.js project loaded as we console variable Usage: we console


Run current we.js project Usage: we run Alias we go


Set one user as project administrator with userId Usage: we setUserAsAdmin 1 This will set user 1 as administrator


Generate one time login url with userId Usage: we uli 1 This will print in console one time login url for user with id 1


Run pending plugins and project database updates Usage: we update


Load plugin default locales in current project Usage: we loadLocales


Drop and recreate the database Usage: we dropDB


Delete all models data and resync model tables Usage: we syncDB

We.js cli repository:

Widget: Comments 13: