Easy Steps to Connect to Supabase and Visualize Your Database with Luna Modeler

If you want to connect to Supabase and visualize your Postgres database, Luna Modeler has you covered! All you need to do is establish a database connection, gather the information from Supabase, and it will effortlessly create a project that includes the ER diagram.

Supabase diagram made in Luna Modeler

Your Supabase Project

Supabase offers a free tier, making it an ideal choice for trying out this solution. Let’s assume you already have your Supabase project and want to visualize the Postgres database structure more efficiently or create an offline model for a completely new database.

To do this, you can use Luna Modeler data modeling tool, with which you can:

  • connect to Supabase database and automatically create an ER Diagram, which you can divide to sub-diagrams or enrich with additional elements, and e.g. generate interactive documentation or export the diagram to PDF
  • create a new data model and generate an SQL script that you can run in the Supabase environment to quickly create a new database structure

Getting the Supabase Database Connection Credentials

To create a new database connection in Luna Modeler, you’ll need to gather your database credentials first. Here’s a guide on what credentials you need and how to find them in Supabase.

In section General, click the Connect button.

Connection string

Supabase settings, section General and the button Connect.

A modal form opens. Scroll down to the section Session pooler.

Supabase and the database connection details, section Session Pooler

Expand the View parameters section.

Supabase and database connection details

In the next step, you will see how to get the SSL certificate.

SSL Certificate

In the left-side panel select the Database item, then navigate to section SSL Configuration where you can enable the Enforce SSL on incoming connections option and download the SSL Certificate.

Supabase database configuration, section where SSL certificate can be downloaded.

That’s it. Now we can set up the connection to Supabase in Luna Modeler.

Creating the Supabase Connection in Luna Modeler

To create a new connection, click the Connections button on the main toolbar and then click Create new connection.

Luna Modeler and the main toolbar with the Connections button

A modal form opens. Select PostgreSQL and enter a name for the connection and the credentials as shown in the image below.

New connection to Postgres database running in Supabase

In the section Server, type in all information manually, including the Database and Schema values.

Supabase database connection defined in Luna Modeler database modeling tool

Now it is important to enable SSL/TLS. Navigate to the SSL/TLS tab, enable this option and specify the path to your downloaded SSL certificate.

Luna Modeler connection details - SSL settings for a Postgres connection running in Supabase.

Everything is set, save the connection.

Visualization of the Existing Supabase Database Structure

To get a detailed visual representation of the database structure, click on the Connect and load existing database structure link to initiate reverse engineering. Luna Modeler will extract the details from the database and create the project, including the ER diagram.

Supabase connection item with the possibility to load database structure and visualize it with an ER diagram.

Example of a newly created project enriched with some additional elements.

Supabase ER diagram - visualization of the Postgres database running in Supabase. Image shows the ER diagram created in Luna Modeler database modeling tool.

Creating Interactive Documentation

Once you have successfully created the project and ER diagram, you can easily enrich it with additional elements. Add notes, set cardinality, estimate sizes, create sub-diagrams, etc. Then you can simply generate an HTML report or export the diagram to PDF format. Read the benefits of documenting databases using ER Diagrams.

Generating SQL Script in Luna Modeler

One of the many advantages of Luna Modeler is the ability to generate SQL scripts. You can visually create a database structure and generate SQL code for your Supabase project, which you can then conveniently run in the Supabase environment at the most convenient time.

Supabase and execution of SQL script generated by Luna Modeler.

Comparison and Project Update

Luna Modeler also allows you to compare the database with the project and update the project. In future versions of Luna Modeler, we plan to add the ability to generate an SQL script for the changes detected.

What is Supabase?

Supabase serves as an open-source alternative to Firebase. It allows you to set up a project using a Postgres database and take advantage of features such as authentication, instant APIs, edge functions, realtime subscriptions, storage etc. For more information visit: Supabase

Get started today and try Luna Modeler

Download

DATA MODELING TOOLS
DRAW Diagrams and
GENERATE Scripts
Download data modeling tools
Blog Categories
Blog by Platforms