A comprehensive learning platform with Firebase authentication, real-time progress tracking, and interactive content management.
- Phone Number + OTP: Firebase Phone Authentication
- Test Credentials:
- Phone:
+911234567890 - OTP:
123456
- Phone:
{
username: "User's name",
phone_number: "User's phone",
college: "College name",
department: "Department name",
batch: "Batch name",
email: "Complete email",
gender: "female/male/prefer_not_to_say",
current_firebase_uid: "Firebase Auth UID",
created_at: "Firestore Timestamp",
last_login: "Firestore Timestamp",
total_request: {
practice_mode: 0,
test_mode: 0
},
daily_usage: 0,
total_usage: 0
}/prep/Title/{categoryId}/{categoryId}
├── Programming Language: ["C", "Java", "Python", ...]
├── Web Development: ["HTML", "CSS", "JavaScript", ...]
├── App Development: ["Flutter", "React Native", ...]
└── ...
/prep/Title/{categoryId}/{categoryId}/{subcategory}/Topics
├── C: ["C Introduction", "C Variables", "C Functions", ...]
├── Java: ["Java Basics", "Java OOP", "Java Collections", ...]
└── ...
{
xp: 20,
coins: 5,
streaks: 0,
study_hours: 0
}{
programminglanguage_c_cintroduction: {
type: "programming",
subject: "Programming Language",
subtopic: "C|C Introduction",
progress: 75.5,
bestScore: 85,
totalAttempts: 10,
totalCorrectAnswers: 85,
totalQuestions: 100,
lastUpdated: 1704067200000,
averageScore: 78.5
},
academic_college_department_semester_subject_unit: {
// Academic progress structure
}
}- FirebaseAuthService: Handles phone authentication and OTP verification
- FirestoreService: Manages user data and content in Firestore
- FirebaseRealtimeService: Manages user stats and progress in Realtime Database
- PrepService: Orchestrates content loading and progress tracking
- AuthContext: Provides authentication state and user management
-
User Registration:
- Phone number input → OTP verification → User registration
- Data stored in both Firestore and Realtime Database
- Merged user data available in AuthContext
-
Content Loading:
- Categories → Subcategories → Topics
- Cached for 5 minutes to improve performance
- Authentication required for all content access
-
Progress Tracking:
- Topic progress stored in Realtime Database
- Unique topic IDs generated from category/subcategory/topic
- Real-time updates across devices
- ✅ Phone number authentication with OTP
- ✅ Test mode for development
- ✅ Automatic user data loading
- ✅ Session persistence
- ✅ Hierarchical content structure
- ✅ Dynamic category and topic loading
- ✅ Caching for performance
- ✅ Asset and color mapping
- ✅ Real-time progress updates
- ✅ Comprehensive progress metrics
- ✅ Cross-device synchronization
- ✅ Academic and programming progress
- ✅ Complete user profiles
- ✅ Stats tracking (XP, coins, streaks)
- ✅ Usage analytics
- ✅ College/department organization
Create a .env file with your Firebase configuration:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_DATABASE_URL=https://your_project-default-rtdb.asia-southeast1.firebasedatabase.app
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_FIREBASE_MEASUREMENT_ID=your_measurement_id-
Install Dependencies:
npm install
-
Configure Firebase:
- Set up Firebase project
- Enable Phone Authentication
- Configure Firestore and Realtime Database
- Set environment variables
-
Run Development Server:
npm run dev
-
Test Authentication:
- Use test phone:
+911234567890 - Use test OTP:
123456
- Use test phone:
sendOTP(phoneNumber): Send OTP to phone numberverifyOTP(otp): Verify OTP and authenticate userregisterUser(userData): Register new userupdateUserStats(stats): Update user statisticsupdateTopicProgress(categoryId, subcategory, topic, progressData): Update topic progressgetTopicProgress(categoryId, subcategory, topic): Get topic progresssignOut(): Sign out user
loadAllPrepData(): Load all prep contentloadCategoryItems(categoryId): Load items for categoryloadSubcategoryTopics(categoryId, subcategory): Load topics for subcategoryloadProgressData(topicIds): Load progress for topicsupdateTopicProgress(categoryId, subcategory, topic, progressData): Update topic progress
prepData: Current prep data stateloading: Loading stateerror: Error staterefreshData(): Refresh all dataloadCategoryItems(categoryId): Load category itemsloadSubcategoryTopics(categoryId, subcategory): Load subcategory topics
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /skillbench/users/users/{phoneNumber} {
allow read, write: if request.auth != null && request.auth.token.phone_number == phoneNumber;
}
match /prep/{document=**} {
allow read: if request.auth != null;
}
}
}{
"rules": {
"skillbench": {
"users": {
"$phoneNumber": {
".read": "auth != null && auth.token.phone_number == $phoneNumber",
".write": "auth != null && auth.token.phone_number == $phoneNumber"
}
},
"progress": {
"$phoneNumber": {
".read": "auth != null && auth.token.phone_number == $phoneNumber",
".write": "auth != null && auth.token.phone_number == $phoneNumber"
}
}
}
}
}- Follow the existing code structure
- Use the established services for data operations
- Implement proper error handling
- Add caching where appropriate
- Test with the provided test credentials
This project is licensed under the MIT License.