This app implements:
- React + Vite project with Tailwind CSS.
- Google login using Firebase Authentication.
- Protected
/dashboardroute accessible only when logged in. - Local session persistence in localStorage with
name,email, and login timestamp. - Strict 24-hour session expiry.
- Session restore on refresh without showing login again when still valid.
- Logout that clears localStorage and redirects to login.
In Firebase Console:
- Create a project (or use existing).
- Go to Authentication > Sign-in method.
- Enable Google provider.
- Go to Project settings > General, register a Web app, and copy config values.
- Add your dev domain (for example
localhost) to Authentication > Settings > Authorized domains.
Copy .env.example to .env and fill values:
cp .env.example .envRequired variables:
VITE_FIREBASE_API_KEYVITE_FIREBASE_AUTH_DOMAINVITE_FIREBASE_PROJECT_IDVITE_FIREBASE_STORAGE_BUCKETVITE_FIREBASE_MESSAGING_SENDER_IDVITE_FIREBASE_APP_ID
npm install
npm run devBuild check:
npm run build- On successful Google login, app stores
name,email, andloginAtin localStorage. - If the stored session is younger than 24 hours, refresh restores user directly to dashboard.
- At or after 24 hours, session is cleared and user must log in again.
- Logout clears session data and redirects to
/.