THIS IS AN ALPHA, MAYBE I WILL NOT UPDATE IT ANYMORE
supabase-luau
I present to you one of my best projects in LUAU: supabase-luau.
What is supabase-luau?
supabase-luau is a ModuleScript that allows you to manage relational databases with Supabase.
Supabase is an open source platform that offers an alternative to cloud database services. It is based on the power and security of the PostgreSQL database management system, which is used by large companies and organizations worldwide.
What benefits does supabase-luau give you?
One of the best benefits that supabase-luau gives you, is the relational database management in Roblox, you also have the following benefits:
- Graphical interface to visualize your records
- Simple syntax
- Ease of creating more powerful and secure databases
- Being able to manage your records manually through a graphical interface
- Ease of use
- You don’t need to know much SQL to be able to use it.
Is there any requirement or knowledge needed?
You will only need to know: how to use the Supabase page, how to get the API key and the project URL.
Tutorial about CRUD with supabase-luau
I’ll leave you some example scripts using supabase-luau so that you know if it’s to your liking and so that you know how to use it without having to see so much documentation.
Creating a client with supabase-luau
local Supabase = require(<supabase-path>)
local client = Supabase.createClient({
url = "url-of-your-project-in-supabase",
apiKey = "your-api-key"
})
Read data from database
local data = client
:from("my-table")
:select("*")
:execute()
print(data)
Insert data into database
local newDataCreated = client
:from("my-table")
:insert({ name = "isaac010901", gems = 0, money = 0 })
print(newCreatedData) -- { name = "isaac010901", gems = 0, money = 0 }
Update a data in the database
local dataUpdated = client
:from("my-table")
:update("name", "isaac010901", { gems = 10, money = 10 })
print(dataUpdated) -- { name = "isaac010901", gems = 10, money = 10 }
Delete a piece of data in the database
local dataUpdated = client
:from("my-table")
:delete("nombre", "isaac010901")
print(dataUpdated) -- { name = "isaac010901", gems = 10, money = 10 }
-- if we get all the elements from the database again, this record will no longer be output.
Modifiers and filters
Currently there are only these modifiers and filters:
- order(column: string, asc: boolean)
- eq(column: string, value: any)
- neq(column: string, value: any)
- limit(amount: number)
A modifier is a method that modifies how the elements are returned from the database, for example order() modifies the order in which the elements are returned.
These modifiers and filters are only useful when using the :select() method.
Example:
local data = client
:from("my-table")
:neq("name", "isaac010901")
:order("id", false)
:limit(5)
:execute()
print(data) --[[[
{
[1] = { id = 5, name = ..., ...}
[2] = { id = 4, name = ..., ...}
...
[5] = { id = 1, name = ..., ...}
}
]]
It is important to know that supabase-luau is not perfect, and it is possible that there are things that can be improved or annoying to use, but it is still in its earliest version, I will give all my effort and knowledge in making this module the easiest to use and the most useful for you .
I would appreciate if you could comment and like my post, because I believe and feel that it can become popular and useful for the whole community
Test supabase-luau v1.1.0-rc.1
- GitHub repository: GitHub - ecstatic5/supabase-luau
- Documentation: supabase-luau
- Download (Roblox Studio): supabase-luau Releases
IT IS IMPORTANT TO KNOW THAT THIS PROJECT IS STILL UNDER DEVELOPMENT AND IT IS NOT RECOMMENDED TO USE IT FOR PRODUCTION.
Version table
v1.0.0-dev.1
- Topic in the Devforum created
- Repository has been created on GitHub
v1.1.0-rc.1
- Documentation has been completed
- supabase-luau is now downloadable for Roblox Studio (.rbxm)
made by @isaac010901