A modern Firebase-powered web application with Gmail integration, authentication, and Firestore database.
- 🔐 Firebase Authentication (Email/Password + Google Sign-in)
- 📧 Gmail Integration (Read recent emails)
- 🗄️ Firestore Database integration
- ☁️ Firebase Cloud Functions (2nd Gen)
- 🎨 Modern, responsive UI with Tailwind CSS
- 📱 Mobile-friendly interface
- ⚡ Fast and lightweight
- Node.js (v14 or higher)
- A Firebase project
- Go to the Firebase Console
- Create a new project or select an existing one
- Enable Authentication:
- Go to Authentication > Sign-in method
- Enable "Email/Password" provider
- Enable Firestore Database:
- Go to Firestore Database
- Create database in production mode (or test mode for development)
- Get your Firebase configuration:
- Go to Project Settings > General
- Scroll down to "Your apps" section
- Click on the web app icon (
</>
) to add a web app - Copy the Firebase configuration object
- Open
firebase-config.js
- Replace the placeholder configuration with your actual Firebase config:
const firebaseConfig = {
apiKey: "your-actual-api-key",
authDomain: "your-project-id.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project-id.appspot.com",
messagingSenderId: "your-sender-id",
appId: "your-app-id",
measurementId: "your-measurement-id" // Optional
};
npm install
npm run dev
npm start
The app will open in your browser at http://localhost:3000
project-lighthouse/
├── public/
│ ├── index.html # Main HTML with Tailwind CSS
│ └── app.js # Client-side JavaScript with Gmail integration
├── functions/
│ ├── index.js # Cloud Functions for Gmail API
│ └── package.json # Functions dependencies
├── firebase.json # Firebase configuration
├── .firebaserc # Firebase project settings
├── GMAIL_SETUP.md # Detailed Gmail setup guide
└── README.md # This file
- Sign Up: Create a new account with email and password
- Sign In: Use your credentials to access the app
- Google Sign-in: Click "Sign in with Google" for OAuth authentication
- Dashboard: Once authenticated, you'll see the main app interface
- Sign Out: Click the sign out button to log out
- Enable Gmail API: Follow the setup guide in
GMAIL_SETUP.md
- Sign in with Google: Grant Gmail read permissions
- View Emails: Your 5 most recent emails will be displayed
- Real-time Updates: Emails are fetched and cached in Firestore
- Authentication: User sign up, sign in, and sign out
- Firestore: Database for storing user data (ready for use)
- Database Operations: Use the exported
db
fromfirebase-config.js
to interact with Firestore - Additional Auth Methods: Add Google, Facebook, or other providers in Firebase Console
- UI Components: Modify
styles.css
andindex.html
to customize the interface
import { collection, addDoc, getDocs } from 'firebase/firestore';
import { db } from './firebase-config.js';
// Add a document
const docRef = await addDoc(collection(db, "users"), {
name: "John Doe",
email: "john@example.com"
});
// Get documents
const querySnapshot = await getDocs(collection(db, "users"));
querySnapshot.forEach((doc) => {
console.log(doc.id, " => ", doc.data());
});
Make sure to configure proper Firestore security rules in the Firebase Console:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users can only access their own data
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
- Firebase config not working: Make sure you've replaced the placeholder values with your actual Firebase configuration
- Authentication not working: Ensure Email/Password is enabled in Firebase Console
- CORS errors: Make sure you're running the app through a local server (not opening the HTML file directly)
- Check the browser console for error messages
- Verify your Firebase configuration
- Ensure all Firebase services are properly enabled
MIT License - feel free to use this project as a starting point for your own applications.