Skip to content

Matusal3m/rufi-cli

Repository files navigation

Rufi CLI

Rufi CLI is a command-line interface tool designed to manage and streamline the development of services. It provides commands for managing services, migrations, and database schemas, making it easier to work with distributed systems and microservices.

Features

  • Clone and pull services from Git repositories.
  • Manage database migrations for individual or all services.
  • Reset and initialize the development environment.
  • List database schemas and tables.

Installation

npm i rufi-cli -D

or

bun i -d rufi-cli

Before using it

  1. Make sure your .env file looks like this:
# Required to run the CLI (the variable names can be changed in your rufi.config)
POSTGRES_HOST="localhost"
POSTGRES_DATABASE="postgres"
POSTGRES_USER="postgres"
POSTGRES_PORT="5432"
POSTGRES_PASSWORD='super-secret-password'

ENV='development' # any other value will disable dev commands

CORE_SERVICE=core

# Required to use service:* commands
GIT_TOKEN=your-git-token
GIT_USERNAME=username
  1. Your PostgreSQL database is running and accepting connections.
  2. You’re using psql (or a Docker container with it).
  3. You have git installed (duh).

Note: It may fail if:

  • The database is not running
  • Any credential is incorrect

Usage

Run the CLI commands using the rufi binary.

Initialize Configuration

Create the default configuration files (required before using the CLI):

npx rufi init --with-services [--ts]

Note: The TypeScript config file is currently only used during CLI development. There’s no guarantee that it will work properly in your project. Prefer .js config files.

Clone Services

Clone all services defined in the configuration:

npx rufi service:clone --all

Pull Updates

Pull updates for a specific service:

npx rufi service:pull <service-name>

Apply Migrations

Apply pending migrations for a specific service:

npx rufi migration:up <service-name>

Reset Database

Reset the development database by dropping all schemas:

npx rufi db:reset

Start Environment

Initialize the environment by cloning all services and applying migrations:

rufi start

For a full list of commands, use:

rufi --help

About

a cli to manage multiple services using the same database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors