Technology Stack

Frontend
  • React 18.2+
  • TypeScript 5.0+
  • Vite 5.0+
  • Tailwind CSS 3.4+
  • Framer Motion 10.0+
Backend Services
  • Firebase Auth
  • Cloud Firestore
  • Firebase Storage
  • Cloudflare Pages
Utilities
  • @dnd-kit/core 6.0+
  • date-fns 3.0+
  • React Router 6.0+

Firebase Configuration

Project Configuration
Project ID smartpantry-66c66
Auth Domain smartpantry-66c66.firebaseapp.com
Database URL https://smartpantry-66c66.firebaseio.com
Storage Bucket smartpantry-66c66.appspot.com
Messaging Sender ID 772965298932
App ID 1:772965298932:web:28ffae7cedd57dd802a4a1

Data Structures

User Profile (users collection)

{ "uid": "firebase_auth_uid", // Primary key "email": "user@example.com", "displayName": "Name", "photoURL": "https://...", "role": "student" | "parent", "currentStreak": 5, "totalXP": 2500, "level": 2, "unlockedAchievements": ["first_blood", "week_warrior"] }

Task (tasks collection)

{ "id": "auto_generated_id", "title": "Math Homework", "description": "Pages 45-47", "dueDate": "timestamp", "deadlineDate": "timestamp", "status": "todo" | "today" | "done", "section": "morning" | "afternoon" | "assignments", "taskType": "regular" | "assignment" | "exam" | "project" | "personal", "priority": "low" | "medium" | "high" | "urgent", "tags": ["math", "homework"], "createdBy": "user_email", "pointsValue": 50 }

Message (family_messages collection)

{ "id": "message_id", "text": "Great job today!", "senderId": "user_uid", "senderName": "Sender Name", "senderEmail": "sender@example.com", "timestamp": "serverTimestamp", "type": "user" | "system", "attachments": [/* attachment objects */], "reactions": { "πŸ‘": ["user_id_1"] }, "edited": false }

Firestore Collection Structure

Service Functions

Firebase Service (src/services/firebase.ts)

uploadImage(file: File, chatId?: string): Promise<string>

Uploads an image file to Firebase Storage with compression. Returns the download URL.

compressImage(file: File, maxSize: number = 800, quality: number = 0.8): Promise<Blob>

Compresses an image file using canvas. Times out after 5 seconds to prevent hanging.

Auth Context (src/context/AuthContext.tsx)

signInWithGoogle(): Promise<UserCredential>

Initiates Google Sign-In flow. Only whitelisted emails are allowed.

signOut(): Promise<void>

Signs out the current user and clears local state.

Authorized Emails

Email Whitelist
Student dominicgiles691@gmail.com
Parent 1 derrickmg.admin@gmail.com
Parent 2 brendamgiles@gmail.com

Cloudflare Configuration

Deployment Settings
Account ID 13943b867887b7e4d4df7f05cfae9100
Project Name smartpantry
Production URL https://smartpantry.pages.dev
Build Command npm run build
Build Output ./dist