Welcome to Study All in GPT! This guide will walk you through everything you need to know about our educational AI-powered application. Whether you're a beginner developer or just getting started with the project, we've got you covered with detailed explanations and step-by-step instructions.
A full-stack application featuring AI-powered chat, Firebase integration, and project management capabilities built with React Native.
- User Authentication
- Login/Register → Firebase Auth → Session Cookie
- Main Chat Interface
- Message Input → Sanitization → Gemini API → Response Streaming
- Project Management
- Task Creation → Firestore Update → Real-time Sync
- Data Flow
Loading
graph TD A[User] --> B[React Native App] B --> C{Authentication} C -->|Success| D[Chat Interface] D --> E[Message Manager] E --> F[Gemini 1.5 Flash] D --> G[Project Manager] G --> H[Firestore DB]
Beginner-Friendly Explanation Our app works like a smart study buddy that:
- Remembers last 5 conversations
- Checks messages for safety
- Streams responses in real-time
- Connects to your projects
-
AI Chat System
- Gemini 1.5 Flash model integration
- Message sanitization and error handling
- Context management (5 message history)
- Abort controller support for streaming
-
Firebase Services
- Authentication with platform-specific persistence
- Firestore for user data/metadata
- Storage integration
- Real-time message tracking
-
Project Management
- Task organization system
- User permission levels
- Progress tracking
First-Time Setup Guide
- Install Android Studio
- Enable USB Debugging on your phone
- Run
adb devicesto verify connection - Use VS Code with React Native extension
Basic development environment setup
- Node.js v18+
- npm v9+
- Firebase project
- Google Gemini API key
npx react-native init MyFirstApp
cd MyFirstApp
npm install @google/generative-ai firebase @react-native-async-storage/async-storage- Create
.envfile:
FIREBASE_API_KEY=your_key
FIREBASE_AUTH_DOMAIN=your_domain
GEMINI_API_KEY=your_key- Update Firebase config (
firebase.js):
const firebaseConfig = {
apiKey: process.env.FIREBASE_API_KEY,
// ... other config values
};- Configure AI service (
services/ai.js):
const API_KEY = process.env.GEMINI_API_KEY;Component Map Explained
graph LR
A[User] --> B[HomeScreen.js]
B --> C[messageManager.js]
C --> D[Gemini AI]
C --> E[Firestore]
B --> F[ChatDrawer.js]
F --> G[Projects.js]
G --> E
Beginner's Guide to Components:
HomeScreen.js- Main chat window (like your messaging app)messageManager.js- Message traffic controller (post office for chats)ai.js- Brain of the AI (converts questions to answers)ChatDrawer.js- Side menu (app navigation hub)
├── services/
│ ├── ai.js - Gemini API wrapper (AI Brain)
│ ├── messageManager.js - Firestore message tracking (Message Post Office)
│ ├── accessControl.js - Permission management (Security Guard)
├── screens/
│ ├── HomeScreen.js - Main chat interface (Digital Notebook)
│ ├── Projects.js - Project management (Task Whiteboard)
│ ├── Analytics.js - Usage statistics (Progress Report Card)
├── components/
│ ├── ChatDrawer.js - Navigation panel (App Control Center)
│ ├── CodeBlock.js - Syntax-highlighted code (Code Highlighter)
├── firebase.js - Firebase configuration (Cloud Connection)
└── models/
└── JournalEntry.js - Data structure (Memory Blueprint)
- Enable Email/Password authentication
- Create Firestore database in test mode
- Set up storage bucket
- Enable Generative Language API
- Create API key in Google Cloud Console
Common Issues Solutions
🔥 Firebase Error: Missing Index
1. Go to Firestore Console
2. Click 'Create Index' button
3. Use fields from error message
4. Wait 2-5 minutes for indexing
💡 Pro Tip: Run `firebase emulators:start`
for local development without cloud costs
Error Handling Strategy
- Input Validation → 400 Bad Request
- API Retry → 3 attempts with 2s delay
- Fallback Cache → Show last working response
- Error Logging → Firebase Crashlytics
npm start
npm run androidnpm run build:android- Follow Git Flow workflow
- Write Jest unit tests for new features
- Document API changes in
/docs - Submit PR with:
- Test coverage report
- Updated TypeScript definitions
- Migration guide if breaking changes
MIT License - See LICENSE.md