Set up a free cloud database so your products and orders are shared across all devices and browsers.
Go to supabase.com β Sign up for free β New project.
Choose a project name (e.g. bioharvest), set a database password, and pick the region closest to Morocco (e.g. West EU).
In your Supabase project β Settings (gear icon) β API.
Copy these two values and paste them below:
supabase-config.js. The anon key is safe to expose in client-side code β Supabase Row Level Security controls data access.In Supabase β SQL Editor β New query β paste and run this SQL:
-- ββ BioHarvest Database Schema ββββββββββββββββββββββββββ
-- PRODUCTS table
create table if not exists products (
id text primary key,
name text not null,
name_ar text default '',
category text not null,
price numeric not null default 0,
unit text default '',
unit_ar text default '',
description text default '',
description_ar text default '',
badge text default '',
badge_ar text default '',
emoji text default 'πΏ',
image text default null,
organic boolean default true,
created_at timestamptz default now()
);
-- ORDERS table
create table if not exists orders (
id text primary key,
ref text not null,
status text default 'new',
source text default 'whatsapp',
customer_name text default '',
customer_phone text default '',
note text default '',
items jsonb default '[]',
subtotal numeric default 0,
delivery numeric default 0,
discount numeric default 0,
total numeric default 0,
created_at timestamptz default now()
);
-- Enable Row Level Security (keeps data private)
alter table products enable row level security;
alter table orders enable row level security;
-- Allow public read on products (storefront needs to read them)
create policy "Public can read products"
on products for select
using (true);
-- Allow anon key full access (admin uses same key)
create policy "Anon full access products"
on products for all
using (true) with check (true);
create policy "Anon full access orders"
on orders for all
using (true) with check (true);
If you already have products saved locally in your browser, click below to push them to Supabase.
Once configured: