# loopback-uml-generator

> UML generator that uses Loopback (IBM) ORM configuration files as references

Latest version **1.0.1** (published 2019-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopback-uml-generator
pnpm add loopback-uml-generator
yarn add loopback-uml-generator
bun add loopback-uml-generator
```

Provides the command `lbUML`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-04-05 |
| First published | 2019-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 31.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | François Leparoux |
| Maintainers | rascafr |
| Keywords | UML, Loopback, IBM, Plantuml |

## Links

- npm: https://www.npmjs.com/package/loopback-uml-generator
- Repository: https://github.com/rascafr/loopback-uml-generator
- Homepage: https://github.com/rascafr/loopback-uml-generator#readme
- Issues: https://github.com/rascafr/loopback-uml-generator/issues
- npm.io page: https://npm.io/package/loopback-uml-generator

## Dependencies (1)

- [cli-color](https://npm.io/package/cli-color.md) ^1.4.0

## Recent versions

- 1.0.1 (latest) — 2019-04-05
- 1.0.0 — 2019-04-05

## README

# Loopback UML Generator

I work in a company where we use Loopback for most of our Javascript projects. I realise that there was a gap between production code and architecture documents.

Because keeping diagrams up-to-date can be a time consuming task, I started working on a Node.js module that will generate the UML class diagram using the famous [PlantUML](http://plantuml.com/class-diagram) Java library.

## Installation

The library is available on this [NPM repository](https://www.npmjs.com/package/loopback-uml-generator)

```bash
npm i -g loopback-uml-generator
```

The module will be installed globally.

You also need to download the [PlantUML jar executable](http://sourceforge.net/projects/plantuml/files/plantuml.jar/download) on your machine. 

Then, just set the environment variables `PLANTUML_JAR` as the path of the executable.

**Example:** (MacOS / Linux)

```bash
export PLANTUML_JAR="~/Documents/plantuml.jar"
```

## Usage

Once installed, just navigate into your Loopback project, and type:

```bash
lbUML <the-name-of-output-files>
```

The name argument is optional, if you don't set it, the module will use the app name and its version to generate the files (based on your `package.json` file).

Two files will be created at the root of your project:
- `*.txt`, the **PlantUML** description file
- `*.png`, the generated UML class diagram image file

## Example

Here is a quick example that shows a basic UML class diagram:

### Execution

```
Loopback-UML-Generator started...

 - PlantUML description file will be saved as UML-Generator-lb-car-1.0.0.txt
 - PlantUML image file will be saved as UML-Generator-lb-car-1.0.0.png
 - PlantUML jar used: ~/Documents/plantuml.jar
 ✓ Discovered 4 JSON model(s) in this project
 ♥ PlantUML started, please wait a few seconds...
 ✓ Done! Bye ♥
```

### Result

![](res/preview.png)

You might want to customise the diagram's style (colors, and so on). Just edit the generated text diagram file, with some properties, such as `skinparam monochrome`, then execute the PlantUML jar file and you're good to go.

## How it works

Based on files such as `package.json` and `server/model-config.json`, the module will scan for any JSON file present in the directories listed in `_meta/sources` property. Required fields and objects are extracted after and a formatter will create the UML description file. That's not rocket science :)

## Limitations

Currently, the module supports the following Loopback's objects:
- *classes*
- *properties*
- *remote-methods*
- *relations*

Please note that for the *relations* object, only `hasOne`, `hasMany`, and `belongsTo` types are supported.

This module is still a demo, so feel free to contribuate or report any issue! Cheers ♥

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