- Go to supabase.com
- Sign up/login and create a new project
- Choose a project name and set a database password
- Wait for the project to be created
From your Supabase project dashboard:
-
Go to Settings → API
-
Copy the following values to your
.envfile:- Project URL →
SUPABASE_URL - anon public key →
SUPABASE_ANON_KEY - service_role secret key →
SUPABASE_SERVICE_ROLE_KEY
- Project URL →
-
Go to Settings → API → JWT Settings
- Copy JWT Secret →
SUPABASE_JWT_SECRET
- Copy JWT Secret →
Run this SQL in your Supabase SQL Editor:
-- Enable Row Level Security
ALTER TABLE IF EXISTS properties ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS units ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS tenants ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS leases ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS payments ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS maintenance_requests ENABLE ROW LEVEL SECURITY;
ALTER TABLE IF EXISTS documents ENABLE ROW LEVEL SECURITY;
-- Create RLS policies (users can only access their own data)
CREATE POLICY "Users can view their own properties" ON properties FOR SELECT USING (owner_id = auth.uid()::text);
CREATE POLICY "Users can insert their own properties" ON properties FOR INSERT WITH CHECK (owner_id = auth.uid()::text);
CREATE POLICY "Users can update their own properties" ON properties FOR UPDATE USING (owner_id = auth.uid()::text);
CREATE POLICY "Users can delete their own properties" ON properties FOR DELETE USING (owner_id = auth.uid()::text);
-- Similar policies for other tables...- Go to Authentication → Settings
- Enable the authentication methods you want (Email, Google, etc.)
- Set up redirect URLs if needed
- Go to Storage
- Create buckets for:
property-imagesdocumentsreceipts
Run the development server:
npm run devThe API will be available at http://localhost:5000