Create, edit, and share beautiful Mermaid diagrams in real-time!
A powerful, modern web application that transforms your ideas into stunning diagrams with live preview and instant sharing capabilities.
This project is a monorepo managed by Turborepo, which provides an incredibly fast and efficient development experience by orchestrating the frontend and backend services.
apps/frontend: A modern Next.js application providing the user interface and real-time diagram rendering.apps/backend: A robust NestJS API handling persistence, sharing logic, and external integrations.
-
Clone the repository
git clone https://github.com/sametcn99/mermaid-viewer.git cd mermaid-viewer -
Install dependencies
We use Bun as our package manager for lightning-fast installations and execution.
bun install
-
Configure Environment Variables
Copy the example environment file and update the values as needed.
cp .env.example .env
-
Start Development Environment
Turborepo will start both the frontend and backend in parallel with a single command:
bun dev
-
Access the Services
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- API Documentation: http://localhost:3001/docs
Managed by Turborepo, these commands run across all applications:
| Command | Description |
|---|---|
bun dev |
Starts all applications in development mode with hot-reloading. |
bun build |
Builds all applications for production. |
bun lint |
Runs linting checks across the entire codebase. |
bun format |
Automatically formats code using Biome and Prettier. |
bun test |
Executes unit and integration tests. |
bun type-check |
Performs TypeScript type checking across all packages. |
You can easily deploy the application using Docker Compose. This setup includes the frontend, backend, PostgreSQL database, and Nginx as a reverse proxy.
-
Configure Environment Variables
Create a
.envfile in the root directory containing necessary keys (Database credentials, API keys etc.). -
Build and Start Containers
Run the following command in the root directory:
docker compose up -d --build
This command will:
- Build the backend and frontend images (using
oven/bunfor optimized builds). - Start a PostgreSQL database container.
- Start an Nginx reverse proxy.
- Build the backend and frontend images (using
-
Access the Application
Once the containers are running, you can access the application at:
- Web App: http://localhost (via Nginx on port 80)
The project uses Nginx as a reverse proxy to route traffic to the frontend and backend services. The configuration is located in nginx.conf and handles:
- Routing root requests to the frontend service.
- Routing
/apirequests to the backend service. - Handling proxy headers.
To stop the services:
docker compose downWe welcome contributions from the community! Whether you're fixing a bug, adding a feature, or improving documentation, your help is appreciated.
-
Fork the Project: create your own copy of the repository on GitHub.
-
Create a Branch: switch to a new branch for your feature or fix.
git checkout -b feature/AmazingFeature
-
Make Changes: implement your changes and test them locally.
bun dev
-
Lint & Format: ensure your code meets the project's standards.
bun lint bun format
-
Commit: write a clear, descriptive commit message.
git commit -m 'Add some AmazingFeature' -
Push: upload your branch to your fork.
git push origin feature/AmazingFeature
-
Open a Pull Request: submit your changes for review.