Our CLI offers a quick, hassle-free way to set up a new project and install API modules with a single command.

While you’re free to copy source code directly from our GitHub repo, the CLI significantly simplifies the setup process by automating file placements, dependency resolutions, and other configurations.

The "raw" source code of API modules in GitHub may appear complex if copied directly. This setup is intentional to make the CLI work but can be confusing when integrating manually.

Using the CLI ensures smooth installation by handling:

  • Copying files from the module registry
  • Installing schema validators and database repositories
  • Resolving internal and external dependencies
  • Adjusting import aliases in each file

init

Use the init command to create a new project using our Node.js template or to add a .config/modules.json file to an existing project.

npx vratix init

This command installs the template, sets up package.json, and configures the project based on your choices. For details on this process, refer to the Installation Guide.

Options

Usage: vratix init|i [options]
 
Initialize project
 
Options:
  -c, --cwd <cwd>  The working directory. Defaults to the current directory.
  -h, --help       Display help for the command

add

The add command allows you to add new API modules to your project. It checks if both package.json and .config/modules.json exist in the project directory. If these files are missing, use the init command first.

npx vratix add <module>

This command installs all relevant files for the specified module, manages dependencies, and adjusts import statements as needed.

Options

Usage: vratix add [options] [module...]
 
Add an API module to your project
 
Arguments:
  module           The name of the module you want to add
 
Options:
  -c, --cwd <cwd>  The working directory. Defaults to the current directory.
  -h, --help       Display help for the command

module [command]

You can use the module commands to create and publish new API modules to your private registry.

npx vratix module [command]

NOTE: To publish API modules you need to authenticate your CLI session using the login command

Options

Usage: vratix module|m [options] [command]
 
Private module commands. Use them to create, validate and publish Private API Modules.
 
Options:
  -h, --help         display help for command
 
Commands:
  new                Create a new API Module, this will create the necessary files and directories for your new module.
  publish [options]  Publish your API Module to your Vratix registry.
  help [command]     display help for command

login

To publish or install Private API Modules you need to authenticate your CLI session. To do this use the login command:

npx vratix login

This will open a browser window and ask you to verify an 8 character code shown in your terminal. The code will look something like this 6AF2-4CPI. You need to have a Vratix account to be able to authenticate your CLI session. Create a new account.

Options

Usage: vratix login [options]
 
Authenticate your CLI session with your Vratix account.
 
Options:
  -h, --help  display help for command