{"id":13714813,"url":"https://github.com/samchon/prisma-markdown","last_synced_at":"2025-04-08T09:13:20.000Z","repository":{"id":194464121,"uuid":"690843257","full_name":"samchon/prisma-markdown","owner":"samchon","description":"Markdown generator of Prisma, including ERD and descriptions","archived":false,"fork":false,"pushed_at":"2024-06-05T04:55:12.000Z","size":452,"stargazers_count":489,"open_issues_count":2,"forks_count":26,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-02T16:51:02.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/samchon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["samchon"]}},"created_at":"2023-09-13T02:00:08.000Z","updated_at":"2025-04-02T14:56:40.000Z","dependencies_parsed_at":"2023-10-25T14:01:09.609Z","dependency_job_id":"ec460bdd-f025-47ff-a588-679a263cdb7c","html_url":"https://github.com/samchon/prisma-markdown","commit_stats":{"total_commits":42,"total_committers":5,"mean_commits":8.4,"dds":0.5,"last_synced_commit":"b60f128bdde4a59174d83e9039154a633f7bc95f"},"previous_names":["samchon/prisma-markdown"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Fprisma-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Fprisma-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Fprisma-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Fprisma-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samchon","download_url":"https://codeload.github.com/samchon/prisma-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694882,"owners_count":20980733,"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":[],"created_at":"2024-08-03T00:00:50.480Z","updated_at":"2025-04-08T09:13:19.975Z","avatar_url":"https://github.com/samchon.png","language":"TypeScript","funding_links":["https://github.com/sponsors/samchon"],"categories":[":safety_vest: Community Prisma Tools","TypeScript","Built with TypeScript"],"sub_categories":[":gear: Schema Visualization Tools","Libraries"],"readme":"# Prisma Markdown\n## Outline\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/prisma-markdown/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/prisma-markdown.svg)](https://www.npmjs.com/package/prisma-markdown)\n[![Downloads](https://img.shields.io/npm/dm/prisma-markdown.svg)](https://www.npmjs.com/package/prisma-markdown)\n[![Build Status](https://github.com/samchon/prisma-markdown/workflows/build/badge.svg)](https://github.com/samchon/prisma-markdown/actions?query=workflow%3Abuild)\n\nPrisma markdown documents generator.\n\n  - Mermaid ERD diagrams\n  - Descriptions by `///` comments\n  - Separations by `@namespace` comments\n\nIf you want to see how markdown document being generated, visit below examples:\n\n  - Markdown Content: [samchon/prisma-markdown/ERD.md](https://github.com/samchon/prisma-markdown/blob/master/ERD.md)\n  - Prisma Schema: [samchon/prisma-markdown/schema.prisma](https://github.com/samchon/prisma-markdown/blob/master/schema.prisma)\n\n[![Example Case](https://github-production-user-asset-6210df.s3.amazonaws.com/13158709/268175441-80ca9c8e-4c96-4deb-a8cb-674e9845ebf6.png)](https://github.com/samchon/prisma-markdown/blob/master/ERD.md)\n\n\n\n\n## Setup\nAt first, install NPM package.\n\n```bash\nnpm i -D prisma-markdown\n```\n\nAt next, add the generator to the schema file.\n\n```prisma\ngenerator markdown {\n  provider = \"prisma-markdown\"\n  output   = \"./ERD.md\"\n  title    = \"Shopping Mall\"\n}\n```\n\nAt last, run below command, than [ERD.md](https://github.com/samchon/prisma-markdown/blob/master/ERD.md) file would be generated.\n\n```bash\nnpx prisma generate\n```\n\n\n\n\n## Comment Tags\nIf your database has over hundreds of models, none of automatic ERD generators can express them perfect. In that case, `prisma-markdown` recommends you to separate hundreds of models to multiple paginated diagrams by using `/// @namespace \u003cname\u003e` comments.\n\nWhen you write `/// @namespace \u003cname\u003e` comment on models, they would be separated to proper sections of markdown document. For reference, you can assign multiple `@namespace`s to a model, and if you do not assign any `@namespace` to a model, it would be assigned to `default` tag.\n\nAlso, if you use `@erd \u003cname\u003e` instead of `@namespace \u003cname\u003e`, target model would be expressed only at ERD. It would not be appeared to the markdown content section. Otherwise, `@describe \u003cname\u003e` tag will show the model only at markdown content section, not at ERD.\n\n  - `@namespace \u003cname\u003e`: Both ERD and markdown content\n  - `@erd \u003cname\u003e`: Only ERD\n  - `@describe \u003cname\u003e`: Only markdown content\n  - `@hidden`: Neither ERD nor markdown content\n  - `@minItems 1`: Mandatory relationship when 1: **N** (`||---|{`)\n\n```prisma\n/// Both description and ERD on Actors chatper.\n///\n/// Also, only ERD on Articles and Orders chapters.\n///\n/// @namespace Actors\n/// @erd Articles\n/// @erd Orders\nmodel shopping_customers {\n  /// The tag \"minItems 1\" means mandatory relationship `||---|{`.\n  ///\n  /// Otherwise, no tag means optional relationship `||---o{`.\n  ///\n  /// @minItems 1\n  login_histories shopping_customer_login_histories[]\n}\n\n/// Only description on Actors chapter.\n///\n/// @describe Actors\nmodel shopping_customer_login_histories {}\n\n/// Only ERD on Articles chapter.\n///\n/// @erd Articles\nmodel shopping_sale_reviews {}\n\n/// Never be shown.\n///\n/// @hidden\nmodel shopping_sale_hits {}\n```\n\n![Mandatory Relationship](https://github.com/samchon/prisma-markdown/assets/13158709/b382cf64-5047-4a00-b77f-7c3427010090)\n\nAdditionally, when defining 1: N relationship, you can specify the N position to be whether optional or mandatory. If you want to configure the N position to be mandatory, just write the `@minItems 1` comment tag. Otherwise the N position is optional, you don't need to do anything.\n\n```prisma\nmodel shopping_sale_units {\n    /// @minItems 1\n    stocks shopping_sale_snapshot_unit_stocks[];\n    options shopping_sale_snapshot_unit_options[]; // optional\n}\nmodel shopping_sale_snapshot_unit_stocks {}\nmodel shopping_sale_snapshot_unit_options {}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchon%2Fprisma-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamchon%2Fprisma-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchon%2Fprisma-markdown/lists"}