๐Note: cd to Backend
A production-ready, end-to-end To-Do List application built entirely with Firebase (Backend-as-a-Service).
-
Multi-Provider Authentication
- Email & Password
- Google Sign-In
- GitHub Sign-In
- Session persistence
- Secure logout
-
User Management
- User profile with metadata
- Profile picture support
- Provider tracking
- Automatic user creation
-
To-Do Management
- Create, Read, Update, Delete (CRUD)
- Mark as completed
- Real-time updates
- User-specific data isolation
-
Security
- Firestore Security Rules
- Server-side data validation
- User-specific access control
-
Real-time Sync
- Instant updates across devices
- Firestore listeners
- Optimistic UI updates
- Clean, modern interface
- Responsive design
- Loading states
- Error handling
- Success notifications
- Dark mode support
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend (Vanilla JS) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Authentication UI โ
โ โข Dashboard โ
โ โข To-Do Management โ
โ โข Real-time listeners โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Firebase Services โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Firebase Auth (Multi-provider) โ
โ โข Firestore (NoSQL Database) โ
โ โข Security Rules (Server-side validation) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
{
uid: string, // Firebase Auth UID
name: string, // Display name
email: string, // Email address
photoURL: string, // Profile picture URL
provider: string, // 'email' | 'google' | 'github'
createdAt: timestamp, // Account creation time
updatedAt: timestamp // Last update time
}{
id: string, // Auto-generated document ID
title: string, // To-do title
description: string, // Optional description
status: string, // 'pending' | 'completed'
priority: string, // 'low' | 'medium' | 'high' (optional)
dueDate: timestamp, // Optional due date
ownerUID: string, // User ID (for security)
createdAt: timestamp, // Creation time
updatedAt: timestamp // Last update time
}Firestore Security Rules ensure:
- Users can only read/write their own to-dos
- User metadata is protected
- All writes are validated server-side
- No client-side security bypasses
- Node.js (v14+)
- npm or yarn
- Firebase account
- Git
-
Create Firebase Project
- Go to Firebase Console
- Click "Add project"
- Enter project name:
todo-list-mvp - Disable Google Analytics (optional for MVP)
- Click "Create project"
-
Enable Authentication Providers
- Navigate to Authentication โ Sign-in method
- Enable Email/Password
- Enable Google
- Enable GitHub (requires OAuth app setup)
- Go to GitHub Settings โ Developer settings โ OAuth Apps
- Create new OAuth App
- Copy Client ID and Secret to Firebase
-
Create Firestore Database (optional)
- Navigate to Firestore Database
- Click "Create database"
- Start in Test mode (we'll add rules later)
- Choose a location (e.g., us-central1)
-
Get Firebase Config
- Go to Project Settings (gear icon)
- Scroll to "Your apps"
- Click web icon (</>)
- Register app name:
todo-web-app - Copy the Firebase configuration object
-
Clone/Navigate to Project
cd /home/pavan/javaPS/BackendDemo -
Create Firebase Config
- Copy
js/config/firebase.config.example.jstojs/config/firebase.config.js - Paste your Firebase configuration:
export const firebaseConfig = { apiKey: "YOUR_API_KEY", authDomain: "YOUR_PROJECT_ID.firebaseapp.com", projectId: "YOUR_PROJECT_ID", storageBucket: "YOUR_PROJECT_ID.appspot.com", messagingSenderId: "YOUR_MESSAGING_SENDER_ID", appId: "YOUR_APP_ID" };
- Copy
-
Install Dependencies (Optional - for development server)
npm install
-
Install Firebase CLI
npm install -g firebase-tools
-
Login to Firebase
firebase login
-
Initialize Firebase
firebase init firestore
- Select your project
- Use
firestore.rulesfor rules - Use
firestore.indexes.jsonfor indexes
-
Deploy Rules
firebase deploy --only firestore:rules
npm run devOpen browser to http://localhost:8080
python3 -m http.server 8080npx http-server -p 8080firebase init hosting
firebase deploy --only hostingBackendDemo/
โโโ index.html # Login/Signup page
โโโ dashboard.html # Main to-do dashboard
โโโ package.json # Dependencies
โโโ firestore.rules # Security rules
โโโ firestore.indexes.json # Firestore indexes
โโโ firebase.json # Firebase config
โโโ .firebaserc # Firebase project
โโโ css/
โ โโโ auth.css # Authentication styles
โ โโโ dashboard.css # Dashboard styles
โ โโโ common.css # Shared styles
โโโ js/
โ โโโ config/
โ โ โโโ firebase.config.js # Firebase config (gitignored)
โ โ โโโ firebase.config.example.js # Example config
โ โโโ services/
โ โ โโโ auth.service.js # Authentication logic
โ โ โโโ user.service.js # User management
โ โ โโโ todo.service.js # To-do CRUD operations
โ โโโ utils/
โ โ โโโ firebase.init.js # Firebase initialization
โ โ โโโ ui.utils.js # UI helpers
โ โ โโโ validators.js # Input validation
โ โโโ auth.js # Auth page controller
โ โโโ dashboard.js # Dashboard controller
โโโ README.md # This file
- Open the application
- Sign up with email/password or use Google/GitHub
- Automatically redirected to dashboard
- Create: Click "Add To-Do" button
- Edit: Click on a to-do to edit
- Complete: Click checkbox to mark complete
- Delete: Click delete icon
- Filter: Use status filter (All/Pending/Completed)
- Open the app in multiple tabs/devices
- Changes sync instantly across all instances
- Authentication Required: All routes protected
- User Isolation: Users can only access their own data
- Server-side Validation: Firestore rules validate all operations
- XSS Protection: Input sanitization
- CSRF Protection: Firebase handles token management
Solution: Deploy Firestore security rules
firebase deploy --only firestore:rulesSolution:
- Create GitHub OAuth App
- Add credentials to Firebase Console
- Ensure callback URL matches Firebase auth domain
Solution: Check Firestore listeners are properly attached and not detached prematurely
Solution: Use a proper web server (not file:// protocol)
- Due date reminders
- Priority sorting
- Search functionality
- Tags/categories
- Bulk operations
- Collaborative to-dos
- File attachments (Firebase Storage)
- Email notifications (Cloud Functions)
- Analytics dashboard
- Mobile app (React Native/Flutter)
- Offline support (better caching)
- Export to PDF/CSV
- Recurring tasks
- Frontend: HTML5, CSS3, Vanilla JavaScript (ES6+)
- Backend: Firebase (BaaS)
- Firebase Authentication
- Cloud Firestore
- Firebase Hosting (optional)
- Security: Firestore Security Rules
- Real-time: Firestore listeners
This is an MVP project. To extend:
- Fork the repository
- Create a feature branch
- Implement your feature
- Test thoroughly
- Submit a pull request
MIT License - feel free to use for learning and production
Built as a demonstration of Firebase BaaS capabilities
Happy Coding! ๐