Skip to content

CLI

Create a new project

The easiest and fastest way to start with PURISTA is the usage of your package managers create command.

In the project folder, simply execute:

bash
npm create purista@latest
bash
bun create purista@latest
bash
yarn create purista@latest
bash
pnpm create purista@latest

The CLI tool will guide you through all the necessary steps.

PURISTA CLI

PURISTA provides a command line interface (CLI) that allows you to create new services, and add commands or subscriptions to existing services.

It is highly recommended to install the CLI global.

You can manually install the PURISTA CLI via:

bash
npm install -g @purista/cli
bash
bun add --global @purista/cli
bash
yarn global add @purista/cli
bash
pnpm add -g @purista/cli

If you have installed the CLI globally, you can add service, commands and subscriptions to your project.
In your project root simply run:

bash
purista add [service|command|subscription]

PURISTA config file

Since version 1.12.0, the PURISTA CLI expects to find a purista.json file in the root of your project. This file contains basic information about your project. Especially the settings for file and event casing conventions are important.

Schema

This configuration file follows the JSON Schema specification.

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": { ... }
}

Configuration Options

$schema

  • Type: string
  • Description: A field for the JSON schema specification.

runtime

  • Type: string
  • Allowed Values: node, bun
  • Default: node
  • Description: Specifies the runtime environment for the project.

eventBridge

  • Type: string
  • Allowed Values: default, amqp, nats, mqtt, dapr
  • Default: default
  • Description: Defines the event bridge used in the project.

fileConvention

  • Type: string
  • Allowed Values: camel, snake, kebab, pascal, pascalSnake
  • Default: camel
  • Description: Determines the file naming convention used in the project.

eventConvention

  • Type: string
  • Allowed Values: camel, snake, kebab, pascal, pascalSnake, constantCase, dotCase, pathCase, trainCase
  • Default: camel
  • Description: Determines the naming convention for events in the project.

linter

  • Type: string
  • Allowed Values: biome, eslint, none
  • Default: none
  • Description: Specifies the linter used in the project.

formatter

  • Type: string
  • Allowed Values: biome, prettier, none
  • Default: none
  • Description: Specifies the formatter used in the project.

servicePath

  • Type: string
  • Default: src/service
  • Description: Defines the relative path where services are located in the project.

Example purista.json Configuration

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "runtime": "node",
  "eventBridge": "nats",
  "fileConvention": "kebab",
  "eventConvention": "dotCase",
  "linter": "eslint",
  "formatter": "prettier",
  "servicePath": "src/services"
}