I keep a small note when learning a new tool.
Not a full guide. Not polished documentation.
Just the syntax I actually use.
After a few projects with Supabase, I noticed the same pattern. I kept opening the docs, searching for the same things:
- How to insert a row
- How to query data
- How to update something
- How to call an RPC
So I wrote a small “quick syntax sheet”.
This is the version I wish I had when starting.
Supabase is simple once you learn the core pattern.
Almost everything follows this shape:
supabasesupabase .from("table") .operation(...)
If you remember that, the rest becomes predictable.
Setup
Create a client first.
javascriptimport { createClient } from "@supabase/supabase-js" const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY )
That’s it.
Now every database call starts with supabase.
Select (Read Data)
The most common query.
javascriptconst { data, error } = await supabase .from("posts") .select("*")
You’ll probably write this line hundreds of times.
Select specific columns
supabase.select("id, title, created_at")
Example:
javascriptconst { data } = await supabase .from("posts") .select("id, title")
Filter rows
supabase.eq(column, value)
Example:
javascriptconst { data } = await supabase .from("posts") .select("*") .eq("author_id", user.id)
Other common filters:
supabase.eq() equal .neq() not equal .gt() greater than .lt() less than .like() pattern match
Get one row
supabase.single()
Example:
javascriptconst { data } = await supabase .from("posts") .select("*") .eq("id", postId) .single()
Insert (Create Data)
Insert is straightforward.
javascriptconst { data, error } = await supabase .from("posts") .insert({ title: "My post", content: "Hello world" })
Multiple rows:
javascript.insert([ { title: "Post 1" }, { title: "Post 2" } ])
Return inserted data
Add .select().
javascriptconst { data } = await supabase .from("posts") .insert({ title: "Hello" }) .select()
Useful when you need the new id.
Update
Update rows with a filter.
javascriptconst { data, error } = await supabase .from("posts") .update({ title: "Updated title" }) .eq("id", postId)
Without a filter, it updates every row.
That’s a mistake most people make once.
Delete
Delete also requires a filter.
javascriptawait supabase .from("posts") .delete() .eq("id", postId)
Again, no filter means deleting everything.
Ordering
Sort results.
javascript.order("created_at", { ascending: false })
Example:
javascriptconst { data } = await supabase .from("posts") .select("*") .order("created_at", { ascending: false })
Limit
Limit rows returned.
javascript.limit(10)
Example:
javascriptconst { data } = await supabase .from("posts") .select("*") .limit(10)
Pagination
Use .range().
javascript.range(0, 9)
Example:
javascriptconst { data } = await supabase .from("posts") .select("*") .range(0, 9)
This returns rows 0–9.
Joins
Supabase uses PostgREST syntax.
Example:
javascriptconst { data } = await supabase .from("posts") .select("*, profiles(username)")
This joins the profiles table.
Example result:
plaintextpost └ profile.username
Auth (Quick Syntax)
Get the current user:
javascriptconst { data } = await supabase.auth.getUser()
Sign in:
javascriptawait supabase.auth.signInWithPassword({ email, password })
Sign up:
javascriptawait supabase.auth.signUp({ email, password })
Sign out:
javascriptawait supabase.auth.signOut()
Storage
Upload a file.
javascriptawait supabase.storage .from("avatars") .upload("user.png", file)
Get public URL:
javascriptsupabase.storage .from("avatars") .getPublicUrl("user.png")
RPC (Calling Database Functions)
If you define a Postgres function, call it like this:
javascriptconst { data } = await supabase .rpc("get_popular_posts")
With parameters:
javascript.rpc("get_posts_by_user", { user_id: userId })
The Pattern Behind Everything
After using Supabase for a while, you notice something simple.
Almost every query follows the same structure.
supabasesupabase .from(table) .action() .filter() .modifier()
Examples:
supabase.from().select() .from().insert() .from().update() .from().delete()
Once that clicks, the API feels predictable.
What I Actually Remember
When working quickly, I don’t remember the whole API.
I remember a few patterns:
.from("table").select("*").insert({}).update({}).eq().delete().eq().order().limit()
Everything else can be looked up.
A Small Lesson About Tools
Most tools feel complex at first.
But good tools have a small core idea.
For Supabase, it’s this:
plaintextPick a table. Choose an operation. Add filters.
That’s most of the API.
Once you see the pattern, the documentation becomes easier to navigate.
