All Projects → eugene-manuilov → typeorm-uml

eugene-manuilov / typeorm-uml

Licence: MIT license
Generate Entity Relationship diagrams for Typeorm powered projects.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Batchfile
5799 projects

Projects that are alternatives of or similar to typeorm-uml

swagger2puml
Generate Class Diagrams (UML) for Given Swagger Definition
Stars: ✭ 43 (-79.23%)
Mutual labels:  plantuml, uml-diagrams
drawerd
DrawERD for rails.
Stars: ✭ 19 (-90.82%)
Mutual labels:  erd, erdiagram
erdiagram
Entity-Relationship diagram code generator library
Stars: ✭ 28 (-86.47%)
Mutual labels:  plantuml, erdiagram
X6
🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
Stars: ✭ 2,686 (+1197.58%)
Mutual labels:  erd, erdiagram
C4-PlantumlSkin
This library provides skinning to create C4 diagrams using PlantUml
Stars: ✭ 74 (-64.25%)
Mutual labels:  plantuml, uml-diagrams
plant erd
ERD exporter with PlantUML and mermaid format
Stars: ✭ 126 (-39.13%)
Mutual labels:  plantuml, erd
ecto erd
A mix task for generating Entity Relationship Diagram from Ecto schemas available in your project.
Stars: ✭ 173 (-16.43%)
Mutual labels:  plantuml, erd
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (-5.31%)
Mutual labels:  plantuml
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (-26.09%)
Mutual labels:  typeorm
Cli
A command line utility for Structurizr.
Stars: ✭ 173 (-16.43%)
Mutual labels:  plantuml
C4 Builder
This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
Stars: ✭ 164 (-20.77%)
Mutual labels:  plantuml
Plantumlclassdiagramgenerator
This is a generator to create a class-diagram of PlantUML from the C# source code.
Stars: ✭ 213 (+2.9%)
Mutual labels:  plantuml
nestjs-api-example
NestJS Example
Stars: ✭ 60 (-71.01%)
Mutual labels:  typeorm
Hands On Devops
A hands-on DevOps course covering the culture, methods and repeated practices of modern software development involving Packer, Vagrant, VirtualBox, Ansible, Kubernetes, K3s, MetalLB, Traefik, Docker-Compose, Docker, Taiga, GitLab, Drone CI, SonarQube, Selenium, InSpec, Alpine 3.10, Ubuntu-bionic, CentOS 7...
Stars: ✭ 196 (-5.31%)
Mutual labels:  plantuml
c4sharp
C4Sharp (C4S) is a .net library for building C4 Model diagrams.
Stars: ✭ 159 (-23.19%)
Mutual labels:  plantuml
Go Plantuml
Generate plantuml diagrams from go source files or directories
Stars: ✭ 167 (-19.32%)
Mutual labels:  plantuml
serverless-nestjs-typeorm
Example how to nestjs using the serverless framework with TypeORM
Stars: ✭ 99 (-52.17%)
Mutual labels:  typeorm
makeitpdf
A close-to-code documentation helper
Stars: ✭ 15 (-92.75%)
Mutual labels:  plantuml
MyAPI
A template to create awesome APIs easily ⚡️
Stars: ✭ 117 (-43.48%)
Mutual labels:  typeorm
Planter
Generate PlantUML ER diagram textual description from PostgreSQL tables
Stars: ✭ 251 (+21.26%)
Mutual labels:  plantuml

typeorm-uml

oclif Version Downloads/week License

A command line tool to generate UML diagrams for Typeorm projects. It uses plantuml to render diagrams and outputs an URL to a diagram.

Installation

Install this command as a development dependency to your project:

npm i -D typeorm-uml

Usage

Add a new script to your package.json to be able to run it:

{
    "name": "myproject",
    "scripts": {
        "db:diagram": "typeorm-uml ormconfig.json"
    }
}

Then run npm run db:diagram and you will receive an URL to an image with your diagram. You can use this URL to add to your README file or you can download the image and add it to your repository.

Synopsis

USAGE
  $ typeorm-uml [CONFIGNAME]

ARGUMENTS
  CONFIGNAME  [default: ormconfig.json] Path to the Typeorm config file.

OPTIONS
  -D, --direction=(TB|LR)          [default: TB] Arrows directions. TB=top to bottom, LR=left to right.
  -c, --connection=connection      [default: default] The connection name.
  -d, --download=download          The filename where to download the diagram.
  -e, --exclude=exclude            Comma-separated list of entities to exclude from the diagram.
  -f, --format=(png|svg|txt|puml)  [default: png] The diagram file format.
  -i, --include=include            Comma-separated list of entities to include into the diagram.
  --color=pkey=#aaa                Custom colors to use for the diagram.
  --handwritten                    Whether or not to use handwritten mode.
  --monochrome                     Whether or not to use monochrome colors.
  --plantuml-url=plantuml-url      [default: http://www.plantuml.com/plantuml] URL of the plantuml server to use.
  --with-entity-names-only         Whether or not to display only entity names and hide database table names.
  --with-enum-values               Whether or not to show possible values for the enum type field.
  --with-table-names-only          Whether or not to display only database table names and hide entity names.

Defining custom colors

If you want to override colors used in the diagram, you can do it using --color flag. It accepts the key-value pair where key is an element and value is a color. You can use multiple --color flags to override multiple elements. For example:

typeorm-uml path/to/ormconfig.json --color class.ArrowColor=#ff9900 --color class.BorderColor=#ff9900 --color class.BackgroundColor=#efefef --color column=#ddd

You can use pkey, fkey and column colors to override entity column icons, and class.BackgroundColor, class.BorderColor, class.ArrowColor to override enity class styles.

Typescript

If you use .ts entities in your Typeorm config, then run this command with ts-node like this:

ts-node ./node_modules/.bin/typeorm-uml ormconfig.json

PlantUML

Under the hood, this library uses the PlantUML Language to define diagrams and the official plantuml server to draw it.

In most cases, it's fine to use it without a doubt. However, it's not always the case. If you work on a project that has a strict security level and you can't use the public server, then you can set up your own using the official docker image of PlantUML server and use the --plantuml-url flag to let this library know its location.

Run Programmatically

You can also import the TypeormUml class from this package and build UML diagrams on your own. See this small example:

import { EOL } from 'os';
import { join } from 'path';

import { Direction, Flags, Format, TypeormUml } from 'typeorm-uml';

const configPath = join( __dirname, 'path/to/ormconfig.json' );
const flags: Flags = {
    direction: Direction.LR,
    format: Format.SVG,
    handwritten: true,
};

const typeormUml = new TypeormUml();
typeormUml.build( configPath, flags ).then( ( url ) => {
    process.stdout.write( 'Diagram URL: ' + url + EOL );
} );

Please, pay attention that the TypeormUml::build() method also accepts connection instance itself, so you don't need to compose a configuration file if you don't have one in your project. Here is another small example of how it can be used in the typeorm/typescript-example project:

import { EOL } from 'os';
import { join } from 'path';

import { Direction, Flags, Format, TypeormUml } from 'typeorm-uml';
import { createConnection } from 'typeorm';

createConnection().then( async ( connection ) => {
    const flags: Flags = {
        direction: Direction.LR,
        format: Format.SVG,
        handwritten: true,
    };

    const typeormUml = new TypeormUml();
    const url = await typeormUml.build( connection, flags );

    process.stdout.write( 'Diagram URL: ' + url + EOL );
} );

Example

typeorm/typescript-example

typeorm-uml --format=svg --with-table-names-only

typeorm/typescript-example

Contribute

Want to help or have a suggestion? Open a new ticket and we can discuss it or submit a pull request.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].