BiteBook is a modern React web application for tracking daily meals. It demonstrates modern web development best practices with React, Firebase, and Vite while providing real, user-facing functionality.
BiteBook allows users to:
- Log breakfast, lunch, and dinner entries
- Mark meals as home-cooked, ordered, or skipped
- Store and retrieve data securely per user via Firebase
- View meal history, filter and sort entries, and analyze insights
- Import and export data using Excel files
- Login with Google using Firebase Authentication
This repo is designed to teach several important web development concepts:
- React component architecture and hooks
- Context-based state sharing
- Cloud backend integration using Firebase Auth and Firestore
- Build tooling with Vite
- Error handling and mobile-safe storage fallbacks
- Deployment on Vercel
The app is deployed at:
- Log meal descriptions with meal type, status, and preparation details
- Support home cooking, restaurant orders, and skipped meals
- Add order details for outside food (dine-in or delivery)
- Quickly reuse previous meal entries with drag-and-drop suggestions
- Export meal history to an Excel file
- Import meal data from Excel using a template structure
- Replace all existing data with imported rows
- Clear your meal logs entirely for the signed-in user
- View meal activity through history and insights
- View history with edit and delete options and rich filter/sort controls
- Analyze top dishes and meal patterns
- Track who cooks most often and how frequently items are repeated
- React 19 β component-driven UI
- Vite β fast dev server and build tool
- Firebase Auth β Google login and authentication
- Firebase Firestore β cloud database for meal storage
- Chart.js β data visualization
- XLSX β Excel import/export
- Vercel β deployment platform
Important files and folders:
src/main.jsxβ entry point, mounts the React app, wraps it inAuthProvidersrc/App.jsxβ root app component, user gating, view renderingsrc/context/β shared React contexts and authentication providersrc/hooks/β custom hook logic for data and UI statesrc/components/β UI building blocks and page viewssrc/utils/β helper functions for persistence and formattingsrc/firebase.jsβ Firebase project initializationdocs/LEARNING.mdβ in-depth documentation and learning guide
Install dependencies:
npm installRun the development server:
npm run devBuild the production bundle:
npm run buildPreview the production build locally:
npm run previewTo run the app with Firebase locally:
- Create a Firebase project at https://console.firebase.google.com/
- Enable Google authentication in
Authentication->Sign-in method - Create a Firestore database in your Firebase project
- Add your Vercel or local domain under
Authentication->Authorized domains - Update
src/firebase.jswith your Firebase config values
Example src/firebase.js config:
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT.appspot.com",
messagingSenderId: "YOUR_SENDER_ID",
appId: "YOUR_APP_ID",
};Use these rules to ensure users only access their own meals:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /meals/{meal} {
allow read, write: if request.auth != null && request.auth.uid == resource.data.userId;
allow create: if request.auth != null && request.auth.uid == request.resource.data.userId;
}
}
}This app is ready for Vercel deployment and currently lives at:
The Vercel deployment uses the main branch and automatically rebuilds when updated.
This repo is not just an app β it is also a learning resource.
- React docs: https://react.dev/
- JavaScript guide: https://javascript.info/
- Firebase docs: https://firebase.google.com/docs
- Vite docs: https://vitejs.dev/
For a deeper explanation of the app architecture and concepts used here, read:
npm run devnpm run buildnpm run previewnpx serve dist 3000- Google login is required to use the app
- Meal data is saved per user in Firebase Firestore
- The app is built with modern React hooks and context
- Storage fallbacks are included for browsers that restrict session/local storage
If you want to extend this project, possible improvements include:
- adding offline caching
- using React Router for deeper navigation
- adding user settings/profile pages
- using server-side rendering or serverless functions
- improving import validation and error handling