Skip to main content

A package for generating architecture diagrams using PlantUML, diagrams, and Mermaid.

Project description

A Docker container for generating system design diagrams using PlantUML and the diagrams library.

https://img.shields.io/badge/Docker-Ready-blue.svg https://img.shields.io/badge/license-MIT-green.svg https://github.com/aydabd/sys-design-diagram/actions/workflows/ci.yml/badge.svg PyPI Version Docker Pulls

Overview

System Design Diagram is a container & Python CLI that generates diagrams from:

  • PlantUML (*.puml)

  • Python diagrams library modules (*.py)

  • Mermaid (*.mmd)

It targets automation workflows (CI/CD, docs pipelines) while staying simple for local use.

Features

  • PlantUML rendering (using system plantuml + Graphviz)

  • Mermaid rendering via @mermaid-js/mermaid-cli (Chromium bundled & sandbox-configured)

  • Python diagrams library support

  • Unified multi-run command: process-all

  • Async processing with per-file task fan-out

  • Graceful fallback placeholders for Mermaid if headless browser fails unexpectedly

  • Opinionated defaults + environment variable overrides

Installation

To use the Docker container, pull it from the GitHub Container Registry or docker hub:

docker pull ghcr.io/aydabd/sys-design-diagram:latest
docker pull aydabd/sys-design-diagram:latest

Make sure you have Docker installed and running on your system.

Usage

The entrypoint is sys-design-diagram. Subcommands:

  • plantuml – Generate diagrams from PlantUML files

  • diagrams – Generate diagrams with the diagrams library

  • mermaid – Generate diagrams from Mermaid files

  • process-all – Run all of the above (recommended for batch pipelines)

Global option:

  • -v / --verbose – more logging (including per-task timings)

Defaults & Resolution Order

Design & output directories are resolved in this order (per flag):

  1. CLI option (-d / -o)

  2. Environment variable (SDD_DESIGNS_DIR / SDD_OUTPUT_DIR)

  3. Conventional path: ./designs (if it exists) for designs; ./sys-design-diagram-output for output (created on demand)

Inside official Docker images, you typically mount:

  • /designs – input (read-only recommended)

  • /output – generated diagrams

Environment Variables

Core overrides:

  • SDD_DESIGNS_DIR – override designs path

  • SDD_OUTPUT_DIR – override output path

Mermaid / Puppeteer tuning:

  • MERMAID_PUPPETEER_CONFIG – path to injected Puppeteer JSON (set by image to /opt/puppeteer-config.json adding --no-sandbox etc.)

  • SDD_MERMAID_EXTRA_ARGS – extra raw arguments appended to mmdc (e.g. --scale 1.2 --theme dark)

Note: If Chromium launch fails (sandbox / missing dependency) a placeholder PNG containing the original Mermaid source is written so pipelines stay green.

Quick Start (Docker)

Create a local directory with your design sources (.puml, .mmd, Python diagrams):

tree my-designs/
my-designs/
  plantuml1.puml
  sequence.mmd
  infra.py

Run all processors (preferred):

docker run --rm -v "$PWD/my-designs:/designs:ro" -v "$PWD/out:/output" ghcr.io/aydabd/sys-design-diagram:latest process-all

Run only PlantUML:

docker run --rm -v "$PWD/my-designs:/designs:ro" -v "$PWD/out:/output" ghcr.io/aydabd/sys-design-diagram:latest plantuml

Override paths with env vars (custom layout):

docker run --rm \
    -e SDD_DESIGNS_DIR=/work/src/designs \
    -e SDD_OUTPUT_DIR=/work/build/diagrams \
    -v "$PWD/my-designs:/work/src/designs:ro" \
    -v "$PWD/out:/work/build/diagrams" \
    ghcr.io/aydabd/sys-design-diagram:latest process-all

Verbose mode:

docker run --rm -v "$PWD/my-designs:/designs:ro" -v "$PWD/out:/output" ghcr.io/aydabd/sys-design-diagram:latest -v process-all

Using docker compose (see compose.yaml):

Compose services provided:

  • sdd-process-all - runs all processors on test data

  • sdd-plantuml - PlantUML only

  • sdd-diagrams - diagrams library only

  • sdd-mermaids - Mermaid only (local build variant)

  • sdd-build-locally - builds from workspace sources then process-all

Example (rebuild & run everything detached):

docker compose up --build -d sdd-process-all
# or just Mermaid
docker compose up --build sdd-mermaids

Outputs land in the corresponding subdirectories under ./sdd-outputs or ./sdd-local-outputs as defined in the compose file.

Mermaid Rendering Notes

Chromium + mermaid-cli are bundled. A Puppeteer config (/opt/puppeteer-config.json) adds sandbox‑relaxing flags suitable for rootless containers. If you operate in a hardened environment and can enable the system Chromium sandbox (setuid / userns), you may build a derivative image removing --no-sandbox flags.

To append more Mermaid CLI arguments (e.g. scaling, theme):

docker run --rm -e SDD_MERMAID_EXTRA_ARGS="--scale 1.5 --theme dark" \
    -v "$PWD/my-designs:/designs:ro" -v "$PWD/out:/output" ghcr.io/aydabd/sys-design-diagram:latest mermaid

If rendering fails due to a transient headless issue, a placeholder file is created instead of failing the whole run.

Development

To contribute to the development of this project, follow these steps:

  1. Clone the repository

  2. for linux users, install mamba-githook [mamba-githook](https://github.com/aydabd/mamba-githook?tab=readme-ov-file#installation)

  3. Initiate mamba-githook, check the installation link above

  4. Create a new branch (e.g. git checkout -b feature)

  5. Make your changes

  6. Commit your changes (e.g. git commit -am ‘Add new feature’)

  7. Push to the branch (e.g. git push origin feature)

  8. Create a new Pull Request

Testing

Pre-commit hooks are used to run tests before each commit. To run the tests manually, use the following command:

# Create a virtual environment
python -m venv .venv
pip install hatch
# Run the tests
hatch run test:all
# For formatting
hatch fmt

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Contact

For any questions or suggestions, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sys_design_diagram-2.0.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sys_design_diagram-2.0.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file sys_design_diagram-2.0.0.tar.gz.

File metadata

  • Download URL: sys_design_diagram-2.0.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sys_design_diagram-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e971648d19b0dd3343899a4e2665bc32865344b6d8a6515a730ae1b529b54591
MD5 b9858f70e38ccca05f111c4aed3fdc74
BLAKE2b-256 af919573bd84f2390f02ec97bb41e63013d1a836d7c8de243d7d1b1bb30c5d5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sys_design_diagram-2.0.0.tar.gz:

Publisher: pypi-release.yml on aydabd/sys-design-diagram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sys_design_diagram-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sys_design_diagram-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 281b02b3666ab1dd0bcace8f20a09ea35c4a685f813eb442ea63abd4d2d5ff7d
MD5 cc3c92a674ea2212970b54ca0b82509c
BLAKE2b-256 19486c516994157d7d45f01ed84147ca72755b0d1a2659c604381fa145467c04

See more details on using hashes here.

Provenance

The following attestation bundles were made for sys_design_diagram-2.0.0-py3-none-any.whl:

Publisher: pypi-release.yml on aydabd/sys-design-diagram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page