Introduction to Using Supabase with Node.js: Build a Simple Todo App



This content originally appeared on DEV Community and was authored by Humphery

Hey there! 👋 Today, we’re going to have some fun building a simple Todo app using Supabase and Node.js. Don’t worry if you’re a beginner, I’ll explain everything step by step!

What is Supabase?

Supabase is an open-source platform that provides:

  • A real-time database
  • Authentication for users
  • Storage for files
  • Serverless functions

It helps you build backend features quickly without writing everything from scratch.

Prerequisites

Before we start, make sure you have:

  • Node.js installed
  • Basic knowledge of JavaScript
  • A Supabase account (sign up free at supabase.com)

Step 1: Create a Supabase Project

  1. Go to the Supabase dashboard.
  2. Click “New Project”.
  3. Give it a name, pick a password, and wait for it to create.
  4. Once created, go to Settings → API and copy:
  • Project URL
  • Anon key

We’ll need these in our code!

Step 2: Create a Table

We need a table to store our todos.

  • Go to Database → Tables → New Table
  • Call it todos and add columns:
Column Name Type Notes
id uuid Primary key, default gen_random_uuid()
task text The todo description
inserted_at timestamptz Default now()

Save the table, and we’re ready to code! 🎉

Screenshot of the Supabase todos table with columns id, task, and inserted_at

Note: Here we see the todos table in Supabase with columns id, task, and inserted_at.

Step 3: Setup Node.js Project

  1. Open a terminal and create a folder:
mkdir supabase-todo
cd supabase-todo
npm init -y
  1. Install Supabase JS:
npm install @supabase/supabase-js

Step 4: Write Your First Script

Create a file called index.js and paste this code:

// Import Supabase
const supabase = require('@supabase/supabase-js').createClient;

// Replace with your own URL + anon key
const supabaseUrl = "https://YOUR_PROJECT_URL.supabase.co";
const supabaseKey = "YOUR_ANON_KEY";

const client = supabase(supabaseUrl, supabaseKey);

// Insert a todo
async function addTodo() {
  const { data, error } = await client
    .from('todos')
    .insert([{ task: 'Learn Supabase basics' }]);
  console.log('Insert:', data, error);
}

// Fetch all todos
async function fetchTodos() {
  const { data, error } = await client
    .from('todos')
    .select('*');
  console.log('Todos:', data, error);
}

// Run example
(async () => {
  await addTodo();
  await fetchTodos();
})();

Step 5: Run Your Code

In your terminal, run:

node index.js

If everything works, you’ll see something like this:

[
  {
    "id": "990e6e73-e1fa-4d0b-ab69-be85ebf192e6",
    "task": "Learn Supabase basics",
    "inserted_at": "2025-09-24T08:03:58.157706+00:00"
  }
]
null
  • The array shows your todos
  • null means no errors 🎉

Step 6: Next Steps

You can now:

  • Add more todos with addTodo()
  • Fetch and display them using fetchTodos()
  • Later, you can build a web or CLI app around it

Supabase makes it super easy to expand your project. 🚀

Conclusion

Congrats! 🥳 You just built your first Supabase Todo app using Node.js.

Supabase + Node.js is a powerful combo for beginners and pros alike. Now you can explore authentication, storage, or even real-time updates.

Go ahead, play around, and build something amazing!


This content originally appeared on DEV Community and was authored by Humphery