Markdymarkdydocs
Developer Reference
Active & CanonicalVersion v1.0.25Spec 1.0.xUpdated August 2026

Markdy Documentation

Markdy is a diagram-native DSL for creating animated architecture diagrams from reviewable, version-controlled plain text. Markdy compiles declarations into fluid Web Animations API motion without canvas overhead or manual coordinate math.

60-Second Quickstart

Install the Markdy CLI, create your first .markdy scene, and compile it to an interactive HTML preview:

Terminal
# 1. Install Markdy CLI globally (or run with npx)
npm install -g @markdy/cli

# 2. Render and open your animated architecture diagram in the browser
markdy render architecture.markdy --open

Here is a complete, runnable architecture.markdy scene:

architecture.markdy
scene theme=paper layout=LR

client WebBrowser "Client App"
gateway ApiGateway "API Gateway"
cache RedisCluster "Redis Cache"
database PostgresDB "PostgreSQL (Master)"

group caching: RedisCluster
group persistence: PostgresDB

beat setup "Initial System Reveal":
  show $nodes stagger=60ms

beat flow "Cache Lookup & Fallback":
  WebBrowser -> ApiGateway "GET /product/42"
  ApiGateway -> RedisCluster "1. Check Cache (MISS)"
  ApiGateway -> PostgresDB "2. Query Database"
  ApiGateway -> RedisCluster "3. Populate Cache"
  WebBrowser <- ApiGateway "200 OK (JSON)"

Core Philosophy

Markdy is diagram-native: MarkdyScript isn't a config format bolted onto a chart library — it's a small DSL purpose-built for describing systems, and every part of the toolchain treats it as a first-class language:

  • Diagrams as code. A scene is plain text, so it lives in your repo, reviews in a pull request, and diffs like any other source file — no binary design-tool exports to go stale.
  • Parsing is separate from rendering. @markdy/core compiles MarkdyScript into a render plan (positioned nodes, routed edges, timed cues); @markdy/renderer-dom turns that plan into DOM and SVG. Anything that can consume the render plan can become a renderer.
  • Motion, not just layout. Diagrams are told through beats — discrete timeline steps — driven by the browser's native Web Animations API, so playback is seekable and scrubbable instead of a single static export.
  • Semantic nodes over generic boxes. Declaring a node's kind (service, database, queue, ...) carries meaning the renderer uses for styling and iconography, instead of hand-picking shapes and colors per node.

Scene Declaration

Every Markdy script starts with an optional scene header declaring canvas metadata, visual theme, and reading direction:

Scene Header Syntax
scene theme=paper layout=LR width=1280 height=720
PropertyOptions / FormatDefaultDescription
themepaper, editorial, terminal, sketchy, blueprint, midnight, graphite, nebulapaperVisual presentation theme tailored for publication and documentation.
layoutLR (Left to Right), TB (Top to Bottom), RL, BTLRPrimary topological flow direction for the automated DAG router.
typearchitecture, flowchart, tree, sequence, state, layers, nested, swimlane, timeline, gantt, medallion, flywheel, constellation, quadrant, pyramid, radar, vennarchitectureSpecialized layout engine tailoring node placement and edge routing.
width / heightAuto (content-adaptive default) or pixel numbers (e.g. width=1600 height=900)AutoVirtual canvas viewport dimensions; automatically calculates optimal aspect ratio and bounds based on diagram items and topology when omitted.

Semantic Node Kinds

Markdy uses semantic node declarations. Rather than generic boxes, each node kind automatically receives domain-specific styling, iconography, and rendering metadata:

KindIconDescriptionSyntax Example
user👤End users, mobile apps, or human actors initiating requestsuser Customer "Mobile User"
client💻Frontends, SPAs, web browsers, or client runtimesclient WebApp "Next.js WebApp"
gateway🌐API Gateways, reverse proxies, ingress, or load balancersgateway ApiGateway "Kong / Envoy"
service⚙️Microservices, backend applications, gRPC daemonsservice AuthService "Auth & Sessions"
database🗄️Relational DBs, document stores, primary persistencedatabase Postgres "PostgreSQL 16"
cacheIn-memory stores, Redis clusters, Memcached instancescache Redis "Redis Cluster"
queue📬Message brokers, Kafka event streams, SQS/RabbitMQqueue EventBus "Kafka Event Stream"
worker👷Background job processors, async consumers, cron runnersworker VideoWorker "Transcoder Worker"
storage📦Object storage buckets, S3, blob storage, volume mountsstorage S3Bucket "Asset S3 Bucket"
cdn🌍Global edge CDNs, Cloudflare, Fastly edge pointscdn Cloudflare "Cloudflare Edge"
firewall🛡️WAFs, security filters, rate limiters, DMZ shieldsfirewall CloudWAF "AWS WAF Shield"
lambdaλServerless functions, edge compute, ephemeral handlerslambda ImageResize "Edge Worker"
pod📦Kubernetes pods, container instances, daemon setspod OrderPod "order-pod-v2"

Groups & Subsystem Boundaries

Declare logical architectural boundaries, network VPCs, Kubernetes namespaces, or cluster tiers using the group keyword:

Subsystem Groups
# Syntax: group <group_id> [label="Display Title"]: <node1> <node2> ...
group ingress "Public Ingress Tier": WebClient ApiGateway
group storage "Data Persistence": RedisCluster PostgresDB

Flow Operators & Routing

Markdy provides 6 expressive flow operators to distinguish synchronous requests, asynchronous event streams, and streaming data pipes:

OperatorNameBehaviorExample
->Sync RequestDirect synchronous RPC, HTTP call, or method invocation with moving payload particleClient -> Gateway "POST /order"
<-Sync ResponseSynchronous return value, ACK response, or status code flowing backwardClient <- Gateway "201 Created"
<->BidirectionalFull-duplex WebSocket connection, socket streaming, or sync handshakeBrowser <-> SocketServer "ws:// live"
~>Async EventNon-blocking message pub/sub, webhook trigger, or distributed queue emissionGateway ~> EventBus "order.placed"
==>Data PipeHigh-throughput bulk data stream, ETL pipeline, or database replicationPrimaryDB ==> ReplicaDB "WAL stream"
-.->Dotted / ProbeHeartbeat ping, liveness check, telemetry beacon, or weak referenceMonitor -.-> Service "health check"

Multi-Hop Chaining

Chain multi-stage operations cleanly on a single line:

Multi-Hop Chaining
WebApp -> ApiGateway "POST /checkout" -> PaymentWorker "charge" -> PostgresDB "save"

Timeline Beats & Motion Choreography

Markdy diagrams are animated through discrete beats. Each beat represents a step in a walkthrough, story, or lifecycle:

Cue DirectiveDescriptionExample
show $nodesProgressively reveals all declared nodes with timed stagger animationshow $nodes stagger=60ms
show <group>Reveals specific boundary groups or clustered subsystem componentsshow ingress stagger=40ms & show persistence
frame <target>Directs camera attention and smooth pan/zoom to a group or nodeframe storage zoom=1.15
pulse <target>Highlights node with a luminous phosphorescent beacon ringpulse Redis color=accent count=2
dim <target>Fades non-active components to 25% opacity to emphasize current flowdim Auth WebApp
& (parallel)Executes multiple cues or concurrent network flows at the same instantApp -> Cache "get" & App -> Db "log"

Universal Ingestion & 1-Click Migration

Convert existing static architecture files directly into animated MarkdyScript using @markdy/compat:

Mermaid.js (Flowcharts & Sequences)

Converts graph TD/LR and sequence diagrams to MarkdyScript.

markdy import flow.mmd --out flow.markdy

Docker Compose

Extracts services, network links, volumes, and ports into clustered scenes.

markdy import docker-compose.yml

Kubernetes YAML

Maps Ingress, Service, Deployment, Pod, and PVC tiers into nested groups.

markdy import k8s-manifest.yaml

Terraform State

Extracts cloud VPCs, subnets, databases, and gateways into layered architectures.

markdy import terraform.tfstate

AI Coding Agents & Official MCP Server

Connect Claude Desktop, Cursor, Antigravity, or any LLM agent to the official Model Context Protocol server:

Claude Desktop / Cursor MCP Config
{
  "mcpServers": {
    "markdy": {
      "command": "npx",
      "args": ["-y", "@markdy/mcp-server"]
    }
  }
}

AI agents can access markdy.com/AGENT.md and call validate_markdy_script to test and self-heal diagrams during generation.

Architecture Governance & CI/CD Linter

Integrate automated Well-Architected governance checks in your continuous integration pipeline:

Rule IDSeverityEnforcement Rule
no-circular-dependenciesBLOCKINGFlags synchronous request cycles (A -> B -> C -> A) that risk cascade deadlocks.
strict-layer-boundariesERROREnforces architectural tiers (e.g. Clients cannot bypass API Gateways to talk to DBs).
isolated-node-warningWARNINGIdentifies orphaned microservices or unlinked database instances lacking connections.
semantic-diff-evolutionPR AUDITProduces GitHub Markdown change summaries and migration tables for pull requests.

Framework Integrations: JavaScript, Astro, MDX & React

Vanilla JavaScript

import { createDiagram } from "@markdy/renderer-dom";

const diagram = createDiagram({
  container: document.getElementById("scene"),
  code: sceneCode,
});

diagram.play();

Astro Integration

import { Markdy } from "@markdy/astro";

<Markdy code={sceneCode} autoplay />

MDX Documentation

```markdy
scene theme=paper
client Browser -> service Api -> database DB
```

Ecosystem Package Directory

@markdy/coreZero-dep tokenizer, AST parser, semantic diffing, classifier, and linter.
@markdy/renderer-domWAAPI motion runtime, zero-dep GIF89a encoder, and SVG vector exporter.
@markdy/compatUniversal transpilers for Mermaid, Draw.io, Docker Compose, K8s, and Terraform.
@markdy/cliCLI for rendering, formatting, linting, importing, and batch validating scenes.
@markdy/mcp-serverOfficial Model Context Protocol server for Claude, Cursor, and AI agents.
@markdy/astroLazy-loaded Astro component for documentation sites and blogs.