{"id":50683002,"url":"https://github.com/de-otio/diagram-drc","last_synced_at":"2026-06-08T20:30:29.773Z","repository":{"id":350492350,"uuid":"1206696247","full_name":"de-otio/diagram-drc","owner":"de-otio","description":"Design Rule Check engine for auto-generated diagrams — crossing minimization, spacing, label overlap detection and auto-fix","archived":false,"fork":false,"pushed_at":"2026-04-10T15:02:56.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-10T17:06:38.322Z","etag":null,"topics":["dagre","design-rule-check","diagram","drawio","drc","graph","layout","mxgraph","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/de-otio/diagram-drc#readme","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/de-otio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-10T06:58:56.000Z","updated_at":"2026-04-10T15:02:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/de-otio/diagram-drc","commit_stats":null,"previous_names":["de-otio/diagram-drc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/de-otio/diagram-drc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-otio%2Fdiagram-drc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-otio%2Fdiagram-drc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-otio%2Fdiagram-drc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-otio%2Fdiagram-drc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/de-otio","download_url":"https://codeload.github.com/de-otio/diagram-drc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-otio%2Fdiagram-drc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34080025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dagre","design-rule-check","diagram","drawio","drc","graph","layout","mxgraph","typescript"],"created_at":"2026-06-08T20:30:26.778Z","updated_at":"2026-06-08T20:30:29.768Z","avatar_url":"https://github.com/de-otio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diagram-drc\n\nDesign Rule Check engine for auto-generated diagrams.\n\nJust as IC layout tools run DRC to catch spacing violations and routing issues in silicon, `diagram-drc` runs quality checks on graph layouts and can auto-fix violations.\n\n## Features\n\n- **Check mode** — detect layout quality issues without modifying the diagram\n- **Fix mode** — automatically resolve violations (crossing minimization, spacing, etc.)\n- **Pluggable rules** — built-in rules for common issues, easy to add your own\n- **Format-agnostic core** — works with any graph representation\n- **draw.io renderer** — render layouts to mxGraph XML (draw.io format)\n- **Dagre layout** — built-in wrapper for the Dagre directed graph layout engine\n\n## Quick start\n\n```bash\nnpm install diagram-drc\n```\n\n```typescript\nimport { createEngine, builtinRules, dagreLayout, renderMxGraph } from 'diagram-drc';\n\n// Define your graph\nconst spec = {\n  nodes: [\n    { id: 'a', label: 'Service A', width: 48, height: 48 },\n    { id: 'b', label: 'Service B', width: 48, height: 48 },\n    { id: 'c', label: 'Database',  width: 48, height: 48 },\n  ],\n  edges: [\n    { id: 'e1', source: 'a', target: 'c' },\n    { id: 'e2', source: 'b', target: 'c' },\n  ],\n  groups: [\n    { id: 'g1', label: 'Backend', children: ['a', 'b'] },\n    { id: 'g2', label: 'Data',    children: ['c'] },\n  ],\n};\n\n// Layout with Dagre\nconst layout = dagreLayout(spec);\n\n// Run DRC — check for issues\nconst engine = createEngine({ rules: builtinRules() });\nconst report = engine.check(layout, spec);\nconsole.log(report.passed ? 'All checks passed' : `${report.violations.length} violation(s)`);\n\n// Or fix issues automatically\nconst { layout: fixed, report: fixReport } = engine.fix(layout, spec);\n\n// Render to draw.io\nconst xml = renderMxGraph(fixed, spec, { title: 'Architecture' });\n```\n\n## Built-in rules\n\n| Rule | Description |\n|------|-------------|\n| `crossing-minimization` | Reorders sibling nodes within groups to minimize edge crossings |\n| `spacing` | Ensures minimum distance between node bounding boxes |\n\n## Writing custom rules\n\n```typescript\nimport type { LayoutRule, LayoutResult, GraphSpec, Violation } from 'diagram-drc';\n\nconst myRule: LayoutRule = {\n  id: 'my-custom-rule',\n  description: 'Check something specific to my diagrams',\n  severity: 'warning',\n  check(layout, spec) {\n    // Return violations found\n    return [];\n  },\n  fix(layout, spec) {\n    // Return corrected layout\n    return layout;\n  },\n};\n\nengine.addRule(myRule);\n```\n\n## API\n\n### Engine\n\n- `createEngine(options?)` — create a DRC engine\n- `engine.check(layout, spec)` — detect violations (read-only)\n- `engine.fix(layout, spec)` — fix violations and report remaining issues\n- `engine.addRule(rule)` — add a rule (chainable)\n\n### Layout\n\n- `dagreLayout(spec, options?)` — run Dagre layout on a graph\n\n### Render\n\n- `renderMxGraph(layout, spec, options?)` — render to draw.io mxGraph XML\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-otio%2Fdiagram-drc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fde-otio%2Fdiagram-drc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-otio%2Fdiagram-drc/lists"}