From 09448108141ff2775768697355475486b360db6e Mon Sep 17 00:00:00 2001 From: huazhuang80-star <295584745+huazhuang80-star@users.noreply.github.com> Date: Mon, 22 Jun 2026 21:30:01 +0800 Subject: [PATCH] docs: add Supabase local seed setup --- CONTRIBUTING.md | 50 +++++++++++++++++++++++++++++++++++++-- supabase/seed.sql | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 supabase/seed.sql diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e015aa..3ffcca5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,49 @@ -# Contributing +# Contributing to Secureflow -This is a guide to contributing to `scaffold-stellar-frontend` itself. Feel free to delete or modify it for your own project. +Thank you for contributing to Secureflow. This guide covers the common local setup path for the frontend, backend, contracts, and Supabase data model. + +## Prerequisites + +- Node.js 20+ +- npm +- Supabase CLI +- Rust and the Stellar/Soroban tooling when working on contracts + +## Local setup + +```bash +git clone https://github.com/Secureflow-protocol/secureflow.git +cd secureflow +npm install +``` + +Copy the environment examples used by the area you are changing, then start the app or service you need. + +## Supabase setup + +The repository includes Supabase migrations in `supabase/migrations/` and local seed data in `supabase/seed.sql`. + +```bash +supabase start +supabase db reset +``` + +`supabase db reset` recreates the local database, applies migrations, and loads the seed file. The seed data includes sample messages and notifications so the inbox and notification routes have records to return during local development. + +## Backend workflow + +```bash +cd backend +npm install +npm run dev +``` + +When changing API routes, keep request validation and Supabase table fields aligned with the migrations and seed data. + +## Pull request checklist + +- Keep the change focused on one issue or feature. +- Update docs when setup, migrations, routes, or environment variables change. +- Add or update tests for behavior changes when practical. +- Run the smallest relevant validation command and include it in the PR description. +- Do not commit secrets, private keys, wallet seed phrases, or Supabase service-role credentials. diff --git a/supabase/seed.sql b/supabase/seed.sql new file mode 100644 index 0000000..dc480c3 --- /dev/null +++ b/supabase/seed.sql @@ -0,0 +1,60 @@ +-- Local development seed data for Secureflow. +-- Run with: supabase db reset + +insert into public.messages ( + conversation_id, + sender_address, + recipient_address, + content, + read_at, + created_at +) values + ( + 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + 'Hi, I reviewed your milestone proposal and have one follow-up question.', + now(), + now() - interval '2 hours' + ), + ( + 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + 'GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'Thanks. I can provide the supporting file before the deadline.', + null, + now() - interval '90 minutes' + ) +on conflict do nothing; + +insert into public.notifications ( + wallet_address, + type, + title, + message, + read_at, + action_url, + data, + created_at +) values + ( + 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'milestone', + 'Milestone ready for review', + 'A freelancer submitted milestone evidence for your project.', + null, + '/approvals', + '{"escrowId":"local-escrow-001","milestone":1}'::jsonb, + now() - interval '1 hour' + ), + ( + 'GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + 'application', + 'Application received', + 'Your application was delivered to the job creator.', + now(), + '/jobs', + '{"jobId":"local-job-001"}'::jsonb, + now() - interval '30 minutes' + ) +on conflict do nothing;