SYNCRO uses the Supabase CLI to manage database migrations.
All migration files live in supabase/migrations/ and are applied in lexicographic order.
supabase/migrations/ is the canonical migration source of truth for this repository.
Legacy SQL snapshots under backend/migrations/ and backend/scripts/ are kept for reference only.
Install the Supabase CLI:
# macOS / Linux (Homebrew)
brew install supabase/tap/supabase
# Windows (Scoop)
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase
# npm (any platform)
npm install -g supabase# 1. Start the local Supabase stack (Postgres + Studio + Auth)
supabase start
# 2. Apply all pending migrations
npm run db:migrate # from /backend, or: supabase db push
# 3. Seed local database with test data
supabase db reset # applies migrations + seed.sql automaticallyThe local Studio UI is available at http://localhost:54323.
Always use the CLI to generate migration files — this ensures the timestamp prefix is correct:
# From the repo root
supabase migration new <description>
# e.g. supabase migration new add_notifications_tableThis creates supabase/migrations/YYYYMMDDHHMMSS_<description>.sql.
Write your SQL in that file, then apply it locally with supabase db push.
YYYYMMDDHHMMSS_short_description.sql
Examples:
20240115000000_create_push_subscriptions.sql20240117000000_add_2fa_tables.sql
| Environment | Command |
|---|---|
| Local | npm run db:migrate |
| Production | npm run db:migrate:prod (requires PRODUCTION_DB_URL env var) |
| Reset local | npm run db:reset |
Supabase does not support automatic down migrations. For each migration that makes destructive changes, document the manual rollback steps in a comment block at the top of the migration file:
-- ROLLBACK:
-- ALTER TABLE public.example DROP COLUMN IF EXISTS new_column;For non-destructive migrations (adding tables, indexes, columns with defaults), the rollback is simply dropping the added object.
Every pull request that touches supabase/migrations/ triggers the
.github/workflows/database.yml workflow, which:
- Starts a fresh local Supabase stack
- Applies all migrations from scratch (
supabase db push) - Runs
supabase db lintto catch SQL issues
Changes under backend/migrations/ and backend/scripts/ are not part of the canonical migration validation path.
A PR cannot be merged if this workflow fails.
supabase/seed.sql contains fake data for local development only.
It is applied automatically by supabase db reset.
Use the same seed file for local development and E2E bootstrap runs.
Never add real emails, payment data, or any PII to seed.sql. Thank you for your interest in contributing! This guide will help you set up the project, follow conventions, and submit high-quality contributions.
- Node.js >= 20
- npm (bundled with Node.js — do not use yarn or pnpm)
- Supabase CLI (for database)
- (Optional) Stellar CLI for contract interactions
git clone https://github.com//SYNCRO.git cd SYNCRO
cd backend cp .env.example .env # Fill in required values npm install npm run dev
cd client cp .env.example .env.local # Fill in required values npm install npm run dev
supabase db push
Environment variables are defined in .env.example.
Key variables include:
SUPABASE_URL– Supabase project URLSUPABASE_KEY– API keyJWT_SECRET– Secret for authenticationREDIS_URL– Redis connection (if used)EMAIL_SERVICE– SMTP configuration
Ensure all required variables are set before running the app.
Use the following format: feat/add-feature-name fix/bug-description chore/update-dependencies docs/update-readme test/add-unit-tests
Use the following format: feat/add-feature-name fix/bug-description chore/update-dependencies docs/update-readme test/add-unit-tests
- Reference the issue: Closes #
- Ensure all tests pass
- Include a clear description of changes
- Add a test plan (how reviewers can verify)
- Keep PRs focused and small
- No
anytypes - Avoid unsafe non-null assertions
- No hardcoded secrets
- Validate all inputs (use Zod where applicable)
Required for:
- New endpoints
- Bug fixes
- Business logic
- Code builds successfully (npm run build)
- Tests pass (npm test)
- Environment variables configured
- No lint or type errors
- PR description completed
If you encounter any issues with the branch protection or have questions about the contribution process:
- Check existing issues on GitHub
- Open a new issue with details about your problem
- Ask for help in discussions or pull request comments
- Be respectful and professional in all interactions
- Provide constructive feedback in reviews
- Help newer contributors learn and improve
- Report any code of conduct violations to the maintainers
Thank you for helping make Synchro better! 🚀
When completing an issue, any long-form implementation artifacts, summaries, or delivery notes must be stored in the docs/archive/ directory rather than the repository root. This keeps the root directory clean and ensures that active project entrypoints are easy to find.