GoWell is a Progressive Web App (PWA) designed for schoolchildren to care for their mental health. It provides AI-powered support, mood tracking, a personal journal, wellness exercises, and a gamification system β all in one place.
Live Firebase Project:
gowell-agent(Firebase / Google Cloud)
- Features
- Tech Stack
- Project Structure
- Getting Started
- Firebase Setup
- Cloud Functions Setup
- Available Scripts
- Pages Overview
- Environment Notes
| Feature | Description |
|---|---|
| AI Chat | Chat with a Gemini-powered empathetic assistant (with local fallback) |
| Mood Tracker | Log your daily mood (Joy, Sadness, Anxiety, Calm) with optional notes |
| Journal | Write, edit, and delete personal diary entries |
| Wellness Hub | 20+ curated wellness practices (breathing, grounding, affirmations, etc.) |
| Profile | Firebase Auth (email/password), avatar upload, profile save |
| Emotion Analytics | Pie chart of emotional patterns from your chat, journal, and mood data |
| Gamification | Earn points (+50 per completed task) stored in Firestore |
| Dark / Light Theme | Persistent theme toggle stored in localStorage |
| PWA | Installable on mobile, works offline with service worker |
- React 18 with Vite 7
- React Router DOM v6 β client-side routing
- Recharts β pie chart for emotion statistics
- React Icons β SVG icon library
- Emotion (styled components support)
- vite-plugin-pwa β PWA manifest & service worker generation
- Firebase Firestore β database for moods, journal, profiles, chat history
- Firebase Auth β email/password authentication
- Firebase Storage β avatar image uploads
- Firebase Analytics β usage analytics
- Firebase Cloud Functions (Node.js) β
/chatendpoint that wraps the Gemini API
- Google Gemini 2.0 Flash (
@google/generative-ai) β AI chat responses via Cloud Function
goWell/
βββ public/
β βββ icons/ # PWA icons (192x192, 512x512)
β βββ manifest.json # PWA manifest
β βββ service-worker.js # Service worker for offline support
β
βββ src/
β βββ App.jsx # Root component: routing, theme, splash screen
β βββ main.jsx # React DOM entry point
β βββ Firebase.js # Firebase initialization (db, auth, storage)
β βββ styles.css # Global styles (CSS variables, dark mode, cards, etc.)
β β
β βββ components/
β β βββ Navbar.jsx # Bottom mobile navigation bar
β β βββ SplashScreen.jsx # Animated splash screen (shown for 1.2s on load)
β β
β βββ pages/
β β βββ Home.jsx # Landing page with links to all features
β β βββ Chat.jsx # AI chat with Gemini (+ local keyword fallback)
β β βββ Mood.jsx # Daily mood logging + history list (Firestore + localStorage)
β β βββ Journal.jsx # Personal diary with add/edit/delete (Firestore + localStorage)
β β βββ WellnessHub.jsx # 20 wellness practices + mood-based recommendations
β β βββ Profile.jsx # Auth, profile editing, avatar upload, emotion pie chart
β β
β βββ utils/
β βββ emotionAnalyzer.js # Keyword-based emotion scoring + Firestore sync
β βββ gamification.js # addPoints / getPoints helpers (Firestore + localStorage)
β
βββ functions/
β βββ index.js # Firebase Cloud Function: POST /chat β Gemini API
β βββ package.json # Functions dependencies
β
βββ index.html # Vite HTML entry point
βββ vite.config.js # Vite config with React plugin + PWA plugin
βββ firebase.json # Firebase Hosting + Functions config
βββ .firebaserc # Firebase project alias (`gowell-agent`)
βββ package.json # Frontend dependencies and scripts
- Node.js v18 or higher
- npm v9 or higher
- A Firebase project (see Firebase Setup)
git clone <your-repo-url>
cd goWellnpm installcd functions
npm install
cd ..npm run devThe app will be available at http://localhost:5173
The Firebase config is already inside src/Firebase.js. It connects to the gowell-agent Firebase project. If you want to use your own Firebase project, follow these steps:
- Go to Firebase Console and create a new project.
- Enable the following services:
- Authentication β Email/Password sign-in method
- Firestore Database β Start in test mode (or configure rules)
- Storage β For avatar uploads
- Analytics (optional)
- Get your config object from Project Settings β Your Apps β Web and replace the values in
src/Firebase.js:
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",
measurementId: "YOUR_MEASUREMENT_ID"
}| Collection | Purpose |
|---|---|
profiles |
User profile data, points, emotional state, metrics history |
moods |
All logged mood entries |
daily_moods |
One entry per user per day (uid_YYYY-MM-DD) |
journal |
Journal entries |
chat |
Chat messages (referenced in analytics) |
The Cloud Function in functions/index.js handles AI chat via Google Gemini.
npm install -g firebase-tools
firebase loginfirebase functions:config:set gemini.key="YOUR_GEMINI_API_KEY"You can obtain a Gemini API key from Google AI Studio.
firebase deploy --only functionsThe function will be deployed to:
https://us-central1-<your-project-id>.cloudfunctions.net/api/chat
Note: If the Cloud Function is unavailable, the Chat page automatically falls back to a local keyword-based reply system. No action needed for offline/fallback mode.
Run these from the root goWell/ directory:
| Command | Description |
|---|---|
npm run dev |
Start the local Vite dev server at localhost:5173 |
npm run build |
Build the production bundle to the dist/ folder |
npm run preview |
Preview the production build locally |
npm run deploy |
Build + deploy everything to Firebase Hosting |
To deploy only the frontend (hosting):
firebase deploy --only hostingTo deploy only functions:
firebase deploy --only functionsThe main landing page. Displays welcome cards with quick links to Chat, Mood Tracker, Journal, and Wellness Hub.
AI-powered support chat using Gemini 2.0 Flash via Firebase Cloud Functions.
- Messages are persisted in
localStorage(gowell_chat) - Falls back to keyword-based local replies if the cloud is unavailable
- Analyzes messages using
emotionAnalyzer.jsand syncs emotional state to Firestore
Log how you feel today from 4 options: Joy, Sadness, Anxiety, Calm.
- Add an optional daily note
- Saves to
localStorageand Firestore (daily_moods,moodscollections) - Shows a scrollable history of the last 10 entries
Personal diary with full CRUD support:
- Add new entries
- Edit existing entries inline
- Delete unwanted entries
- Persisted to
localStorageand Firestorejournalcollection
A curated library of 20 wellness practices across categories:
- Breathing, Grounding, Mindfulness, Journaling, Sleep, Detox, Active, Uplift
- Smart Recommendations: If today's mood is Sad or Anxious, personalized practices are shown at the top
- Completing a practice awards +50 points (via
gamification.js)
- Login / Register with Firebase Authentication (email + password)
- Edit profile: name, age, bio
- Avatar upload to Firebase Storage
- GoWell Points display (synced from Firestore)
- Light/Dark theme toggle
- Emotion Pie Chart β aggregates emotional data from all your activity using Recharts
- Firebase API keys are embedded in
src/Firebase.js. This is standard practice for client-side Firebase apps β access control is managed by Firebase Security Rules, not by hiding the key. - Gemini API key is stored server-side only in Firebase Functions config (not exposed to the browser).
- localStorage keys used by the app:
| Key | Content |
|---|---|
gowell_chat |
Chat message history |
gowell_moods |
Mood entry history array |
gowell_daily |
Daily mood by date key (YYYY-MM-DD) |
gowell_journal |
Journal entries array |
gowell_points |
Cached gamification points |
gowell_theme |
Current theme (light / dark) |
gowell_emotions_cache |
Cached emotion analytics |
gowell_emotional_<uid> |
Per-user emotional state from analyzer |
GoWell is a fully installable Progressive Web App:
- Configured via
vite-plugin-pwainvite.config.js - Service worker at
public/service-worker.jshandles caching - App icons at
public/icons/(192Γ192 and 512Γ512) - Theme color:
#E1027E
To install: open the app in Chrome/Edge on mobile β "Add to Home Screen"
This project was built as a digital wellness assistant for students. For questions or contributions, open an issue or reach out to the maintainer.