# freted

> FreteBras development CLI

Latest version **0.2.4** (published 2021-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install freted
pnpm add freted
yarn add freted
bun add freted
```

Provides the command `freted`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2021-02-19 |
| First published | 2021-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 16 |
| Unpacked size | 59.7 KB |
| Known vulnerabilities | 0 (+27 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | vagnercsouza |
| Keywords | freted, developer-tools, dependency-manager |

## Links

- npm: https://www.npmjs.com/package/freted
- Repository: https://github.com/fretebras/freted
- Issues: https://github.com/fretebras/freted/issues
- npm.io page: https://npm.io/package/freted

## Dependencies (16)

- [joi](https://npm.io/package/joi.md) ^17.3.0
- [conf](https://npm.io/package/conf.md) ^9.0.0
- [rxjs](https://npm.io/package/rxjs.md) ^6.5.5
- [yaml](https://npm.io/package/yaml.md) ^1.10.0
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [execa](https://npm.io/package/execa.md) ^4.0.2
- [listr](https://npm.io/package/listr.md) ^0.14.3
- [tslib](https://npm.io/package/tslib.md) ^1
- [marked](https://npm.io/package/marked.md) ^1.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^7.1.0
- [terminal-kit](https://npm.io/package/terminal-kit.md) ^1.35.3
- [@oclif/config](https://npm.io/package/@oclif/config.md) ^1
- [@oclif/errors](https://npm.io/package/@oclif/errors.md) ^1.3.4
- [@oclif/command](https://npm.io/package/@oclif/command.md) ^1
- [marked-terminal](https://npm.io/package/marked-terminal.md) ^4.1.0
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^3

## Recent versions

- 0.2.4 (latest) — 2021-02-19
- 0.2.3 — 2021-02-01
- 0.2.2 — 2021-01-18
- 0.2.1 — 2021-01-18
- 0.2.0 — 2021-01-18

## README

# freted

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/freted.svg)](https://npmjs.org/package/freted)
[![Downloads/week](https://img.shields.io/npm/dw/freted.svg)](https://npmjs.org/package/freted)
[![License](https://img.shields.io/github/license/fretebras/freted)](https://github.com/fretebras/freted/blob/master/LICENSE.md)

![freted banner](.github/banner.png)

## About
`$ freted` uses Docker and Git to manage environments for local development of distributed systems. It works like a dependency manager (like Composer and npm) to resolve dependencies and start all on your local machine.

## Technology
- Docker
- Node
- Oclif
- TypeScript
- Traefik

## Requirements
To use `freted` you need the following dependencies installed in your machine:
- Docker
- Git
- Node >= 10

## Getting started
To start using `freted`, follow those steps:

### 1. Install `freted`

#### Using NPM

```shell
$ npm install -g freted
```

### 2. Authenticate with GitLab or GitHub
```shell
$ freted login
```

### 3. Start a service
Enter the service name as an argument to the `start` command. The service name is the URL of the repository without the protocol.
*For example, for the repository `https://github.com/myorg/myproject` the name is `github.com/myorg/myproject`.*

If the repository don't exists locally, `freted` will clone in your workspace if you granted your credentials using `$ freted login`.

If you are working on a new project and it doesn't have a repository yet, `freted` will try to resolve the local directory within your workspace.

```shell
$ freted start github.com/myorg/myproject
```

This command will resolve and start the project and all it's dependencies and print a resume of all services.

## Configuring services
To allow a project to be run with `freted`, create a file on the root of your project named `freted.yml` with the following content:

```yaml
name: github.com/myorg/myproject
description: My awesome project
```

You can find a full example of a config file on the repository at [here](https://github.com/fretebras/freted/blob/master/example/freted.yml).

### Commands

You can define the commands to setup, start and stop your services.

- **setup**: will be run when you start the service for the first time.
- **start**: will be run when you start the service.
- **stop**: will be run when you stop the service.

```yaml
setup:
  - docker-compose build

start:
  - docker-compose up -d

stop:
  - docker-compose down
```

### Dependencies
`freted` is also a dependency manager. If you have a service (like a SPA) that depends on another (like an API), you can declare this dependency on `freted.yml`:

```yaml
dependencies:
  - github.com/myorg/myproject2

optionalDependencies:
  - github.com/myorg/myproject3
```

### Credentials and instructions
You can use the `freted.yml` to put default credentials and quick notes for the developers. Those instructions will be shown on the terminal after the application starts.

```yaml
instructions:
  - Sign-in using one of the credentials provided.

credentials:
  - name: Active user
    description: User active on the app
    email: foo@bar.com
    password: mysecretpass
```

### HTTP entrypoint
`freted` uses Traefik to facilitate the organization and communication between all services. The Traefik container is automatically managed by `freted`.

If your service can be accessed through HTTP, edit the `freted.yml` and add the following config:

```yaml
routes:
  - host: myproject.myorg.local
    backend: docker
    destination: mycontainer_app
    port: 80
```

*The field `destination` must be the name of the running container. With docker compose, set the field `container_name` on the service and use the same name here.*

## CLI Usage
<!-- usage -->
```sh-session
$ npm install -g freted
$ freted COMMAND
running command...
$ freted (-v|--version|version)
freted/0.2.4 linux-x64 node-v10.23.3
$ freted --help [COMMAND]
USAGE
  $ freted COMMAND
...
```
<!-- usagestop -->

### Commands
<!-- commands -->
* [`freted configure`](#freted-configure)
* [`freted help [COMMAND]`](#freted-help-command)
* [`freted inspect SERVICE`](#freted-inspect-service)
* [`freted login`](#freted-login)
* [`freted logs`](#freted-logs)
* [`freted restart SERVICE`](#freted-restart-service)
* [`freted start SERVICE`](#freted-start-service)
* [`freted stop SERVICE`](#freted-stop-service)

## `freted configure`

configure freted

```
USAGE
  $ freted configure

EXAMPLE
  $ freted configure
```

_See code: [src/commands/configure.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/configure.ts)_

## `freted help [COMMAND]`

display help for freted

```
USAGE
  $ freted help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.1/src/commands/help.ts)_

## `freted inspect SERVICE`

inspect a service

```
USAGE
  $ freted inspect SERVICE

ARGUMENTS
  SERVICE  name of the service

EXAMPLE
  $ freted inspect github.com/myorg/myproject
```

_See code: [src/commands/inspect.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/inspect.ts)_

## `freted login`

authenticate to supported providers

```
USAGE
  $ freted login

EXAMPLE
  $ freted login
```

_See code: [src/commands/login.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/login.ts)_

## `freted logs`

show services logs

```
USAGE
  $ freted logs

EXAMPLE
  $ freted logs
```

_See code: [src/commands/logs.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/logs.ts)_

## `freted restart SERVICE`

restart a service

```
USAGE
  $ freted restart SERVICE

ARGUMENTS
  SERVICE  name of the service to restart

EXAMPLE
  $ freted restart github.com/myorg/myproject
```

_See code: [src/commands/restart.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/restart.ts)_

## `freted start SERVICE`

start a service

```
USAGE
  $ freted start SERVICE

ARGUMENTS
  SERVICE  name of the service to start

OPTIONS
  --no-dependencies           don't start service dependencies
  --no-optional-dependencies  don't start service optional dependencies

EXAMPLE
  $ freted start github.com/myorg/myproject
```

_See code: [src/commands/start.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/start.ts)_

## `freted stop SERVICE`

stop a service

```
USAGE
  $ freted stop SERVICE

ARGUMENTS
  SERVICE  name of the service to stop

OPTIONS
  --no-dependencies           don't start service dependencies
  --no-optional-dependencies  don't start service optional dependencies

EXAMPLE
  $ freted stop github.com/myorg/myproject
```

_See code: [src/commands/stop.ts](https://github.com/fretebras/freted/blob/v0.2.4/src/commands/stop.ts)_
<!-- commandsstop -->

---
_Source: https://npm.io/package/freted · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
