{"id":31344022,"url":"https://github.com/kh77/curl-diagram-generator","last_synced_at":"2025-09-26T07:40:52.272Z","repository":{"id":306515057,"uuid":"1026423919","full_name":"kh77/curl-diagram-generator","owner":"kh77","description":"Generate Diagram ( pass curl request or upload har file ) ","archived":false,"fork":false,"pushed_at":"2025-07-25T23:21:33.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-26T06:32:05.310Z","etag":null,"topics":["java","spring-boot-3"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kh77.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-25T21:38:24.000Z","updated_at":"2025-07-25T23:22:09.000Z","dependencies_parsed_at":"2025-07-26T06:32:07.185Z","dependency_job_id":"988616a7-e0df-466d-aa8e-8ccac575ff4f","html_url":"https://github.com/kh77/curl-diagram-generator","commit_stats":null,"previous_names":["kh77/curl-diagram-generator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/kh77/curl-diagram-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fcurl-diagram-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fcurl-diagram-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fcurl-diagram-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fcurl-diagram-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kh77","download_url":"https://codeload.github.com/kh77/curl-diagram-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh77%2Fcurl-diagram-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277043180,"owners_count":25750508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-26T02:00:09.010Z","response_time":78,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","spring-boot-3"],"created_at":"2025-09-26T07:40:48.768Z","updated_at":"2025-09-26T07:40:52.267Z","avatar_url":"https://github.com/kh77.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔄 Curl/Har to Diagram Generator\n\nTransform your curl commands into beautiful visual diagrams with this Spring Boot application. Perfect for API documentation, workflow visualization, and team communication.\n\n## 🚀 Features\n\n- **Multiple Diagram Types**: Sequence diagrams, flowcharts, and network diagrams\n- **PlantUML Integration**: High-quality diagram generation\n- **REST API**: Easy integration with other tools\n- **Curl Parser**: Intelligent parsing of complex curl commands\n- **Har file Parser**: Intelligent parsing of complex har file\n- **Export Options**: Base64 encoded images and source code\n\n## 📋 Prerequisites\n\n- Java 17 or higher\n- Maven 3.6 or higher\n- Spring Boot 3.x\n\n## 🛠️ Installation\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/kh77/curl-diagram-generator.git\n   cd curl-diagram-generator\n   ```\n\n2. **Build the project**\n   ```bash\n   mvn clean install\n   ```\n\n3. **Run the application**\n   ```bash\n   mvn spring-boot:run\n   ```\n\n4. **Access the application**\n    - Web Interface: http://localhost:8080\n    - API Base URL: http://localhost:8080/api/diagrams\n\n## 🎯 API Usage\n\n### Generate Single Diagram\n\n**Endpoint:** `POST /api/diagrams/generate`\n\n**Request Body:**\n```json\n{\n  \"curlCommands\": \"your curl commands here\",\n  \"diagramType\": \"sequence|flowchart|network\",\n  \"title\": \"Optional diagram title\"\n}\n```\n\n**Example:**\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X POST https://api.example.com/users -H \\\"Content-Type: application/json\\\" -d \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"John\\\\\\\", \\\\\\\"email\\\\\\\": \\\\\\\"john@example.com\\\\\\\"}\\\"\\ncurl -X GET https://api.example.com/users/123\\ncurl -X PUT https://api.example.com/users/123 -H \\\"Content-Type: application/json\\\" -d \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"John Updated\\\\\\\"}\\\"\",\n    \"diagramType\": \"sequence\",\n    \"title\": \"User Management API\"\n  }'\n```\n\n**Response:**\n```json\n{\n  \"diagramType\": \"sequence\",\n  \"plantUmlSource\": \"@startuml\\ntitle User Management API\\n...\",\n  \"base64Image\": \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==\",\n  \"metadata\": {\n    \"commandCount\": 3,\n    \"uniqueHosts\": 1\n  }\n}\n```\n\n### Generate All Diagram Types\n\n**Endpoint:** `POST /api/diagrams/generate-all`\n\n**Example:**\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate-all \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X POST https://auth.example.com/login -d \\\"username=admin\u0026password=secret\\\"\\ncurl -X GET https://api.example.com/users -H \\\"Authorization: Bearer token123\\\"\\ncurl -X POST https://api.example.com/orders -d \\\"userId=1\u0026product=laptop\\\"\",\n    \"title\": \"E-commerce API Flow\"\n  }'\n```\n\n**Response:**\n```json\n{\n  \"sequence\": {\n    \"diagramType\": \"sequence\",\n    \"plantUmlSource\": \"@startuml...\",\n    \"base64Image\": \"base64_encoded_image_data\"\n  },\n  \"flowchart\": {\n    \"diagramType\": \"flowchart\",\n    \"plantUmlSource\": \"@startuml...\",\n    \"base64Image\": \"base64_encoded_image_data\",\n    \"mermaidSource\": \"flowchart TD...\"\n  },\n  \"network\": {\n    \"diagramType\": \"network\",\n    \"plantUmlSource\": \"@startuml...\",\n    \"base64Image\": \"base64_encoded_image_data\"\n  }\n}\n```\n\n## 📝 Curl Command Examples\n\n### REST API CRUD Operations\n```bash\ncurl -X POST https://jsonplaceholder.typicode.com/posts \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"title\": \"My New Post\",\n    \"body\": \"This is the content of my post\",\n    \"userId\": 1\n  }'\n\ncurl -X GET https://jsonplaceholder.typicode.com/posts/1\n\ncurl -X PUT https://jsonplaceholder.typicode.com/posts/1 \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"id\": 1,\n    \"title\": \"Updated Post Title\",\n    \"body\": \"Updated content\",\n    \"userId\": 1\n  }'\n\ncurl -X DELETE https://jsonplaceholder.typicode.com/posts/1\n```\n\n### Authentication Flow\n```bash\ncurl -X POST https://api.example.com/auth/login \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"username\": \"admin\",\n    \"password\": \"secretpassword\"\n  }'\n\ncurl -X GET https://api.example.com/user/profile \\\n  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'\n\ncurl -X POST https://api.example.com/auth/refresh \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"refresh_token\": \"refresh_token_here\"\n  }'\n```\n\n### Microservices Communication\n```bash\ncurl -X POST https://user-service.com/api/users \\\n  -H 'Authorization: Bearer token123' \\\n  -d '{\"name\": \"Alice\"}'\n\ncurl -X POST https://order-service.com/api/orders \\\n  -H 'Authorization: Bearer token123' \\\n  -d '{\"userId\": 1, \"product\": \"laptop\"}'\n\ncurl -X POST https://payment-service.com/api/payments \\\n  -H 'Authorization: Bearer token123' \\\n  -d '{\"orderId\": 456, \"amount\": 999.99}'\n\ncurl -X POST https://notification-service.com/api/notify \\\n  -d '{\"userId\": 1, \"message\": \"Order confirmed\"}'\n```\n\n## 🧪 Testing the API\n\n### Test Connection\n```bash\ncurl -X GET http://localhost:8080/api/diagrams/test\n```\n**Expected Response:** `\"Diagram service is running!\"`\n\n### Generate Sequence Diagram\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X POST https://api.example.com/users -H '\\''Content-Type: application/json'\\'' -d '\\''{\\\"name\\\": \\\"John\\\", \\\"email\\\": \\\"john@example.com\\\"}'\\''\",\n    \"diagramType\": \"sequence\",\n    \"title\": \"User Creation Flow\"\n  }'\n```\n\n### Generate Flowchart Diagram\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X GET https://api.example.com/products\\ncurl -X POST https://api.example.com/cart/add -d '\\''productId=123'\\''\\ncurl -X POST https://api.example.com/checkout\",\n    \"diagramType\": \"flowchart\",\n    \"title\": \"Shopping Flow\"\n  }'\n```\n\n### Generate Network Diagram\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X POST https://user-service.com/api/register -d '\\''name=Alice'\\''\\ncurl -X POST https://order-service.com/api/orders -d '\\''userId=1'\\''\\ncurl -X POST https://payment-service.com/api/charge -d '\\''orderId=123'\\''\\ncurl -X POST https://inventory-service.com/api/reserve -d '\\''productId=456'\\''\",\n    \"diagramType\": \"network\",\n    \"title\": \"Microservices Architecture\"\n  }'\n```\n\n### Generate From har file, har file is present in the project root `api.har`\n```bash\ncurl --request POST \\\n    --url http://localhost:8080/api/diagrams/generate-from-har \\\n    --header 'content-type: multipart/form-data' \\\n    --form harFile=@harFile \\\n    --form diagramType=sequence \\\n    --form 'title=Test API'\n```\n\n### Generate All Diagrams at Once\n```bash\ncurl -X POST http://localhost:8080/api/diagrams/generate-all \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"curlCommands\": \"curl -X POST https://auth.example.com/login -d '\\''username=admin\u0026password=secret'\\''\\ncurl -X GET https://api.example.com/users -H '\\''Authorization: Bearer token123'\\''\\ncurl -X POST https://api.example.com/orders -d '\\''userId=1\u0026product=laptop'\\''\",\n    \"title\": \"Complete API Workflow\"\n  }'\n```\n\n\n## 📊 View Diagram \n-  When you run the project, use http://localhost:8080/ and copy your base64 response and press `View Image` button.\n\n\n- Search `plant uml editor` in the Google and replace `\\n` from the response with `enter line` and replace `\\` with `empty` so that diagram will be generated. like https://editor.plantuml.com/\n       \n       ** Before   \n       \"plantUmlSource\": \"@startuml\\ntitle My API Flow\\nparticipant Client\\nparticipant \\\"auth.com\\\" as authcom\\nparticipant \\\"api.com\\\" as apicom\\n\\nClient -\u003e authcom: POST /login\\nauthcom --\u003e Client: Response\\n\\nClient -\u003e apicom: GET /data\\napicom --\u003e Client: Response\\n@enduml\"\n       \n       ** After\n      @startuml\n      title My API Flow\n      participant Client\n      participant \"auth.com\" as authcom\n      participant \"api.com\" as apicom\n      \n      Client -\u003e authcom: POST /login\n      authcom --\u003e Client: Response\n      \n      Client -\u003e apicom: GET /data\n      apicom --\u003e Client: Response\n      @enduml\"\n\n\n\n\n## 📊 Supported Diagram Types\n\n| Type | Description | Best For |\n|------|-------------|----------|\n| **Sequence** | Shows chronological flow of API calls | API workflows, authentication flows |\n| **Flowchart** | Shows process flow with decision points | Business processes, user journeys |\n| **Network** | Shows system architecture and connections | Microservices, system architecture |\n\n## 🚀 Advanced Usage\n\n### Batch Processing Multiple Curl Files\n```bash\n# Process multiple curl command sets\nfor file in *.curl; do\n  curl -X POST http://localhost:8080/api/diagrams/generate \\\n    -H 'Content-Type: application/json' \\\n    -d \"{\\\"curlCommands\\\": \\\"$(cat $file)\\\", \\\"diagramType\\\": \\\"sequence\\\", \\\"title\\\": \\\"$file\\\"}\"\ndone\n```\n\n**Made with ❤️ by Kazim**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh77%2Fcurl-diagram-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkh77%2Fcurl-diagram-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh77%2Fcurl-diagram-generator/lists"}