{"id":26221478,"url":"https://github.com/reeceyang/convex-schema-mermaid","last_synced_at":"2025-04-17T05:21:57.665Z","repository":{"id":242171808,"uuid":"808876531","full_name":"reeceyang/convex-schema-mermaid","owner":"reeceyang","description":"Generate a Mermaid flowchart from a Convex schema","archived":false,"fork":false,"pushed_at":"2024-07-03T03:38:09.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T06:01:34.863Z","etag":null,"topics":["convex","mermaid"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/convex-schema-mermaid","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reeceyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-06-01T03:37:50.000Z","updated_at":"2025-01-15T21:57:46.000Z","dependencies_parsed_at":"2024-06-01T04:40:37.561Z","dependency_job_id":"24322dae-028b-4855-81b5-b1b61ed47a19","html_url":"https://github.com/reeceyang/convex-schema-mermaid","commit_stats":null,"previous_names":["reeceyang/convex-schema-mermaid"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reeceyang%2Fconvex-schema-mermaid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reeceyang%2Fconvex-schema-mermaid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reeceyang%2Fconvex-schema-mermaid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reeceyang%2Fconvex-schema-mermaid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reeceyang","download_url":"https://codeload.github.com/reeceyang/convex-schema-mermaid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968921,"owners_count":21191162,"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":["convex","mermaid"],"created_at":"2025-03-12T16:20:36.470Z","updated_at":"2025-04-17T05:21:57.648Z","avatar_url":"https://github.com/reeceyang.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# convex-schema-mermaid\n\nGenerate a Mermaid flowchart from a Convex schema\n\nInstall the package from NPM:\n\n```sh\nnpm i convex-schema-mermaid\n```\n\nImport the `schemaToMermaid` function and pass in your schema:\n\n```ts\nimport { schemaToMermaid } from \"convex-schema-mermaid\";\n\nconst schema = defineSchema({\n  messages: defineTable({\n    authorId: v.id(\"users\"),\n  }),\n  users: defineTable({\n    name: v.string(),\n    age: v.number(),\n    teamId: v.id(\"teams\"),\n  }),\n  teams: defineTable({\n    name: v.string(),\n  }),\n});\nconsole.log(schemaToMermaid(schema));\n\n// flowchart LR\n//   subgraph messages\n//     messages.authorId[authorId: id 'users']\n//   end\n//   subgraph users\n//     users.name[name: string]\n//     users.age[age: number]\n//     users.teamId[teamId: id 'teams']\n//   end\n//   subgraph teams\n//     teams.name[name: string]\n//   end\n//   messages.authorId--\u003eusers\n//   users.teamId--\u003eteams\n```\n\nTo use with your Convex project, you can place the `console.log(schemaToMermaid(schema))` inside a Convex function and then run that function from the Convex dashboard.\n\nYou can also run this one-liner from the root directory of your project, which will bundle and run your schema with a script to print the mermaid output:\n\n```sh\necho \"import s from './convex/schema';import {schemaToMermaid} from 'convex-schema-mermaid';console.log(schemaToMermaid(s))\" | npx esbuild --bundle | node\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freeceyang%2Fconvex-schema-mermaid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freeceyang%2Fconvex-schema-mermaid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freeceyang%2Fconvex-schema-mermaid/lists"}