Developer Onboarding & Local Setup
Welcome to the Planovi Backend engineering team. This guide walks you through setting up your local workstation to develop, test, and debug Supabase Edge Functions.
Prerequisites
Before starting, ensure your workstation has the following tools installed:
| Tool | Minimum Version | Installation Command / Link |
|---|---|---|
| Deno | v1.38.0+ | irm https://deno.land/install.ps1 | iex (Windows) or curl -fsSL https://deno.land/install.sh | sh |
| Supabase CLI | v1.120.0+ | scoop bucket add supabase https://github.com/supabase/scoop-bucket.git && scoop install supabase |
| Docker Desktop | Latest | Required for running local Supabase database and Edge Runtime containers |
| Node.js | v18.0.0+ | Required for building the documentation portal (docs/) |
1. Clone & Environment Configuration
Clone the repository and inspect the Edge Functions directory:
git clone https://github.com/PA-IDEAS/planovi-backend.gitcd planovi-backendCreate a local environment secrets file:
# In supabase/cp supabase/.env.example supabase/.env.localPopulate the following development variables in supabase/.env.local:
SUPABASE_URL=http://127.0.0.1:54321SUPABASE_ANON_KEY=your-local-anon-keySUPABASE_SERVICE_ROLE_KEY=your-local-service-role-keyGEMINI_API_KEY=your-gemini-test-keyINCHARGE_USERNAME=test_userINCHARGE_PASSWORD=test_password2. Running Local Edge Functions
Start the Local Supabase Stack
# Starts local PostgreSQL, Auth, Storage, and Kong gatewaysupabase startServe Edge Functions Locally
To run all 35 Edge Functions with hot-reload enabled:
supabase functions serve --env-file ./supabase/.env.local --no-verify-jwt[!TIP] The
--no-verify-jwtflag is helpful during local backend development so you can invoke functions directly using curl or Postman without generating real user JWTs.
3. Invoking Functions Locally
You can test any function by sending an HTTP POST request to http://localhost:54321/functions/v1/<function-name>:
Example: Testing ingest-telemetry
curl -i --location --request POST 'http://localhost:54321/functions/v1/ingest-telemetry' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <your-local-anon-key>' \ --data '{ "device_id": "test_inverter_01", "coop_id": "00000000-0000-0000-0000-000000000000", "metrics": { "solar_power_kw": 10.5, "voltage_l1": 230.1 } }'Example: Testing Health Endpoint (main)
curl -i http://localhost:54321/functions/v1/main4. Running the Documentation Portal Locally
To launch the interactive documentation site locally:
cd docsnpm installnpm run devNavigate to http://localhost:4321 in your browser. All architecture diagrams, search indexes, and function guides will be available with hot-reloading.