A React + Vite single-page app that shows how many hours you need to work to afford something. Authentication and data live on Firebase (Auth + Firestore).
- Email/password signup & login (Firebase Auth)
- Onboarding to collect country, income period/value, days/week, hours/day
- Hourly rate calculation (monthly-hours = days × hours × 4.33)
- Time-to-earn calculator with progress bar
- Optional history of calculations stored per user in Firestore
- Tailwind CSS styling
- Frontend: React, Vite, React Router, Tailwind CSS
- Backend: Firebase Authentication, Firebase Firestore
- Hosting: Firebase Hosting (SPA rewrite to
index.html)
Create .env.local (for local dev) and .env.production (for deploy builds) with your Firebase web config:
VITE_FIREBASE_API_KEY=...
VITE_FIREBASE_AUTH_DOMAIN=...
VITE_FIREBASE_PROJECT_ID=...
VITE_FIREBASE_STORAGE_BUCKET=...
VITE_FIREBASE_MESSAGING_SENDER_ID=...
VITE_FIREBASE_APP_ID=...
VITE_FIREBASE_MEASUREMENT_ID=... # optional
Allow each signed-in user to read/write only their own data:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId}/{document=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
npm run dev— start Vite dev servernpm run build— production build todistnpm run preview— preview the build locally
Hosting config lives in firebase.json and .firebaserc. After you’ve logged in with the Firebase CLI:
npm run build
firebase deploy --only hosting
- Ensure your env vars are present at build time; the deployed bundle cannot read
.env.local. - Add your hosting domains to Firebase Auth “Authorized domains”.