B4J Tutorial [BANano] SupaBase (FireBase Alternative) crud example with SSE

Hi

Supabase is an open source Firebase alternative. It provides all the backend services you need to build a product. Supabase uses Postgres database with real-time capabilities. Basically, supabase provides an interface to manage postgres database that you can use to create table and insert, edit and delete data in the table.

We can use REST API or client libraries from supabase to access the data in the postgres database. Supabase is not just about accessing the database. it also provides some solutions out of the box such as Authentication, File Storage and Real-time capabilities.

For this example we will use the javascript sdk. I am using this for the SithasoDaisy framework.

First things first

1. Sign Up


2. Get the JavaScript SDK and include in your project.

You will use the CDN version in this section

1715590679276.png


Add this to your BANano project, in the Main code module using

B4X:
BANano.Header.AddJavascriptFile("SUPABASE SDK URL LINK")/

3. Create a project.

4. Create a table with columns.

5. Get your keys...

supabaseconf.jpg


We have a table called books with a few fields. You can create any schema you want.

1671095380516.png



We initialize the class:

B4X:
'SELECT_ALL
    Dim supabase As SDUISupaBase
    supabase.Initialize(Me, "supabase", my_url, my_key)
    supabase.TableName = "books"

Related Content

Supabase Crash Course

 

Attachments

  • SDUISupaBase.zip
    3.5 KB · Views: 248
Last edited:

biggiu

Member
Licensed User
Longtime User
Hi, would it be possible to have a simple and working example of a B4a application, capable of:
Connect to a supabase DB
perform all CRUD operations

This would be very useful for those starting to approach this DB.
To date, despite having browsed a lot through the information related to supabase, I have not been able to do anything because every attempt to use the code found only produces errors. This applies to me as I am not very familiar with the topic.
Kind regards and thank you for your kind cooperation.
 

Mashiane

Expert
Licensed User
Longtime User
Hi, would it be possible to have a simple and working example of a B4a application, capable of:
Connect to a supabase DB
perform all CRUD operations

This would be very useful for those starting to approach this DB.
To date, despite having browsed a lot through the information related to supabase, I have not been able to do anything because every attempt to use the code found only produces errors. This applies to me as I am not very familiar with the topic.
Kind regards and thank you for your kind cooperation.
For b4a, this is the only thread available for Supabase as indicated previously.


You can ask the author of the b4x for more clarity should you be stuck.
 
Top