-
Before cloning the repository, ensure you have supabase and docker installed on your machine. You can install supabase using the following commands:
# macOS / Linux brew install supabase/tap/supabase # Windows (using Scoop) scoop bucket add supabase https://github.com/supabase/scoop-bucket.git scoop install supabase # Alternative: Using npm globally pnpm add -g supabase
-
Clone the repository
git clone https://github.com/PoliTo-Rocket-Team/website-v2.git
-
Make sure docker is running in the background and run:
Supabase start
This will start the supabase server on your local machine. In the first run, it will take some time to setup.
-
While supabase is setting up, dublicate the .env.example file in the root directory and rename it to .env. This file will contain the environment variables for the project.
-
After supabase setup is complete, you will see api url and anon key in the terminal. Copy and paste them in the .env file in the root directory of the project.
-
For google client id and secret, you should have the google api credentials. You can get them from the google cloud console. Copy and paste the client id and secret in the .env file in the root directory of the project.(if you don't have, contact the team)
-
Once you have the .env file setup, you can run the following commands to start the project:
pnpm install pnpm dev
This will start the project on localhost:3000
-
pnpm dev
- Start the development server -
supabase start
- Start the supabase server -
supabase stop
- Stop the supabase server -
supabase db reset
- Reset the supabase database -
supabase studio
- Open the supabase studio in the browser -
pnpm generate:supabase-types
- Generate types for supabase queries
-
Create a new table in the supabase studio which is localhost:54323 by default.
-
Next, generate a schema diff by running the following command:
supabase db diff -f <migration_name>
You can set migration name to anything you want.
-
This will generate a migration file in the
supabase/migrations/<timestamp>_<migration_name>.sql
.
If you want to make some changes in production and development databases, you should push the migration file to the repository.
For more detailed information about managing environments, you can refer to the supabase documentation