RelayBoard is a realtime multi-board communication app built with Firebase. The React client talks directly to Firebase Authentication and Cloud Firestore through the modular Firebase Web SDK; internal Firestore-triggered Cloud Functions complete approved board joins and recursively clean up post subcollections after a post is deleted.
- Google sign-in, a discoverable board directory, and a compact user profile
- Access-code-gated board membership, completed by an internal Firestore trigger
- Realtime board feeds powered by
onSnapshot - Six post types: Issue, Activity, Tip, Announcement, Lost & Found, and Poll
- Type-specific actions, protected from duplicate responses with an atomic Firestore transaction
- Realtime comments loaded only when a post’s discussion is opened
- Browser notifications for new posts while RelayBoard is open (after the user grants permission)
- Client-side title search and type tabs
- Offline persistence shared safely across browser tabs
- Firestore Security Rules that validate ownership, post shapes, comments, and action-counter updates
src/
components/ UI components and shadcn-style primitives
firebase/ Firebase SDK initialization and configuration
hooks/ Realtime/auth state hooks
pages/ Sign-in, board directory, and board routes
services/ Firebase Authentication and Firestore operations
types/ Shared data model and post/action metadata
functions/ Internal board-join and Firestore cleanup triggers
services/posts.service.ts contains all Firestore writes and listeners. UI components never assemble Firestore paths or run transactions themselves. The feed is a direct onSnapshot listener ordered by createdAt; choosing a post-type tab adds a Firestore where filter. Comments are independently subscribed when opened. Action writes use runTransaction to create one action document per user and update the denormalized count in the same atomic commit.
Board records live in the workspaces collection. Their top-level metadata is discoverable to signed-in users; posts and membership data are available only after the user joins with the board's access code.
workspaces/{workspaceId}
name, createdByName, createdAt, memberCount
members/{userId}
userId, name, photoURL, role: "owner" | "member", joinedAt
_private/access
accessCode
posts/{postId}
type: "issue" | "activity" | "tip" | "announcement" | "lost-found" | "poll"
title, description
author: { uid, name, photoURL }
createdAt, updatedAt, expiresAt
actionCounts: { helpful, affected, join, acknowledge, claim, vote }
totalActionCount
actions/{userId}
userId, actionType, createdAt
comments/{commentId}
text, author, createdAt
users/{userId}/boardMemberships/{workspaceId}
boardId, role, joinedAt
Actions are a subcollection because each user needs a durable, unique response record. Comments are a subcollection to avoid unbounded post documents. Aggregate action counts live on the post for a quick feed render and are updated atomically alongside the action record. The included index supports the type-filtered newest-first feed; comments use Firestore’s automatic single-field indexes.
-
Create a Firebase project and register a Web app.
-
In Firebase Authentication, enable the Google provider and add your development domain to Authorized domains.
-
Create a Cloud Firestore database.
-
Copy the environment template and fill it with the Web app configuration:
cp .env.example .env
-
Install and run the app:
npm install npm run dev
-
Install the cleanup function's dependencies (it deploys on Node.js 22), then deploy the included Firestore configuration and function before testing authenticated writes:
firebase login firebase use YOUR_PROJECT_ID npm --prefix functions install firebase deploy --only firestore,functions
-
Enable Firestore TTL for the
expiresAtfield on thepostscollection group.nullmeans a post is persistent; every timed post stores a timestamp. You can do this without installing any CLI: open Google Cloud Console → Firestore → Databases → your database → Time-to-live, create a policy with collection grouppostsand timestamp fieldexpiresAt, then save it.Alternatively, use Google Cloud Shell in the console (where
gcloudis already installed) or run:gcloud firestore fields ttls update expiresAt --collection-group=posts --enable-ttl --async
Existing
mainworkspace: releases created before multi-board support wrote posts belowworkspaces/mainwithout a board document or memberships. The new rules intentionally block that old open workspace. Its documents are not deleted, but migrate them with a trusted Admin SDK script before deployment if you need to retain them.
Build the static React app and deploy it with the included firebase.json:
npm run build firebase deploy --only hosting
Set the same VITE_FIREBASE_* values in the build environment used for Hosting. Since Vite replaces VITE_ variables at build time, Firebase project identifiers are intentionally public; the Firestore Security Rules protect the data.
Any authenticated user can list board cards, but only board members can read posts, comments, actions, or membership data. A board creator writes the board and its access code in one security-rule-validated batch. The plain access code is stored in a private document that client security rules deny completely. A join request is accepted only when Firestore Rules compare its submitted code to that private document; an internal Firestore trigger then creates membership and removes the temporary request. Members can create posts and comments, update/delete only their own posts, and respond only once. The rules require the matching action document and its one-count increment to be committed together, which prevents standalone counter manipulation and duplicate responses.
New posts disappear after 24 hours by default. The author can select a duration in minutes, hours, or days, or uncheck the visibility option to keep the post indefinitely. Timed posts use an expiresAt timestamp: the client hides them as soon as that time passes and Firestore TTL then permanently deletes the parent post document. A Cloud Function responds to every post deletion (TTL or manual) and recursively removes the post's action and comment subcollections as well.
Use Enable alerts in the header to allow native browser notifications. Once granted, the bell becomes a test-alert button. A realtime listener sends an alert for every post created after RelayBoard has loaded; the initial feed intentionally does not generate a burst of old-post notifications. The app also displays an in-app receipt toast when the listener receives a new post, making browser/OS delivery problems visible. This frontend-only implementation works while the web app is open. Delivery after the browser/app is closed requires Firebase Cloud Messaging plus a trusted notification sender, which is intentionally outside this no-backend MVP.
RelayBoard also plays a small in-app chime while it is open. Native notification sounds are controlled by the browser and operating system, so they can be silenced by the user’s notification settings or Focus/Do Not Disturb mode.
- Owner controls for access-code rotation and membership management
- Pagination with cursors for large feeds
- Post attachments via Firebase Storage
- Push notifications and unread state
- Poll options and per-option aggregates