Last active
September 8, 2024 08:44
-
-
Save knuu/dc680cd4b6b07a374596c1eb29d4bb2d to your computer and use it in GitHub Desktop.
architecture by mermaid.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mermaidDefinition = ` | |
architecture-beta | |
group api(logos:aws-vpc)[VPC] | |
service server(logos:aws-api-gateway)[Server] in api | |
service search(logos:aws-open-search)[OpenSearch] in api | |
service lambda(logos:aws-lambda)[Lambda] in api | |
service disk(logos:aws-s3)[Storage] in api | |
server:R <--> L:lambda | |
lambda:R <--> L:search | |
search:R <-- L:disk | |
`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Search API</title> | |
<script type="module" src="render.js"></script> | |
</head> | |
<body> | |
<div id="mermaid-container"></div> | |
<script src="diagram_aws.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.mjs'; | |
mermaid.registerIconPacks([ | |
{ | |
name: 'logos', | |
loader: () => | |
fetch('https://unpkg.com/@iconify-json/logos/icons.json').then((res) => res.json()), | |
}, | |
]); | |
document.addEventListener("DOMContentLoaded", function() { | |
const container = document.getElementById("mermaid-container"); | |
container.classList.add("mermaid"); | |
container.textContent = mermaidDefinition; | |
mermaid.initialize({ startOnLoad: true }); | |
mermaid.init(undefined, container); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment