# Start the development server
yarn supabase start
# Stop the development server
yarn supabase stop
# Reset the database from the migrations
yarn supabase db reset
# Login to Supabase
yarn supabase login
# Generate types
yarn types:supabase
# Generate types from the local database
yarn types:supabase:local
# Run the tests
yarn test
# Build the application for production:
yarn run build
# Locally preview production build:
yarn run preview
To enable Github OAuth locally, you need to create a new OAuth application on Github.
- Go to your Github account settings by clicking on your profile picture in the top right corner and selecting
Settings
. - Navigate to
Developer settings -> OAuth Apps
. - Select
New OAuth App
. - Fill in the form with the following data:
- Application name:
your dev app name
- Homepage URL: http://localhost:3000
- App description:
your app description
- Authorization callback URL: http://localhost:54321/auth/v1/callback
- Enable Device Flow (empty)
- Application name:
Now you can add the GITHUB_CLIENT_ID
and GITHUB_SECRET
to your .env
file.
These are needed only for the development environment.
For the production environment, you need to create a new OAuth application on Github.
- Open the Supabase admin panel and navigate to
Authentication -> Providers
. - Enable the Github provider (keep this tab open for later).
- Go to your Github account settings by clicking on your profile picture in the top right corner and selecting
Settings
. - Navigate to
Developer settings -> OAuth Apps
. - Select
New OAuth App
. - Fill in the form with the following data:
- Application name:
your app name
- Homepage URL:
your final domain
- App description:
your app description
- Authorization callback URL:
your final domain/auth/v1/callback
(provided by Supabase in the Github Auth Providers settings)
- Application name:
- Click
Register application
.
Note
Domain changes and redirection issues
If you need to change the domain, from some temporary to the final one, you can encounter issues with the incorrect redirection.
In this case, you need to change the Authorization callback URL
in the Github OAuth App settings but also
the Site URL in the Supabase settings Authentication -> URL Configuration -> Site URL
.
To access the Supabase admin panel, open http://127.0.0.1:54323 in your browser.
# Create a new migration
yarn supabase migration new <migration-name>
Write the migration in the newly created file in the /supabase/migrations
directory.
# Apply the migration
yarn supabase db reset
More about possible ways to manage migrations can be found in the Supabase documentation.
# So far the Supabase CLI should be installed as a dev dependency.
# If "supabase" is not recognized, you can force it by reinstalling the package
yarn install supabase -D
# Login to Supabase
yarn supabase login
# Link the project to the Supabase project
yarn supabase link --project-ref <project-id>
Assuming that a new migration was created locally, you can push it to the production environment.
# Pull the database schema first public
yarn supabase db push
In case you've made some changes to the database schema in the production environment,
you can pull these changes to your local environment.
# Pull the database schema first public
yarn supabase db pull
# Update remote migration history table? [Y/n]
Y
# Pull the database schema for auth, storage
yarn supabase db pull --schema auth,storage
# Update remote migration history table? [Y/n]
Y
# Apply changes locally (including seeding the buckets)
yarn supabase db reset
# To seed buckets manually run
yarn supabase seed buckets
To start with testing you will need a .env.test
file.
- configure
.env
file as mentioned in theREADME.md
in the section Installation - copy it
- rename to
.env.test
.
To run the tests, use the following command:
# Prepare the test environment
yarn playwright install
# Start the local project - required for the e2e tests
yarn dev
# Run the tests
yarn test