{"id":13614188,"url":"https://github.com/eugene-manuilov/typeorm-uml","last_synced_at":"2025-04-13T18:32:26.861Z","repository":{"id":36947903,"uuid":"231247059","full_name":"eugene-manuilov/typeorm-uml","owner":"eugene-manuilov","description":"Generate Entity Relationship diagrams for Typeorm powered projects.","archived":true,"fork":false,"pushed_at":"2023-03-04T05:38:47.000Z","size":357,"stargazers_count":226,"open_issues_count":11,"forks_count":34,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T07:20:59.658Z","etag":null,"topics":["erd","erdiagram","plantuml","plantuml-diagrams","typeorm","typescript","uml-diagrams"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eugene-manuilov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-01T17:55:49.000Z","updated_at":"2024-04-14T07:20:59.659Z","dependencies_parsed_at":"2024-01-14T04:44:44.446Z","dependency_job_id":"a8029929-79a8-4212-86b1-d5b80e5d0eea","html_url":"https://github.com/eugene-manuilov/typeorm-uml","commit_stats":{"total_commits":151,"total_committers":11,"mean_commits":"13.727272727272727","dds":0.1854304635761589,"last_synced_commit":"583708a0f333e626a386122720f7a51fe7c9bd77"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugene-manuilov%2Ftypeorm-uml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugene-manuilov%2Ftypeorm-uml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugene-manuilov%2Ftypeorm-uml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugene-manuilov%2Ftypeorm-uml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eugene-manuilov","download_url":"https://codeload.github.com/eugene-manuilov/typeorm-uml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760541,"owners_count":21157376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erd","erdiagram","plantuml","plantuml-diagrams","typeorm","typescript","uml-diagrams"],"created_at":"2024-08-01T20:00:58.152Z","updated_at":"2025-04-13T18:32:26.484Z","avatar_url":"https://github.com/eugene-manuilov.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# typeorm-uml\n\n[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/typeorm-uml.svg)](https://www.npmjs.com/package/typeorm-uml)\n[![Downloads/week](https://img.shields.io/npm/dw/typeorm-uml.svg)](https://www.npmjs.com/package/typeorm-uml)\n[![License](https://img.shields.io/npm/l/typeorm-uml.svg)](https://github.com/eugene-manuilov/typeorm-uml/blob/master/package.json)\n\nA command line tool to generate UML diagrams for Typeorm projects. It uses [plantuml](https://plantuml.com/) to render diagrams and outputs an URL to a diagram.\n\n## Installation\n\nInstall this command as a development dependency to your project:\n\n```sh-session\nnpm i -D typeorm-uml\n```\n\n## Usage\n\nAdd a new script to your `package.json` to be able to run it:\n\n```json\n{\n    \"name\": \"myproject\",\n    \"scripts\": {\n        \"db:diagram\": \"typeorm-uml ormconfig.json\"\n    }\n}\n```\n\nThen 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.\n\n## Synopsis\n\n```sh-session\nUSAGE\n  $ typeorm-uml [CONFIGNAME]\n\nARGUMENTS\n  CONFIGNAME  [default: ormconfig.json] Path to the Typeorm config file.\n\nOPTIONS\n  -D, --direction=(TB|LR)          [default: TB] Arrows directions. TB=top to bottom, LR=left to right.\n  -c, --connection=connection      [default: default] The connection name.\n  -d, --download=download          The filename where to download the diagram.\n  -e, --exclude=exclude            Comma-separated list of entities to exclude from the diagram.\n  -f, --format=(png|svg|txt|puml)  [default: png] The diagram file format.\n  -i, --include=include            Comma-separated list of entities to include into the diagram.\n  --color=pkey=#aaa                Custom colors to use for the diagram.\n  --handwritten                    Whether or not to use handwritten mode.\n  --monochrome                     Whether or not to use monochrome colors.\n  --plantuml-url=plantuml-url      [default: http://www.plantuml.com/plantuml] URL of the plantuml server to use.\n  --with-entity-names-only         Whether or not to display only entity names and hide database table names.\n  --with-enum-values               Whether or not to show possible values for the enum type field.\n  --with-table-names-only          Whether or not to display only database table names and hide entity names.\n```\n\n## Defining custom colors\n\nIf 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:\n\n```sh-session\ntypeorm-uml path/to/ormconfig.json --color class.ArrowColor=#ff9900 --color class.BorderColor=#ff9900 --color class.BackgroundColor=#efefef --color column=#ddd\n```\n\nYou can use `pkey`, `fkey` and `column` colors to override entity column icons, and `class.BackgroundColor`, `class.BorderColor`, `class.ArrowColor` to override enity class styles.\n\n## Typescript\n\nIf you use `.ts` entities in your Typeorm config, then run this command with `ts-node` like this:\n\n```sh-session\nts-node ./node_modules/.bin/typeorm-uml ormconfig.json\n```\n\n## PlantUML\n\nUnder the hood, this library uses the [PlantUML Language](https://plantuml.com/) to define diagrams and the [official plantuml server](http://www.plantuml.com/plantuml) to draw it.\n\nIn 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](https://hub.docker.com/r/plantuml/plantuml-server) of PlantUML server and use the `--plantuml-url` flag to let this library know its location.\n\n## Run Programmatically\n\nYou can also import the `TypeormUml` class from this package and build UML diagrams on your own. See this small example:\n\n```typescript\nimport { EOL } from 'os';\nimport { join } from 'path';\n\nimport { Direction, Flags, Format, TypeormUml } from 'typeorm-uml';\n\nconst configPath = join( __dirname, 'path/to/ormconfig.json' );\nconst flags: Flags = {\n    direction: Direction.LR,\n    format: Format.SVG,\n    handwritten: true,\n};\n\nconst typeormUml = new TypeormUml();\ntypeormUml.build( configPath, flags ).then( ( url ) =\u003e {\n    process.stdout.write( 'Diagram URL: ' + url + EOL );\n} );\n```\n\nPlease, 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:\n\n```typescript\nimport { EOL } from 'os';\nimport { join } from 'path';\n\nimport { Direction, Flags, Format, TypeormUml } from 'typeorm-uml';\nimport { createConnection } from 'typeorm';\n\ncreateConnection().then( async ( connection ) =\u003e {\n    const flags: Flags = {\n        direction: Direction.LR,\n        format: Format.SVG,\n        handwritten: true,\n    };\n\n    const typeormUml = new TypeormUml();\n    const url = await typeormUml.build( connection, flags );\n\n    process.stdout.write( 'Diagram URL: ' + url + EOL );\n} );\n```\n\n## Example\n\n[**typeorm/typescript-example**](https://github.com/typeorm/typescript-example)\n\n```sh-session\ntypeorm-uml --format=svg --with-table-names-only\n```\n\n[![typeorm/typescript-example](http://www.plantuml.com/plantuml/svg/ZPF1Yjim48RlUehf5aeC2SiMSbcCsJJTjdif9OJIMv6jIImYQumq8J59thsIxKrCcgMrmPRcc_d_aIK_UPQEjvKHuft2bRO8B7E38xIomZ6eFBuJGCkQ6xXBywmBfVTvTdSfgZVOZFO975OQZJf1o4iBCkGUFqkt-Kf6eLsGoj8F8J5BxrkMmJxAd4LMroATmljPU_rLUwuBWMrbRrK-VubtgAnGQJbnM91JGmbHQeNW6HqIDpNwBb0XbwJwIQ5TOL08fXgO82Tcga3feCQQh11-esqjdQp0qTQgu67HmNGGDw7DA0_aWl00-58gsccxXfKq7WUab5Rjd6P6sxC1B8pq7Wu2mlL95fjrQpoFgu9TgHbRCdEETbtGermxHDjLX8-0xWgSH5XXk_KmbunhSiqOYdu42KX_cKNZTiT1AqWUuUNxSlJma408zti1yOn4z7Esc7-RBKOVfzF0JsUF7-Hv37LuTjhjw3zqmp4qDuG72RZdo9VFlvP3msZmkr-1HlywRCPlaajZD-cbsPZoSjrmXrwpht1egrtmyJYP70zlUeYpsRyInHDQ5N_ZFm00)](http://www.plantuml.com/plantuml/svg/ZPF1Yjim48RlUehf5aeC2SiMSbcCsJJTjdif9OJIMv6jIImYQumq8J59thsIxKrCcgMrmPRcc_d_aIK_UPQEjvKHuft2bRO8B7E38xIomZ6eFBuJGCkQ6xXBywmBfVTvTdSfgZVOZFO975OQZJf1o4iBCkGUFqkt-Kf6eLsGoj8F8J5BxrkMmJxAd4LMroATmljPU_rLUwuBWMrbRrK-VubtgAnGQJbnM91JGmbHQeNW6HqIDpNwBb0XbwJwIQ5TOL08fXgO82Tcga3feCQQh11-esqjdQp0qTQgu67HmNGGDw7DA0_aWl00-58gsccxXfKq7WUab5Rjd6P6sxC1B8pq7Wu2mlL95fjrQpoFgu9TgHbRCdEETbtGermxHDjLX8-0xWgSH5XXk_KmbunhSiqOYdu42KX_cKNZTiT1AqWUuUNxSlJma408zti1yOn4z7Esc7-RBKOVfzF0JsUF7-Hv37LuTjhjw3zqmp4qDuG72RZdo9VFlvP3msZmkr-1HlywRCPlaajZD-cbsPZoSjrmXrwpht1egrtmyJYP70zlUeYpsRyInHDQ5N_ZFm00)\n\n## Contribute\n\nWant to help or have a suggestion? Open a [new ticket](https://github.com/eugene-manuilov/typeorm-uml/issues/new) and we can discuss it or submit a pull request.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugene-manuilov%2Ftypeorm-uml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feugene-manuilov%2Ftypeorm-uml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugene-manuilov%2Ftypeorm-uml/lists"}