Post

[HAI5016] Week 12: Supabase

[HAI5016] Week 12: Supabase

Due to many presentations, we’ll just have a short practical session today: setting up a Supabase project. Setting up the project takes some time in the background, so we’ll prepare it now to ensure everything is ready for next week’s class.

Although the syllabus mentions a “Pinecone vector store,” I’ve decided to introduce you to Supabase instead to store our data and vector embeddings. Supabase is built on top of PostgreSQL, a powerful, open-source, and extensible relational database that I’m a long term fan of. With Supabase, we can leverage all the features of PostgreSQL along with additional tools that make it even more versatile.

One key feature is the integration of pgvector, which makes Supabase an excellent choice for vector similarity searches. Additionally, the Supabase Studio provides a user rich visual interface for managing your database and even has an in-built AI SQL assistant writes and runs the SQL queries for you on your data! These are just two of the many great features that make Supabase so supa.

In today’s session, we’ll deploy a free project in a hosted Supabase environment, but you can also host it yourself using Docker.


Create a Supabase project

  1. Go to https://supabase.com/dashboard/sign-up
  2. Easily sign in with your GitHub account, or create a new account with your email address and create a password
  3. In case of the latter: check your email, click the verification link, and sign in
  4. On the first sign in, it will ask you to make a new organization. I suggest:
    • Name: SKKU
    • Type of organization: Educational
    • Plan: Free
  5. Click on the Create organization button
  6. It will ask you to make a new project. I suggest:
    • Organization: SKKU
    • Project name: HAI5016
    • Database Password: I suggest clicking the Generate a password link and then copy and save the password in a safe place
    • Region: Northeast Asia (Seoul)
  7. Click on the Create new project button

Setting up the project will take a few minutes, but will continue in the background. It’s okay to close your laptop and call it a day. See you next week!


Bonus: Talk with your database in VS Code

Github Codespaces Logo Did I already mention that Supabase is basically a pimped version of PostgreSQL? And GitHub Copilot ♥️ PostgreSQL.

To make working with PostgreSQL even more fun, I recommend installing the PG Chat Participant extension in VS Code. This extension makes it a breeze to write SQL queries and interact with your PostgreSQL database using the @pg copilot chat participant.
Simply make sure to have your DATABASE_URL saved into your .env file and you’re good to go! (for example: DATABASE_URL=postgresql://postgres:password@localhost:5432/postgres). In Supabase, you can get your DATABASE_URL by clicking the ‘Connect’ button in the upper-right corner of your project dashboard and copying the URI.

More info in the video below:

Disclaimer: This blog provides instructions and resources for the workshop part of my lectures. It is not a replacement for attending class; it may not include some critical steps and the foundational background of the techniques and methodologies used. The information may become outdated over time as I do not update the instructions after class.


Sources

This post is licensed under CC BY 4.0 by the author.