-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Setup & Project Conventions
Owner(s): CrowdPM team | Last updated: 2026-03-08 | Status: Production
This page is the wiki-level onboarding guide for contributors. The repository docs remain the operational source for exact commands and environment details, but this page should be sufficient to explain:
- how the repo is organized;
- what local setup requires;
- what to expect from
pnpm dev; - which environment files matter;
- which conventions contributors must follow.
Top-level directories and files of interest:
-
frontend/— React + Vite application, map UI, dashboard UI, Firebase web config. -
functions/— Firebase Functions backend, Fastify API, pairing logic, ingest pipeline, tests. -
shared-types/— shared types/utilities used across workspaces. -
scripts/— local helper scripts such as the device emulator and simulation helpers. -
examples/esp32/CrowdPMNodeESP32/— hardware-oriented example node code. -
docs/— operational runbooks for local development, demo deployment, and production release. -
infra/— CI/CD and infrastructure automation assets. -
firestore.rules,storage.rules,firebase.json— security rules and emulator/deploy targets.
Install these once per workstation:
- Node.js 24.x
- pnpm 10.x
- Firebase CLI (
firebase loginrequired) - Python 3.12
- Java JDK 25
- Git 2.34+
- Google Cloud CLI (optional but useful for broader Google Cloud work)
From the repository root:
git clone git@github.com:denuoweb/CrowdPMPlatform.git
cd CrowdPMPlatform
pnpm install
cp .firebaserc.example .firebaserc
cp frontend/.env.example frontend/.env.local
cp functions/.env.example functions/.env.localThe local emulator workflow is intentionally pinned to a fake/demo-style local alias so contributors do not accidentally point routine development at a real Firebase project.
Important convention:
- use the local/demo alias for emulator work only;
- do not treat the local alias as a deploy target.
Expected values include:
VITE_API_BASEVITE_GOOGLE_MAPS_API_KEYVITE_GOOGLE_MAP_IDVITE_FIREBASE_API_KEYVITE_FIREBASE_AUTH_DOMAINVITE_FIREBASE_PROJECT_IDVITE_FIREBASE_STORAGE_BUCKETVITE_FIREBASE_MESSAGING_SENDER_IDVITE_FIREBASE_APP_ID-
VITE_FIREBASE_AUTH_EMULATOR_HOST(optional; used for local auth emulator) VITE_SMOKE_TEST_USER_EMAIL
Conventions:
- restart the Vite dev server after changing frontend env variables;
- never commit
.env.localfiles; - ensure
VITE_API_BASEpoints to the correct environment.
Expected values include:
DEVICE_TOKEN_PRIVATE_KEYDEVICE_ACTIVATION_URLDEVICE_VERIFICATION_URIDEVICE_TOKEN_ISSUERDEVICE_TOKEN_AUDIENCEDEVICE_ACCESS_TOKEN_TTL_SECONDSDEVICE_REGISTRATION_TOKEN_TTL_SECONDSDEV_AUTH_USER_EMAILDEV_AUTH_USER_PASSWORDDEV_AUTH_USER_DISPLAY_NAMESMOKE_TEST_USER_EMAIL
Conventions:
- use an Ed25519 private key in PKCS8 PEM form for
DEVICE_TOKEN_PRIVATE_KEY; - change activation/verification URLs only when explicitly testing alternate flows;
- local auth emulator test credentials may be overridden here if needed.
This file is required for functions that declare secrets via defineSecret.
Important convention:
- the Firebase Functions emulator will attempt to read Secret Manager if local secret overrides are absent;
- without
functions/.secret.local, local startup can fail with secret-access errors; - keep this file out of version control.
Typical local use:
cat > functions/.secret.local <<'EOF'
DEVICE_TOKEN_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----
EOFRunning the following from the repo root starts the normal local stack:
pnpm devExpected components:
- frontend Vite dev server on
http://localhost:5173 - Firebase Emulator Suite on the local project alias
- functions TypeScript build watcher
- Emulator UI on
http://localhost:4000
The local development guide documents a seeded default auth-emulator user.
Default credentials:
- email:
smoke-tester@crowdpm.dev - password:
crowdpm-dev
These can be overridden using the DEV_AUTH_USER_* variables in functions/.env.local.
After local startup, verify at least the following:
curl http://127.0.0.1:5001/demo-crowdpm/us-central1/crowdpmApi/healthExpected response:
{ "ok": true }Open http://localhost:5173 and confirm the app loads.
Open http://localhost:4000 and confirm Firestore, Storage, Auth, and Functions are visible.
The root workspace includes helper scripts that contributors should know exist:
pnpm device:pairpnpm device:simulate:osu
Use cases:
- re-running or debugging device onboarding / ingest flows;
- exercising simulated data paths outside the main UI smoke test;
- validating ingest behavior after backend changes.
When documenting exact script arguments, prefer the repository README or source-level comments if the invocation changes.
When ingest logic changes, run the documented smoke test:
- start the local stack with
pnpm dev; - sign in with the local test user;
- open the User Dashboard tab;
- click Run Smoke Test;
- confirm the device is seeded, paired, and a payload is submitted;
- confirm resulting batch metadata and map rendering behavior;
- optionally inspect Firestore, Storage, and Functions logs in the emulator UI.
Do not commit:
.env.local.secret.local- downloaded service account JSON files
- any copied private keys
At minimum, contributors should run:
pnpm lint
pnpm -r buildRun tests relevant to the changed workspace as appropriate.
Any change to one of the following usually requires doc updates:
- route names or auth behavior;
- env variables;
- pairing flow;
- smoke-test behavior;
- deployment process.
Update:
- source code;
- repo docs / examples;
- wiki pages.
Do not make normal contributor onboarding depend on live cloud resources or real hardware unless there is a clearly documented reason.
Use the role names that match the code and API surface:
- guest
- authenticated user/device owner
- moderator
- super admin
Avoid collapsing everything into a vague single “admin” role in docs.
Owner: CrowdPM Team
Last updated: 2026-03-08
Status: Production
Single sources of truth (links only)
- Production Website: crowdpmplatform.web.app
- Requirements doc: Requirements Doc
- Design doc: Design Doc
- Project board: Project board
- CI dashboard: CI Dashboard
- Release artifacts: Release Artifacts
- Repo: GitHub