Course lesson

Query Data From Supabase Using Next.js

supabase-js is a JavaScript library that makes interacting with your Supabase database simple!

Duration
2 min
Access
Free
Transcript
Retained from source evidence

supabase-js is a JavaScript library that makes interacting with your Supabase database simple!

In this video, we install the package with npm using npm i @supabase/supabase.js. We then create a reusable Supabase client that can be used throughout our application.

Additionally, we create environment variables for the Supabase URL and key, which are available in our Next.js client. Exposing these values to the client is not a security risk, as we will be enabling Row Level Security in a future lesson.

Lastly, we tell Next.js that we would like to pre-render our landing page at build time, by exporting out a getStaticProps function. This ensures that our lesson data is only fetched once - when we rebuild our application - rather than each time to user visits the page.