This guide walks you through setting up PRFC Outreach for local development.
- Git
- fnm (Fast Node Manager)
- Docker Desktop
- VS Code (recommended)
fnm manages Node.js versions. It reads the .nvmrc file and switches to the correct version automatically.
macOS/Linux:
curl -fsSL https://fnm.vercel.app/install | bashWindows:
winget install Schniz.fnmAfter installing, restart your terminal and enable auto-switching:
# Add to your shell profile (.bashrc, .zshrc, etc.)
eval "$(fnm env --use-on-cd)"git clone https://github.com/hack4impact-calpoly/prfc-outreach.git
cd prfc-outreachfnm will read .nvmrc and install the correct version.
fnm install
fnm useVerify you're on the right version:
node -v # Should show v22.xnpm installStart MySQL using Docker:
npm run docker:upThis starts MySQL on port 3306 and Adminer (database UI) on port 8080.
Copy the example file:
cp .env.local.example .env.localThe example fills in the database connection and feature flags for local dev. A few values are placeholders you must replace with real ones, or the app fails its startup validation:
FIELD_ENCRYPTION_KEY,BLIND_INDEX_KEY- 64-character hex keys. Generate each withopenssl rand -hex 32.UNSUBSCRIBE_SECRET- at least 32 characters. Generate withopenssl rand -base64 32.
Email and SMS are off locally (EMAIL_ENABLED=false, SMS_ENABLED=false), and USE_MOCK_MEMBER_API=true uses the in-repo mock member list, so you do not need Brevo, Upstash, or portal credentials to run locally. PRFC_PORTAL_SECRET uses a dev fallback when unset.
Set up the database schema:
npx prisma migrate devnpm run devVisit http://localhost:3000. You should see the public referral form.
Logging in for protected pages is currently a gap. The app gates protected pages (home, groups, events, messages) behind a signed portal session. The local mock-portal that used to mint dev tokens was removed during production hardening, and a human-facing local-login flow is not wired up yet. The e2e suite works around this by minting the prfc_auth session cookie directly in e2e/auth.setup.ts, so the authenticated tests still run, but there is no dev UI for a person to log in. Until one lands, you can run the public referral form locally, while reaching protected pages in a browser needs either a real portal click-through or a manually set session cookie. This is a known item for the next team.
Install these VS Code extensions:
Enable format on save:
- Open Settings (Cmd/Ctrl + ,)
- Search "default formatter" -> select Prettier
- Search "format on save" -> check the box
Development:
npm run dev- Start dev server at localhost:3000npm run build- Build for productionnpm run lint- Check code stylenpm run lint:fix- Auto-fix style issuesnpm test- Run tests
Database:
npm run docker:up- Start MySQL containernpm run docker:down- Stop MySQL containernpx prisma studio- Open database GUInpx prisma migrate dev- Run migrations
prfc-outreach/
├── .github/ # GitHub Actions and templates
├── docs/ # Documentation
├── prisma/ # Database schema and migrations
├── public/ # Static assets
├── src/
│ ├── app/ # Next.js pages and API routes
│ ├── actions/ # Server Actions
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Server integrations (db, dal, rate-limit)
│ ├── schema/ # Zod validation schemas
│ ├── services/ # Business logic
│ ├── types/ # Shared cross-layer interfaces
│ ├── utils/ # Helper functions
│ └── proxy.ts # Cookie gate for protected paths
└── test/ # Test files
Port 3306 already in use: Stop any existing MySQL process or change the port in docker-compose.yml.
Prisma client errors: Regenerate the client:
npx prisma generateNode version mismatch: Make sure fnm is using the correct version:
fnm useOnce your environment is running, read Contributing to learn the development workflow.