Database

Set up your PostgreSQL database with Supabase in minutes.

This boilerplate has a PostgreSQL database set up with Supabase. Supabase is an open-source Firebase alternative that provides a real-time database, authentication, and storage.

If you prefer a different database provider, you can easily swap out Supabase with another provider like Firebase, Fauna, or Hasura.

Step 1: create your Supabase account (if you don't already have it)

In order to start, you need to create a Supabase account. You can do that here.

Step 2: create your table

After you have created an account, you need to create a table in the Supabase dashboard. You can create a table using SQL Editor or by clicking the "New Table" button in the Dashboard/Database/Tables.

sql

Step 3: get the API keys

After you have created a project, you need to get the API keys and fill in the `.env` file in the root of the project.

terminal

Step 4: get familiar with Supabase documentation

Supabase has a great documentation about database usage here.

And here's documentation for JavaScript specifically: https://supabase.com/docs/reference/javascript/select

Step 5 (optional): automatically generate TypeScript types

In order to get TypeScript types for your database, you can follow the documentation available in the `/routes/database-example/docs.md` route.

Take a look at the `/routes/database-example` route to see how to interact with the database.