This repository contains the source code for the Diagrams API, which is a web service that allows users to compile diagrams programmatically via mermaid and plantuml. The API is designed to be simple and efficient, providing endpoints for generating diagrams in various formats.
- Generate diagrams using Mermaid and PlantUML syntax
- Support for multiple output formats (e.g., PNG, SVG)
- Easy integration with other applications
- RESTful API design
To install the Diagrams API, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/diagrams-api.git
-
Navigate to the project directory:
cd diagrams-api uv sync
Before running the API, you may need to configure it. The configuration file is located at config.yaml
. You can modify the settings such as port number, logging level, and supported diagram types.
To use the Diagrams API, you can send HTTP requests to the endpoints provided. Here are some examples:
curl -X POST http://localhost:8000/mermaid \
-H "Content-Type: application/json" \
-d '{"diagram": "graph TD; A-->B; A-->C; B-->D; C-->D;"}'
curl -X POST http://localhost:8000/plantuml \
-H "Content-Type: application/json" \
-d '{"diagram": "@startuml\nAlice -> Bob: Hello\n@enduml"}'
- Backend: Python with FastAPI
- Diagram Libraries: Mermaid, PlantUML
- Testing: Pytest for unit and integration tests
- Deployment: Docker for containerization
- Caching: Optional Redis
There is no database required for this API, as it is stateless and does not store any user data, but we recommend using a caching layer for performance optimization.
To run the tests, ensure you have pytest
installed, then execute:
pytest tests/
The API documentation is available at http://localhost:8000/docs
when the server is running. It provides detailed information about the available endpoints, request parameters, and response formats.
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request. Please ensure that your code adheres to the project's coding standards and includes appropriate tests.
This project is licensed under the MIT License.
For any questions or support, please contact the project maintainer at [email protected].