ShivaMer is a web app that converts Python code into Mermaid diagrams in real time.
It helps you visualize logic flow from functions, conditions, and loops as flowcharts you can export to PNG or .mmd.
- Convert Python code into Mermaid flowcharts
- Real-time preview (auto, debounced, or manual) with inline syntax errors
- Export diagrams as PNG or .mmd
- Powered by FastAPI (backend) + React + Vite + TailwindCSS (frontend)
- Supports Docker Compose for local testing
# Clone repo
git clone https://github.com/bytestay/shivamer.git
cd shivamer/frontend
# Install dependencies
npm install
# Run frontend (default API is http://localhost:8000)
npm run devBackend (FastAPI, Python 3.12):
cd ../backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000Tests and lint:
cd backend
pip install -r requirements-dev.txt
pytest -q && ruff check .The API only accepts browser requests from the origins in ALLOWED_ORIGINS
(comma separated; defaults to the production site, plus localhost:5173/8080 unless
ENVIRONMENT=production, which is also what turns off /docs and /redoc). Bodies above 64 KB get a 413.
Then open: http://localhost:5173
docker compose up --buildFrontend → http://localhost:8080
Backend → http://localhost:8000
- The frontend sends your Python code to the backend via
/convert(POST). - The FastAPI backend parses it with Python’s
astmodule. - The backend returns a Mermaid flowchart definition (
flowchart TD ...). - The frontend renders it using the Mermaid.js library.
| Python | Diagram |
|---|---|
def / async def |
a subgraph with its own start and End |
class |
a subgraph containing its methods |
if / elif / else |
decision with Yes / No branches that join again |
for, while (+ else) |
decision with a loop-back edge; break / continue follow the real flow |
try / except / finally, with, match |
their blocks in order; except is reached through an error edge |
return, raise |
go straight to the End of the function |
input(...), print(...) |
I/O parallelograms |
| anything else | a box with the statement's code |
- Frontend:
.github/workflows/deploy.ymlbuilds on every PR and publishes to GitHub Pages (shivamer.bytestay.pt) on push tomain. - Backend:
.github/workflows/backend.ymlruns ruff + pytest, then onmaindeploysbackend/to the Fly appbst-shivamer-backend(api-shivamer.bytestay.pt) and runs a smoke test. The deploy step needs theFLY_API_TOKENrepository secret; without it the job skips with a warning and you can deploy by hand withcd backend && flyctl deploy.
Contributions are welcome! See the contributing guide:
- open an issue first for anything bigger than a small fix;
- use Conventional Commits for the pull request title;
- run the backend checks (
pytest -q && ruff check ., see Tests and lint above) before opening the pull request.
Everyone follows the code of conduct.
Formerly Hybrid Forge Lab. This repository continues hybridforgelab/ShivaMer under the ByteStay name since November 2026, so the older commits come from there.
This project is open-source under the MIT License.
Feel free to use, modify, and share it just give credit to the original authors.
Developed and maintained by ByteStay.
"Code. Visualize. Understand."