A Dockerized service that generates Mermaid diagrams via URL requests.
- Docker Desktop for Windows 10 or Docker for Linux
- Internet connection for pulling Docker images
You can set up and run the Mermaid service with a single command in PowerShell:
irm "https://raw.githubusercontent.com/fionatony/mermaid/main/start.ps1" | iex
This script will:
- Check if Docker is running
- Clone the repository
- Build the Docker image
- Start the container
- Open your default browser with a sample diagram
You can set up and run the Mermaid service with a single command in bash:
curl -sSL "https://raw.githubusercontent.com/fionatony/mermaid/main/start.sh" | bash
This script will:
- Check if Docker is running
- Clone the repository
- Build the Docker image
- Start the container
- Open your default browser with a sample diagram
- Clone the Mermaid repository:
git clone https://github.com/fionatony/mermaid
- Navigate into the mermaid directory:
cd mermaid
- Build the Docker image:
docker build -t mermaid-service .
- Run the container:
docker run -d -p 7777:7777 --name mermaid-container mermaid-service
- Verify the container is running: To check if the container is up and running, use:
docker ps
- Access the Mermaid Server Open your browser and navigate to the following URL:
http://localhost:7777/render?code=graph TD; A-->B; A-->C; B-->D; C-->D;
This will render a simple Mermaid diagram. You can modify the code parameter to render different diagrams.
Generate a diagram by sending a GET request to:
http://localhost:7777/render?code=YOUR_MERMAID_CODE_HERE
Example URL:
http://localhost:7777/render?code=graph TD; A-->B; A-->C; B-->D; C-->D;
By default, diagrams are rendered as PNG images. You can specify the output format using the format
parameter:
http://localhost:7777/render?code=YOUR_MERMAID_CODE_HERE&format=svg
Supported formats:
png
(default)svg
You can specify custom dimensions for your diagrams using the width
and height
parameters:
http://localhost:7777/render?code=YOUR_MERMAID_CODE_HERE&width=800&height=600
Both parameters are optional. You can specify either width, height, or both.
Generate an SVG diagram with custom dimensions:
http://localhost:7777/render?code=graph TD; A[Start]-->B{Process}; B-->C[End];&format=svg&width=800&height=600
The repository includes several example diagrams in the samples
directory that demonstrate the capabilities of the service:
-
Digital Economy Evolution - A graph showing the evolution of digital economy models
- Mermaid:
samples/digital_economy.mmd
- Example URL:
http://localhost:7777/render?code=graph LR; A[Digital Economy Evolution] --> B[Traditional Digital: No Natural Limits]; A --> C[Energy-Backed AI: Natural Constraints]; B --> D[Winner-Take-All Outcomes]; C --> E[Ecological Balance]; E --> F[Specialized Providers]; E --> G[Domain-Specific Models]; E --> H[Local Optimization]; style B fill:#ffcccc; style C fill:#ccffcc; style D fill:#ffdddd; style E fill:#ddffdd
- Mermaid:
-
Business Models Comparison - A flowchart comparing traditional and AI-driven business models
- Mermaid:
samples/business_models.mmd
- Example URL:
http://localhost:7777/render?code=flowchart TD; subgraph "Traditional Digital Business Model"; A[Free Services] --> B[User Data Collection]; B --> C[Behavioral Targeting]; C --> D[Advertising Revenue]; D --> E[Platform Monopoly]; end; subgraph "AI-Driven Business Model"; F[Energy-Backed Services] --> G[Direct Value Pricing]; G --> H[Transparent Exchange]; H --> I[Distributed Value Capture]; end; style A fill:#ffeeee; style F fill:#eeffee; style E fill:#ffcccc; style I fill:#ccffcc
- Mermaid:
-
Hardware Evolution Timeline - A timeline showing the evolution of hardware for AI
- Mermaid:
samples/hardware_evolution.mmd
- Example URL:
http://localhost:7777/render?code=timeline%0A%20%20%20%20title%20Hardware%20Evolution%20for%20AI%0A%20%20%20%201990-2000%20%3A%20CPU%20Era%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%20Limited%20Parallelism%0A%20%20%20%202007%20%3A%20NVIDIA%20CUDA%0A%20%20%20%20%20%20%20%20%20%3A%20GPU%20Computing%20Unlocked%0A%20%20%20%202015-2020%20%3A%20TPU%20Development%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%20AI-Specific%20Hardware%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%20100%2B%20petaFLOPS%0A%20%20%20%202020%2B%20%3A%20Specialized%20AI%20Chips%0A%20%20%20%20%20%20%20%20%20%20%3A%20Neuromorphic%20Computing
- Mermaid:
You can use these examples as templates for your own diagrams.
GET /render?code=<mermaid-code>
: Generates and returns a diagram image (PNG by default)- Optional parameters:
format=svg
: Output in SVG format instead of PNGwidth=<pixels>
: Specify the width of the output imageheight=<pixels>
: Specify the height of the output image
- Optional parameters:
GET /health
: Health check endpoint
- Stop the container:
docker stop mermaid-container
- Remove the container:
docker rm mermaid-container
If you encounter any issues:
- Check if the container is running:
docker ps
- View container logs:
docker logs mermaid-container
- The service runs on port 7777
- Temporary files are automatically cleaned up after each request
- CORS is enabled for all origins