In this lesson, we will be writing our first edge function. We will delve into the fundamentals of an edge function, understand its deployment process, explore debugging techniques, and much more. However, before we get started, we need to install the Supabase CLI.
Supabase CLI is a command line interface by Supabase that provides tools to develop projects locally, seamlessly deploy to the Supabase Platform, efficiently manage database migrations, and even auto-generate TypeScript types straight from our database schema.
Since there is a lot to talk about in Supabase CLI, we will learn about them in a later lesson. This lesson will only look into the parts required for developing and deploying edge functions.
Supabase CLI is available via npm, brew, as well as scoop. We can choose one of them based on our development environment. For instance, on MacOS and Linux systems, the CLI is easily accessible via Homebrew, which can be installed using the following command:
Once installation is successful, we can verify it by running
supabase -v command in our terminal. It will show the currently installed version if the installation is successful.
Now, we can navigate to our project’s root directory. First, we will link Supabase CLI to our Supabase account by logging in with our personal access token. The personal access token can be generated from the dashboard by following the command output instructions.