Skip to content

Commit

Permalink
Doc: GitHub badge
Browse files Browse the repository at this point in the history
  • Loading branch information
loicknuchel committed Nov 7, 2024
1 parent b5bc07d commit ba201cd
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 20 deletions.
41 changes: 23 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/azimutt-logo-light.png">
<source media="(prefers-color-scheme: light)" srcset="assets/azimutt-logo-dark.png">
<img alt="Azimutt logo" src="assets/azimutt-logo-dark.png" width="500">
<img alt="Azimutt logo" src="assets/azimutt-logo-dark.png" width="400">
</picture>
</a>
</p>
<p align="center">
<b>Next-Gen ERD</b>: Design, Explore, Document and Analyze your database, schema and data
<b>Next-Gen ERD</b>: Design, Explore, Document and Analyze your database schema and data
</p>
<p align="center">
<a href="https://azimutt.app" target="_blank" rel="noopener">azimutt.app</a> •
<a href="https://github.com/orgs/azimuttapp/projects/5" target="_blank" rel="noopener noreferrer">roadmap</a> •
<a href="https://twitter.com/azimuttapp" target="_blank" rel="noopener noreferrer">@azimuttapp</a>
<a href="https://azimutt.app" target="_blank" rel="noopener">azimutt.app</a> •
<a href="https://github.com/orgs/azimuttapp/projects/5" target="_blank" rel="noopener noreferrer">roadmap</a> •
<a href="https://twitter.com/azimuttapp" target="_blank" rel="noopener noreferrer">@azimuttapp</a>
</p>
<p align="center">
<a href="https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt" target="_blank" rel="noopener">
<img src="https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat" alt="Explore database with Azimutt" />
</a>
</p>
<p align="center">
<a href="https://www.producthunt.com/posts/azimutt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-azimutt" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=390699&theme=light" alt="Azimutt - Easily explore and analyze your database with your team | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
Expand Down Expand Up @@ -52,26 +57,26 @@ You can load any public SQL file in Azimutt with just an url parameter.
So if you have a SQL file in your repo, like [structure.sql](./backend/priv/repo/structure.sql), you can add a badge allowing your visitors to easily explore it:

```markdown
[![explore database with Azimutt](https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
```

Here are some examples:

[![explore database with Azimutt](https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/MySQL-browse_online-gray?labelColor=4479A1&logo=mysql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/MariaDB-browse_online-gray?labelColor=003545&logo=mariadb&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/Oracle-browse_online-gray?labelColor=F80000&logo=oracle&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/SQL_Server-browse_online-gray?labelColor=0078D4&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/SQLite-browse_online-gray?labelColor=003B57&logo=sqlite&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/MongoDB-browse_online-gray?labelColor=47A248&logo=mongodb&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/Couchbase-browse_online-gray?labelColor=EA2328&logo=couchbase&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/Snowflake-browse_online-gray?labelColor=29B5E8&logo=snowflake&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/BigQuery-browse_online-gray?labelColor=669DF6&logo=googlebigquery&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![explore database with Azimutt](https://img.shields.io/badge/Apache_Hive-browse_online-gray?labelColor=FDEE21&logo=apachehive&logoColor=000&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/MySQL-browse_online-gray?labelColor=4479A1&logo=mysql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/MariaDB-browse_online-gray?labelColor=003545&logo=mariadb&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/Oracle-browse_online-gray?labelColor=F80000&logo=oracle&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/SQL_Server-browse_online-gray?labelColor=0078D4&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/SQLite-browse_online-gray?labelColor=003B57&logo=sqlite&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/MongoDB-browse_online-gray?labelColor=47A248&logo=mongodb&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/Couchbase-browse_online-gray?labelColor=EA2328&logo=couchbase&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/Snowflake-browse_online-gray?labelColor=29B5E8&logo=snowflake&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/BigQuery-browse_online-gray?labelColor=669DF6&logo=googlebigquery&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://img.shields.io/badge/Apache_Hive-browse_online-gray?labelColor=FDEE21&logo=apachehive&logoColor=000&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)

Use [Simple Icons](https://simpleicons.org) to find other icon/color if needed or use our custom button image:

[![explore database with Azimutt](https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/assets/azimutt-button.png)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)
[![Explore database with Azimutt](https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/assets/azimutt-button.png)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)


## Self-hosted
Expand Down
3 changes: 2 additions & 1 deletion backend/lib/azimutt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ defmodule Azimutt do
children: [
%{path: ["cli"], name: "CLI"},
%{path: ["gateway"], name: "Gateway"},
%{path: ["converters"], name: "Converters"}
%{path: ["converters"], name: "Converters"},
%{path: ["badge"], name: "GitHub badge"}
]
},
%{path: ["data-privacy"], name: "Data privacy", details: "how Azimutt keep your data safe"},
Expand Down
76 changes: 76 additions & 0 deletions backend/lib/azimutt_web/templates/website/docs/badge.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<%= render "docs/_header.html", conn: @conn, page: @page %>

<%= doc_prose do %>
<p class="lead">
Azimutt can load any SQL file from the URL and display its entity-relationship diagram.
Thanks to that, you can create a GitHub badge allowing your users to explore your database schema, IN ONE CLICK 🤯
</p>
<p>
Just try it:
<a href="https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt" target="_blank" rel="noopener" class="not-prose no-underline">
<img src="https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat" alt="Explore database with Azimutt" class="inline" />
</a>
</p>
<iframe width="768" height="432" src="https://www.youtube-nocookie.com/embed/3hFV3A9ZWs4?rel=0&modestbranding=1" title="Azimutt badge for GitHub" frameborder="0" allowfullscreen></iframe>
<p>
To use it on your own repository, there are a few simple steps:
</p>
<ol>
<li>
<p><strong>Navigate to your SQL schema file and get it's *raw* url</strong></p>
<p>
For Azimutt the file is <a href="https://github.com/azimuttapp/azimutt/blob/main/backend/priv/repo/structure.sql" target="_blank" rel="noopener">backend/priv/repo/structure.sql</a>,
so the raw url is <i>https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql</i>
</p>
</li>
<li>
<p><strong>Build the Azimutt create url</strong></p>
<p>
The structure is <code>https://azimutt.app/create?sql=$file_url&name=$project_name</code>, so Azimutt it's
<i>https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt</i>
</p>
</li>
<li>
<p><strong>Create your badge with <a href="https://shields.io" target="_blank" rel="noopener">shields.io</a></strong></p>
<p>
You can build the ones you want. For PostgreSQL here is the suggested url:
<i>https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat</i>.
See below for others.
</p>
</li>
<li>
<p><strong>Put everything together, displaying a link with image in your README</strong></p>
<p>
Here is how to do it in markdown: <code>[![Image alt](Image url)](Link url)</code>, so the final result for Azimutt is:
<i>[![Explore database with Azimutt](https://img.shields.io/badge/PostgreSQL-browse_online-gray?labelColor=4169E1&logo=postgresql&logoColor=fff&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)</i>
</p>
</li>
</ol>
<p>Depending on your database, you can use these examples:</p>
<p>
<%= for {name, logo, color, logoColor} <- [
{"PostgreSQL", "postgresql", "4169E1", "fff"},
{"MySQL", "mysql", "4479A1", "fff"},
{"MariaDB", "mariadb", "003545", "fff"},
{"Oracle", "oracle", "F80000", "fff"},
{"SQL_Server", "", "0078D4", "fff"},
{"SQLite", "sqlite", "003B57", "fff"},
{"MongoDB", "mongodb", "47A248", "fff"},
{"Couchbase", "couchbase", "EA2328", "fff"},
{"Snowflake", "snowflake", "29B5E8", "fff"},
{"BigQuery", "googlebigquery", "669DF6", "fff"},
{"Apache_Hive", "apachehive", "FDEE21", "000"},
] do %>
<!--<pre><code class="hljs md">[![Explore database with Azimutt](https://img.shields.io/badge/<%= name %>-browse_online-gray?labelColor=<%= color %>&logo=<%= logo %>&logoColor=<%= logoColor %>&style=flat)](https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt)</code></pre>-->
<a href={"https://azimutt.app/create?sql=https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/backend/priv/repo/structure.sql&name=Azimutt"} target="_blank" rel="noopener" class="not-prose no-underline">
<img src={"https://img.shields.io/badge/#{name}-browse_online-gray?labelColor=#{color}&logo=#{logo}&logoColor=#{logoColor}&style=flat"} alt="Explore database with Azimutt" class="inline" />
</a>
<% end %>
</p>
<p>Some repos have adopted it, add yours if you want:</p>
<ul>
<li><a href="https://github.com/azimuttapp/azimutt" target="_blank" rel="noopener">azimuttapp/azimutt</a></li>
</ul>
<% end %>

<%= render "docs/_footer.html", conn: @conn, page: @page, prev: @prev, next: @next %>
2 changes: 1 addition & 1 deletion libs/aml/src/docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function getAmlSnippets(path: string, content: string): {snippet: string, versio
}

function getLinks(markdown: string): string[] {
const linkRegex = /\[[^\]]*?]\([^)]*?\)/g
const linkRegex = /\[[^\]]*?]\([^) ]*?\)/g
const links = markdown.match(linkRegex) || []
return links.map((link: string) => link.match(/\[.*?]\((.*?)\)/)?.[1] || '') // extract url/path
}
Expand Down

0 comments on commit ba201cd

Please sign in to comment.