Kimkorng / Note / Database / MAR 16, 2026

Supabase Quick Docs

Supabase Quick Docs

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:

supabase
supabase .from("table") .operation(...)

If you remember that, the rest becomes predictable.

Setup

Create a client first.

JavaScript icon
javascript
import { 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.

JavaScript icon
javascript
const { 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:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("id, title")

Filter rows

supabase
.eq(column, value)

Example:

JavaScript icon
javascript
const { 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:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("*") .eq("id", postId) .single()

Insert (Create Data)

Insert is straightforward.

JavaScript icon
javascript
const { data, error } = await supabase .from("posts") .insert({ title: "My post", content: "Hello world" })

Multiple rows:

JavaScript icon
javascript
.insert([ { title: "Post 1" }, { title: "Post 2" } ])

Return inserted data

Add .select().

JavaScript icon
javascript
const { data } = await supabase .from("posts") .insert({ title: "Hello" }) .select()

Useful when you need the new id.

Update

Update rows with a filter.

JavaScript icon
javascript
const { 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.

JavaScript icon
javascript
await supabase .from("posts") .delete() .eq("id", postId)

Again, no filter means deleting everything.

Ordering

Sort results.

JavaScript icon
javascript
.order("created_at", { ascending: false })

Example:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("*") .order("created_at", { ascending: false })

Limit

Limit rows returned.

JavaScript icon
javascript
.limit(10)

Example:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("*") .limit(10)

Pagination

Use .range().

JavaScript icon
javascript
.range(0, 9)

Example:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("*") .range(0, 9)

This returns rows 0–9.

Joins

Supabase uses PostgREST syntax.

Example:

JavaScript icon
javascript
const { data } = await supabase .from("posts") .select("*, profiles(username)")

This joins the profiles table.

Example result:

plaintext
post └ profile.username

Auth (Quick Syntax)

Get the current user:

JavaScript icon
javascript
const { data } = await supabase.auth.getUser()

Sign in:

JavaScript icon
javascript
await supabase.auth.signInWithPassword({ email, password })

Sign up:

JavaScript icon
javascript
await supabase.auth.signUp({ email, password })

Sign out:

JavaScript icon
javascript
await supabase.auth.signOut()

Storage

Upload a file.

JavaScript icon
javascript
await supabase.storage .from("avatars") .upload("user.png", file)

Get public URL:

JavaScript icon
javascript
supabase.storage .from("avatars") .getPublicUrl("user.png")

RPC (Calling Database Functions)

If you define a Postgres function, call it like this:

JavaScript icon
javascript
const { data } = await supabase .rpc("get_popular_posts")

With parameters:

JavaScript icon
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.

supabase
supabase .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:

plaintext
Pick a table. Choose an operation. Add filters.

That’s most of the API.

Once you see the pattern, the documentation becomes easier to navigate.

Share: