# Quick Start

> Install aidiagram (Python) or aidiagram-js (npm) and build your first interactive diagram in 60 seconds.

Follow the track for your stack — each takes less than a minute.

## Track A: Python CLI & Offline HTML (`aidiagram`)

1. **Install `aidiagram`:**
   ```bash
   python -m pip install aidiagram
   ```
2. **Save a Mermaid file** as `workflow.mmd`:
   ```mermaid
   flowchart LR
     A[Open pull request] --> B[Review changes]
     B --> C[Maintainer decides whether to merge]
   ```
3. **Export to a standalone offline HTML file:**
   ```bash
   aidiagram html workflow.mmd --out workflow.html
   ```
4. **Open `workflow.html`** in your browser. It runs over `file://` with zero network requests and includes an accessible Apache-2.0 license footer.

### Python API

```python
from aidiagram import write_interactive_html, render_interactive_html

# Write directly to disk
write_interactive_html("workflow.mmd", "workflow.html", theme="dark", accent="amber")

# Or get the HTML string in memory
html = render_interactive_html("flowchart LR\n  A <--> B\n", theme="light", accent="indigo")
```

## Track B: HTML Web Component (`aidiagram-js`)

1. **Install `aidiagram-js`:**
   ```bash
   npm install aidiagram-js
   ```
2. **Import once and render `<praisonai-diagram>`:**
   ```html
   <script type="module">
     import 'aidiagram-js'
   </script>

   <praisonai-diagram theme="auto" accent="amber">
   flowchart LR
     A[Open pull request] --> B[Review changes]
     B --> C[Maintainer decides whether to merge]
   </praisonai-diagram>
   ```
3. **Interact with it:** click any card to inspect, press **Play** or `←`/`→` to step through, drag the canvas to pan, or click **SVG** / **PNG** to export.

## Track C: Programmatic JavaScript / TypeScript

1. **Parse and compile any Mermaid, YAML, or JSON input:**
   ```ts
   import { parseDiagramSpec, compileDiagram, sceneToSvg } from 'aidiagram-js'

   const parsed = parseDiagramSpec(`
   type: flow
   label: Three-step release flow.
   numbered: true
   steps:
     - { title: Build, note: "Bundle assets" }
     - { title: Test, note: "Run checks", highlight: true }
     - { title: Release, note: "Publish packages" }
   `)

   if (parsed.ok) {
     const scene = compileDiagram(parsed.spec)
     const darkSvg = sceneToSvg(scene, 'dark')
     const lightSvg = sceneToSvg(scene, 'light')
   }
   ```

## Live Example

Try stepping through this exact quick-start diagram right here:

```diagram
type: flow
label: Three-step release flow.
eyebrow: Quick Start
numbered: true
steps:
  - title: Build
    note: "Bundle assets"
    description: "Compiles Mermaid or YAML into a typed scene graph."
    code: "aidiagram html workflow.mmd --out workflow.html"
  - title: Test
    note: "Run checks"
    description: "Validates semantic fidelity with zero silent loss."
    highlight: true
  - title: Release
    note: "Publish packages"
    description: "Share offline HTML, animated SVGs, or interactive docs."
```

## Related pages

- [Python CLI & API](https://diagram.praison.ai/docs/guides/python-cli.md)
- [Web Component & Plugins](https://diagram.praison.ai/docs/guides/web-component.md)
- [PraisonAIUI Integration](https://diagram.praison.ai/docs/guides/praisonaiui.md)
