A small Angular app for logging a baby's day (feeds, sleep, diapers, …), backed by the Firebase Realtime Database and Google sign-in. Children's names are only stored locally on each device.
Node 24 (see .nvmrc).
npm ciRun npm run serve for a dev server. Navigate to http://localhost:4200/. The app will
automatically reload if you change any of the source files.
Run npm run build to make a production build in dist/baby-log/browser.
npm testruns the Vitest unit tests.npm run test:rulesruns the database security rules tests against the Database emulator.npm run e2eruns the Playwright tests against the Auth and Database emulators, using your installed Chrome.npm run serve -- --configuration emulatorsserves the app against emulators you started yourself withnpx firebase emulators:start --only auth,database --project demo-baby-log.
The emulators need Java.
Run npm run deploy to build and deploy hosting and the database rules.
Access to a child's log now comes from families/$fid/members, and people join with single-use
invites (invites/$token) instead of the family ID. Existing users need to be added as members
before the new rules go live, or they will lose access to their logs:
npx firebase database:get /users > users.json
npx firebase auth:export auth-users.json --format=json
node scripts/migrate-members.mjs users.json auth-users.json > members.json
npx firebase database:update / members.json
npm run deployRun the last two steps back to back so new families get created under the new rules. Delete the exported JSON files afterwards, since they contain users' data. Share links sent before this change stop working; the app tells people to ask for a new invite.
These live in the Firebase and Google Cloud consoles rather than this repo.
- In the Firebase console, open App Check, register the web app with reCAPTCHA
Enterprise, and create a site key for
baby.fluin.io,baby-log-7307f.web.app, andbaby-log-7307f.firebaseapp.com. - Put the site key in
APP_CHECK_SITE_KEYinsrc/app/firebase.tsand deploy. - For local development against the real project, run
npm run serve, copy the debug token the browser console prints, and add it under App Check → Apps → Manage debug tokens. (The emulators don't use App Check.) - Watch the App Check metrics for a few days until nearly all requests are verified, then Enforce it for Realtime Database and Authentication.
The API key in src/app/firebase.ts is public by design, but it should only work from the app's
own sites and only for the APIs the app uses:
gcloud services api-keys list --project baby-log-7307f
gcloud services api-keys update KEY_ID --project baby-log-7307f \
--allowed-referrers="https://baby.fluin.io/*,https://baby-log-7307f.web.app/*,https://baby-log-7307f.firebaseapp.com/*,http://localhost:4200/*" \
--api-target=service=identitytoolkit.googleapis.com \
--api-target=service=securetoken.googleapis.com \
--api-target=service=firebaseappcheck.googleapis.com \
--api-target=service=firebaseinstallations.googleapis.comUse the key ID whose key string matches the apiKey in src/app/firebase.ts, and test sign-in
right afterwards.
The app sends page views itself with scrubbed URLs, so in the GA4 web stream's Enhanced measurement settings turn off Page changes based on browser history events (it can report real URLs and double-count page views) and Outbound clicks.