main
branch for prod
dev
branch for dev
DON'T FORGET TO FILL ALL .ENV
pnpm install
You need to create a .env.local
file with the following the .env.example
file. If you haven't start supabase locally, go to the Run supabase locally section.
pnpm run dev
npm install -g supabase-cli
or
brew install supabase-cli
Before running supabase you need to create a .env
file with the following variables following the .env.example
file.
Then you can start supabase with:
supabase start
Error: Error evaluating "env(DISCORD_CLIENT)": environment variable DISCORD_CLIENT is unset.
Because we are using env variable in the supabase config file, you need to first source the .env
file with source .env
.
For example if you are at the root of the project you can run this command to source the .env
file.
source ./supabase/.env
Then you can restart the supabase server.
If you have a PR with a new migrations you don't need to do something special. When you will merge your new branch on dev
a github action will start and check if the current file supabase_types
is up to date.
The migration will be automatically applied when you merge on main
.
Unlike manual migrations, auto schema diff creates a new migration script from changes already applied to your local database.
Create an employees table under the public schema using Studio UI, accessible at localhost:54323 by default.
Next, generate a schema diff by running the following command:
supabase db diff -f new_employee
supabase migration new name_of_migration
You should see a new file created: supabase/migrations/<timestamp>_name_of_migration.sql
. You can then write SQL statements in this script using a text editor:
create table public.example (
id integer primary key generated always as identity,
name text
);
Apply the new migration to your local database:
supabase db reset
This command recreates your local database from scratch and applies all migration scripts under supabase/migrations directory. Now your local database is up to date.
The tomato.py
file in the cli
directory is a custom CLI for repetitive tasks.
To use it you need to follow this steps:
-
Install python requirements:
pip install -r cli/requirements.txt
-
Create a
.env
file with the following variables (see https://app.supabase.com/dashboard/project/_/settings/general):
SUPABASE_PROJECT_ID=
- Source the
source_me
file every time you start a new working session:
source source_me
Or add this line to your .bashrc
or .zshrc
depending on which on you use:
alias tmt="python3 /path/to/tomato/cli/tomato.py"
- Now you can use the CLI with
tmt
command
tmt db_types
: Generate typescript types for supabase tablestmt db_migrate
: Apply pending database migration to your local supabase instancetmt db_reset
: Reset your local database and apply all the migrationstmt db_types
: Generates the supabase database types for typescript developmenttmt setup
: Install all the project dependencies needed by node.jstmt start
: Start the supabase local instance with the environments loadedtmt stop
: Stop the supabase local instance
You can see each one off these by doing:
tmt -h
tmt db_reset
- Aller sur http://localhost:54323/project/default/database/hooks et Cliquer sur modifier le webhook
- Changer l'url avec
http://host.docker.internal:54321/functions/v1/handle_scan_insert
- Remplacer le header Authorization avec
Bearer your_anon_token
- Remplir le
tomato-x-edge-token
avecsuper-secret-jwt-token-with-at-least-32-characters-long
- Creer un
.env
dans./supabase
et le remplir avec
export RESEND_API_KEY=ask_me_in_dm
export TOMATO_EDGE_TOKEN=super-secret-jwt-token-with-at-least-32-characters-long
export TOMATO_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
- Inserer le jwt token dans supabase, tu va dans l'invite de commande sql de supabase en local et tu execute ça
insert into vault.secrets (name, secret)
values ('tomato-jwt-token', 'super-secret-jwt-token-with-at-least-32-characters-long') returning *;
- Ouvrir un nouveau terminal et lancer
tmt fn_run
- Et apres tu creers un item, tu le marque en lost et tu ouvre la page de qrcode sur une nav privée. Si t'as besoin d'aide demande