The portal helps HGBC staff manage first-time guest submissions and follow-up. It consists of a React dashboard and public intake form, an Express API, and a Supabase PostgreSQL database.
src/: React/Vite frontend; deployed as static files to cPanel by GitHub Actions.backend/: Node.js 22+ Express API; connects to Supabase with the server-only service-role key and issues its own versioned JWTs.shared/: role definitions used by both frontend and backend.supabase/migrations/: ordered, versioned database history and the source of truth for schema changes.backend/schema.sql: reference snapshot of the final schema; use the migration workflow below to initialize databases.
The API is deployed to Render. The frontend calls it using VITE_API_BASE_URL; when omitted, it uses /api.
- Node.js 22 or newer and npm.
- Docker, for the Supabase local database and migration checks.
- Supabase project credentials for running the API against a hosted database.
Install dependencies from the repository root:
npm ci
npm ci --prefix backendStart the local Supabase stack and apply the migration chain to its development database:
npm run db:start
npm run db:reset
npm run db:status
npm run db:testdb:reset recreates the local database and applies every migration. It deletes local database contents; do not use it to reset a hosted project. db:stop stops the local stack.
To run the application against the local Supabase stack, copy backend/.env.example to backend/.env, use the local URL and service-role key shown by npx supabase status, and set a unique JWT_SECRET of at least 32 bytes. Create a root .env.local for Vite:
VITE_API_BASE_URL=http://localhost:5000/apiThen start the API and frontend in separate terminals:
npm run dev --prefix backend
npm run devVite runs on port 3000 and the API defaults to port 5000. Keep .env, .env.local, database passwords, JWT secrets, and service-role keys out of Git. The backend rejects anon keys and requires SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, and a valid JWT_SECRET. CORS_ORIGIN is not currently consumed by the server.
Create new migrations with npx supabase migration new descriptive_name. Do not edit a migration after it has been applied; add a new forward migration instead. Run npm run db:verify to start a minimal local PostgreSQL stack, reset it from migrations, and run database schema tests. CI runs this check on pull requests and pushes to main.
For production, link the CLI to the intended Supabase project, inspect its migration history, preview pending migrations, and apply only after review:
npx supabase login
npx supabase link --project-ref <project-ref>
npx supabase migration list --remote
npx supabase db push --dry-run --remote
npx supabase db push --remoteExisting projects may have changes applied manually and no migration ledger. Follow the backend database migration guide to compare the live schema before marking verified migrations as applied. Never blindly replay the initial schema or use migration repair to conceal drift. The project does not retain database backups; schema rollback is not data recovery. Migrations should be additive where possible, and recovery from an incompatible change uses a reviewed forward fix.
npm run lint
npm test
npm run build
npm run db:verifynpm test runs backend authorization/API tests and frontend component tests. npm run db:verify requires Docker and validates that a fresh database can be built from the committed migrations.
- Frontend: GitHub Actions builds on pushes and pull requests to
main; successful pushes tomaindeploydist/to cPanel. ConfigureVITE_API_BASE_URLas a GitHub Actions repository variable for the deployed API URL. - Backend: Deploy the repository to Render with the repository root as the working directory so the shared role module is available. Use
npm ci --prefix backendas the build command andnpm start --prefix backendas the start command. Configure the required Supabase URL, service-role key, and JWT secret in Render's secret environment, and use/api/healthas the health check. - Database: Apply reviewed migrations before deploying code that depends on them. See the backend deployment and database guide.
The portal uses intake details for guest follow-up and outreach analysis. Prayer requests are optional. Administrators and pastors can access all submissions; team members can access only assigned submissions. Submissions and related interaction notes are deleted after 13 months. See the privacy and retention details.