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.2.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.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sys_design_diagram-2.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 35ff1b1302a81c55f2388f388d07a8e02af5290a6b0236c1256f3c8fa6ad781f
MD5 1b31da752741009d2861d218088b25fb
BLAKE2b-256 d63286cba5056e4825ba825c0b205277fb1f1a4a897fbf72cdd828bea4e13e1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sys_design_diagram-2.0.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sys_design_diagram-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 19feeaf13b3b5ca61d98020a401d17cd672e3e3837e058074bf915c0256e1727
MD5 426e9c361056f92c61bab309a97b39a9
BLAKE2b-256 d5c93968f0ddba7499e4bd837e6aeac7049e25e4b928f89c5c60c1e5f395d0f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sys_design_diagram-2.0.2-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