- ButtonPress is a small, full-stack web application where authenticated users can press a button to increase a click counter. Counts are stored and updated per user in Firestore.
- React frontend with Firebase Auth (email/password)
- Firestore data persistency: tracks button press counts per user
- Minimal Node.js backend deploy to Cloud Run (for echo/protected API route)
- Firebase Hosting for the frontend
- Live URLs are provided below ⬇️
- Clone the repo
git clone https://github.com/JahleelT/ButtonPress.git
cd ButtonPress- Install Dependencies
- Frontend
cd frontend npm install - Backend
cd backend #(../backend if in frontend directory) npm install
- Frontend
- Environment Variables
Create an
.envfile infrontend/envVITE_FIREBASE_API_KEY = api_key VITE_FIREBASE_AUTH_DOMAIN = auth_domain VITE_FIREBASE_PROJECT_ID = project_id VITE_FIREBASE_STORAGE_BUCKET = storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID = sender_id VITE_FIREBASE_APP_ID = app_id VITE_FIREBASE_MEASUREMENT_ID = measurement_id VITE_API_URL = api_url
- Local Development
- Frontend
cd frontend npm run dev- Backend
cd backend npm run dev - Deployment
- Frontend
firebase deploy --only hosting
- Backend
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/button-backend gcloud run deploy button-backend --image gcr.io/YOUR_PROJECT_ID/button-backend --platform managed
- Frontend
- Live URLs
- Authentication: All Firestore reads/writes are scoped to the currently signed-in user via Firebase Auth
- Firestore Rules: Each user can only access their own document:
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { // Only allow users to access their own document match /users/{userId} { allow read, write: if request.auth != null && request.auth.uid == userId; } // Deny all other access match /{document=**} { allow read, write: if false; } } }
- Backend Protection: Cloud Run API validates Firebase ID tokens on protected routes. Only authenticated requests with a valid bearer token are allowed.
- Principle of Least Privilege: No public write access, no shared docs; everything tied to a UID.