Web app (temporary): https://ladysmithtrailstewards.vercel.app/
Web application for the Ladysmith Trail Stewards — a trail stewardship organization in Ladysmith, BC, Canada. Provides public-facing information, user authentication with role-based access control, and an admin dashboard with interactive GIS trail mapping.
Planned work is tracked as specs — the source of truth for all features, bugs, and chores. Issues and PRs are derived from specs.
| Tool | Version | Install |
|---|---|---|
| Node.js | 20+ | nodejs.org |
| pnpm | latest | npm i -g pnpm |
| Docker Desktop | latest | docker.com |
| Supabase CLI | latest | brew install supabase/tap/supabase |
| Mapbox account | — | mapbox.com — free tier is sufficient |
git clone https://github.com/ladysmith-trail-stewards/lts.git
cd lts
pnpm installcp .env.example .envOpen .env and fill in your values. For local development use the local Supabase values (see step 3). For production use the Supabase cloud dashboard values.
Required variables:
| Variable | Where to get it |
|---|---|
VITE_SUPABASE_URL |
http://127.0.0.1:54321 (local) or Supabase cloud dashboard |
VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY |
supabase status → Publishable key |
VITE_SUPABASE_SECRET_KEY |
supabase status → Secret key — integration tests only, never in browser code |
VITE_MAPBOX_ACCESS_TOKEN |
Mapbox account tokens page |
Docker Desktop must be running first.
pnpm db:start # starts Supabase containers (first run pulls images — takes a minute)
pnpm db:reset # applies migrations, seeds data, and generates POLICIES.mdAfter db:start, run supabase status to get your local keys and paste them into .env.
pnpm dev # http://localhost:5173Available after pnpm db:reset (password: password123):
| Role | |
|---|---|
[email protected] |
user |
[email protected] |
super_user |
[email protected] |
admin |
[email protected] |
super_admin |
- A new user signs up via Google SSO (production) or email/password (dev).
- A profile is automatically created with:
role = userregion_id = 0(Default — no region assigned yet)
- The user can access the site but has limited permissions until an admin assigns them a region and/or a higher role.
Not yet implemented — user role and region management should eventually be handled through the admin UI at /users. For now use the dashboard options below.
- Run
pnpm db:studioto open Studio athttp://127.0.0.1:54323. - Navigate to Table Editor → profiles.
- Find the user row (match on
nameorauth_user_id). - Click the row to edit:
- Set
region_idto1(Ladysmith) or whichever region applies. - Set
roletouser,super_user,admin, orsuper_admin.
- Set
- Save.
Or use the SQL Editor:
update public.profiles
set role = 'admin', region_id = 1
where auth_user_id = '<uuid>';- Go to supabase.com/dashboard and open the project.
- Navigate to Table Editor → profiles.
- Find the user row and click to edit:
- Set
region_idto the appropriate region. - Set
roleto the desired value.
- Set
- Save.
Or use the SQL Editor (left sidebar):
update public.profiles
set role = 'admin', region_id = 1
where auth_user_id = '<uuid>';To find a user's UUID: Authentication → Users → copy the UID from the user's row.
⚠️ Onlysuper_adminusers should promote others toadminorsuper_admin.
# Development
pnpm dev # dev server on :5173
pnpm build # TypeScript check + production build
pnpm lint # ESLint
pnpm format # Prettier
# Database
pnpm db:start # start local Supabase (API :54321, Studio :54323)
pnpm db:stop # stop containers
pnpm db:reset # ⚠️ full reset — drops all data, re-runs migrations + seed, regenerates types + POLICIES.md
pnpm db:migrate # apply pending migrations only (no data loss), regenerates types + POLICIES.md
pnpm db:types # regenerate src/lib/supabase/database.types.ts
pnpm db:policies # regenerate supabase/POLICIES.md from live DB
# Backup / restore — see supabase/BACKUP.md for full instructions
# Uses `supabase db dump` (CLI) or `pg_dump` directly; works on free tier
# Testing
pnpm test # unit tests only
pnpm test:integration # integration tests (requires local Supabase running)
pnpm test:all # all testssrc/
components/ # React components (ui/ for shadcn primitives)
pages/ # One file per route
lib/
supabase/ # Supabase client + auto-generated database.types.ts
db_services/ # Typed wrappers around Supabase operations + integration tests
map/ # Mapbox config
supabase/
migrations/ # SQL migrations (source of truth for schema + RLS)
POLICIES.md # Auto-generated RLS policy snapshot (pnpm db:policies)
seed.sql # Local dev seed data
scripts/ # Developer tooling (policy extraction, pre-PR docs)
- Never commit secrets — no
.env, API keys, orservice_rolekeys in git VITE_SUPABASE_SECRET_KEYis for tests only — never import it in browser code- RLS is the security boundary — access control is enforced by Postgres policies, not application logic. See
supabase/POLICIES.mdfor the active policy matrix
For questions about this website or the Ladysmith Trail Stewards organization, please use the contact form on the website or join our Facebook Group.
© 2026 Ladysmith Trail Stewards. All rights reserved.