Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leonardodalcin/mongo-auto-erd
Generates a .png ERD of a mongo database through a CLI
https://github.com/leonardodalcin/mongo-auto-erd
diagram entity erd generator mongo-auto-erd relationship
Last synced: about 1 month ago
JSON representation
Generates a .png ERD of a mongo database through a CLI
- Host: GitHub
- URL: https://github.com/leonardodalcin/mongo-auto-erd
- Owner: leonardodalcin
- License: mit
- Created: 2019-10-13T00:13:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T01:01:04.000Z (almost 2 years ago)
- Last Synced: 2024-09-27T17:40:54.495Z (about 2 months ago)
- Topics: diagram, entity, erd, generator, mongo-auto-erd, relationship
- Language: TypeScript
- Homepage:
- Size: 2.76 MB
- Stars: 19
- Watchers: 1
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Test Coverage](https://api.codeclimate.com/v1/badges/16064394f798d92ffc0f/test_coverage)](https://codeclimate.com/github/leonardodalcin/mongo-auto-erd/test_coverage)
# mongo-auto-erd
This is an Entity Relationship Diagram generator for MongoDB databases. Given a connection url, it performs reverse engineering by map reducing db collections into a well defined interface with properties and it's relationships.
## Caveats
This lib will only generate `.svg`, `.png` and `.dot` formats if `graphviz` is installed. Graphviz is a quasi
standart library to generate `graphs`, their creators proposed the `.dot` language for graph representations, I
opted to use
it because it is
compatible or
convertible to many graph editing platforms.If you don't want to use `graphviz`, the software will output a well defined ERD interface:
```typescript
export interface IEntity {
name: string
properties: IProperty[]
relationships: IRelationship[]
}export interface IProperty extends IMapReducedProperty {
types: IPropertyType[]
}export type IPropertyType =
| 'string'
| 'undefined'
| 'null'
| 'number'
| 'objectId'
| 'boolean'
| 'unknown'
| 'array'
| 'function'
| 'symbol'
| 'bigint'
| 'object'export interface IRelationship {
propertyNames: string[]
targetCollectionName: string
}export interface IMapReducedProperty {
name: string
values: any[]
}
```
[Example .json output](erd.json)## Usage
`mongo-erd --uri mongodb://127.0.0.1:27017 --db dbname --outfile ./erd`
This command will produce a result like
![Example .png diagram](erd.png)