{"id":50757642,"url":"https://github.com/yumin-chen/drift","last_synced_at":"2026-06-11T06:32:13.351Z","repository":{"id":327823696,"uuid":"1110719796","full_name":"yumin-chen/drift","owner":"yumin-chen","description":"Drift is a lightweight, deterministic, and fully self-hosted diagram tool designed for flowcharts. Inspired by Mermaid’s flowchart syntax but powered by the D2 DSL, Drift brings fast, reproducible diagram rendering to CLI and web environments","archived":false,"fork":false,"pushed_at":"2025-12-06T01:06:41.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"feat/bootstrap-drift-repository","last_synced_at":"2025-12-09T15:50:33.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/yumin-chen.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-05T16:05:36.000Z","updated_at":"2025-12-05T17:51:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yumin-chen/drift","commit_stats":null,"previous_names":["yumin-chen/drift"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/yumin-chen/drift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fdrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fdrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fdrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fdrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yumin-chen","download_url":"https://codeload.github.com/yumin-chen/drift/tar.gz/refs/heads/feat/bootstrap-drift-repository","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yumin-chen%2Fdrift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34186385,"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-11T02:00:06.485Z","response_time":57,"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":[],"created_at":"2026-06-11T06:32:12.642Z","updated_at":"2026-06-11T06:32:13.346Z","avatar_url":"https://github.com/yumin-chen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drift\n\n**Tagline:** Deterministic, Air-Gap-Ready Flowcharts-as-Code\n\nDrift is a powerful engine that transforms D2 and Mermaid flowchart definitions into beautiful, consistent SVG diagrams. Designed for security-conscious environments, Drift is fully air-gapped, requiring no network access at build time. It offers both a command-line interface (CLI) for local use and a WebAssembly (WASM) module for seamless browser integration.\n\n**NOTE:** Due to limitations in the current environment, the D2 dependency has not been vendored. To make this project fully air-gap ready, you will need to manually vendor the D2 source code into the `third_party/d2` directory.\n\n## Key Features\n\n-   **Deterministic Rendering:** Get the exact same SVG every time from a given input.\n-   **Air-Gap Ready:** All dependencies are vendored, and no network calls are made during builds.\n-   **Mermaid Compatibility:** Parse Mermaid flowchart syntax (`graph TD/LR/BT/RL`) and render it as a D2 diagram.\n-   **Dynamic Layout Engine:** Choose between DAGRE, TALA, or ELK layout engines at runtime for optimal diagram rendering.\n-   **CLI \u0026 WASM Support:** Use Drift locally from your terminal or integrate it directly into your web applications.\n-   **Open Source:** MIT Licensed and community-driven.\n\n## Usage\n\n### CLI\n\nTo render a local diagram file:\n\n```bash\ndrift render my-diagram.d2 --output my-diagram.svg\ndrift render my-flowchart.mermaid --output my-flowchart.svg --engine ELK\n```\n\n### Browser (WASM)\n\n```javascript\nimport drift from 'drift-wasm';\n\nconst mermaidSyntax = `\ngraph TD;\n    A--\u003eB;\n    A--\u003eC;\n    B--\u003eD;\n    C--\u003eD;\n`;\n\nconst svgOutput = drift.render(mermaidSyntax);\ndocument.getElementById('diagram-container').innerHTML = svgOutput;\n```\n\n## Architecture\n\nDrift's architecture is designed for simplicity and modularity. The core components include:\n\n-   **Preprocessor:** A parser that converts Mermaid syntax into a D2 Abstract Syntax Tree (AST).\n-   **Renderer:** A module that takes a D2 AST, selects a layout engine, and generates an SVG.\n-   **CLI:** A command-line interface for rendering diagrams from local files.\n-   **WASM:** A WebAssembly module that exposes Drift's rendering capabilities to the browser.\n\n![Drift Architecture](docs/architecture.svg)\n\n## Directory Structure\n\n```\ndrift/\n├── LICENSE\n├── README.md\n├── go.mod\n├── go.sum\n├── third_party/d2/\n├── cmd/drift/main.go\n├── pkg/preprocessor/parser.go\n├── pkg/renderer/renderer.go\n├── wasm/drift_wasm.go\n├── wasm/build.sh\n└── docs/\n    ├── architecture.d2\n    └── architecture.svg\n```\n\n## Architecture Decision Records (ADRs)\n\n-   [ADR-0001: Air-Gap Readiness](./docs/0001-air-gap.md)\n-   [ADR-0002: Dynamic Layout Engine Selection](./docs/0002-dynamic-layout-engine.md)\n-   [ADR-0003: Mermaid Compatibility Strategy](./docs/0003-mermaid-compatibility.md)\n-   [ADR-0004: Browser and WASM Support](./docs/0004-browser-wasm.md)\n-   [ADR-0005: Timeline-Aware Diagrams (Future)](./docs/0005-timeline-awareness.md)\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyumin-chen%2Fdrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyumin-chen%2Fdrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyumin-chen%2Fdrift/lists"}