GDG on Campus Workshop Project
Build an AI-powered study assistant using React, Firebase, and Google Gemini
- 📄 PDF & Text Upload - Extract content from PDFs or paste text directly
- 📅 AI Study Plans - Generate personalized day-by-day study schedules
- 🧠 Smart Quizzes - Take AI-generated quizzes (MCQ, True/False, Short Answer)
- 📊 Progress Tracking - Track completed study days and quiz scores
- 🔐 Anonymous Auth - No sign-up required, powered by Firebase
- Node.js 18+ installed (download)
- A Google account
- Code editor (VS Code recommended)
# Clone the project (or download ZIP)
git clone <repository-url>
cd ai-study-assistant
# Install dependencies
npm install
npm install firebase- Go to Firebase Console
- Click "Create a project" (or use existing)
- Name it something like
gdg-study-assistant - Disable Google Analytics (optional for workshop)
- Click Create project
- In Firebase Console → Authentication → Get started
- Go to Sign-in method tab
- Click Anonymous → Enable → Save
- In Firebase Console → Firestore Database → Create database
- Select Start in test mode (for workshop purposes)
- Choose a location close to you → Enable
- Go to Project Settings (gear icon) → General
- Scroll to "Your apps" → Click Web icon (
</>) - Register app with nickname (e.g.,
study-assistant-web) - Copy the config object
Open src/lib/firebase.js and replace the config:
const firebaseConfig = {
apiKey: "YOUR_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"
};- Go to Google AI Studio
- Click "Create API key"
- Copy the API key
Open src/lib/gemini.js and replace:
const API_KEY = 'YOUR_GEMINI_API_KEY';npm run devOpen http://localhost:5173 in your browser 🎉
ai-study-assistant/
├── src/
│ ├── components/
│ │ ├── FileUpload.jsx # PDF/text upload component
│ │ ├── StudyPlanGenerator.jsx # Study plan UI
│ │ └── QuizGenerator.jsx # Quiz UI with scoring
│ ├── lib/
│ │ ├── firebase.js # Firebase config & auth
│ │ ├── gemini.js # Gemini API integration
│ │ ├── pdfParser.js # PDF text extraction
│ │ └── database.js # Firestore operations
│ ├── App.jsx # Main app component
│ ├── main.jsx # Entry point
│ └── index.css # Tailwind styles
├── index.html
├── package.json
├── vite.config.js
├── tailwind.config.js
└── README.md
// Anonymous sign-in - no account needed!
export const signInAnon = async () => {
const result = await signInAnonymously(auth);
return result.user;
};// Generate study plan with Gemini
export const generateStudyPlan = async (content, numberOfDays) => {
const prompt = `Create a ${numberOfDays}-day study plan for: ${content}`;
const result = await model.generateContent(prompt);
return JSON.parse(result.response.text());
};// Extract text from uploaded PDF
export const extractTextFromPDF = async (file) => {
const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;
// Extract text from each page...
};// Save study material
export const saveMaterial = async (userId, material) => {
return await addDoc(collection(db, 'materials'), {
userId,
...material,
createdAt: serverTimestamp()
});
};Create a flashcard component that shows terms/definitions from the material.
Add a button to download the study plan as a PDF or markdown file.
Show previous quiz scores and allow retaking old quizzes.
Generate a shareable link for study plans.
-
Never expose API keys in frontend code!
- Use Firebase Cloud Functions or a backend server
- Store keys in environment variables
-
Update Firestore Rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /materials/{doc} {
allow read, write: if request.auth != null
&& request.auth.uid == resource.data.userId;
}
// Similar rules for studyPlans, quizzes, quizResults
}
}- Set up API key restrictions in Google Cloud Console
Found a bug or want to add a feature? PRs welcome!
MIT License - Feel free to use this for your own workshops!
Built with ❤️ for GDG on Campus