Mendisphere is a platform that helps nonprofit mental health organisations who are struggling financially, specifically with securing grants.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Mendisphere is a platform that helps nonprofit mental health organisations who are struggling financially, specifically with securing grants.
See the Data Model documentation for a detailed ER diagram and description of the Firestore structure.
Instructions on setting up your project locally.
- Node and npm are installed on your machine
- Firebase CLI installed globally:
npm install -g firebase-tools - Firebase app secrets stored in the root level of the project in file named:
.env.development.local - Firebase Admin SDK - automatically installed when running
npm install
This project uses Firebase Emulator Suite for local development. The emulator provides local instances of Firestore, Authentication, Storage, and other Firebase services.
Configuration
- Emulator settings are configured in
firebase.jsonin the root directory - The app connects to emulators by default in
src/services/Firebase/firebaseConfig.ts - If you need to bypass the emulator setup, update the configuration in
firebaseConfig.ts
Emulator UI
- Access the Firebase Emulator UI at
http://localhost:4000when running - View and manage Firestore data, Authentication users, and Storage files
For more details, see the Firebase Emulator Suite documentation.
-
Clone the repo
git clone https://github.com/bettersg/MindBetter-Frontend.git
-
Install NPM packages
npm install
-
Authenticate with Firebase (required for emulators)
firebase login
-
Run the project locally with Firebase Emulators
First time setup (after fresh clone):
Terminal 1 - Start the emulator:
npm run emulators:fresh
Terminal 2 - Seed the data:
npm run seed
Terminal 3 - Start the app:
npm start
This generates mock data on first run. The data will be exported to
src/mocks/data/and persisted locally for future runs.Subsequent runs:
Terminal 1 - Start the emulator:
npm run emulators
Terminal 2 - Start the app:
npm start
This imports your locally saved mock data from previous sessions.
Regenerate mock data:
With the emulator running, in a new terminal:
npm run seed:force
This clears all existing data and generates fresh mock data. Use this when you've updated test data definitions.
-
Access the application at
http://localhost:3000
The seeding script uses Firebase Admin SDK to populate the emulator with mock data. This requires:
- Firebase Admin SDK (included in
package.json) - Firebase emulators running locally
- Environment variables configured in
.env.development.local
Emulator Configuration for Seeding
The seed script reads emulator host configuration from your .env.development.local file:
REACT_APP_FIRESTORE_EMULATOR_HOST="localhost:9999"
REACT_APP_STORAGE_EMULATOR_HOST="localhost:9199"
REACT_APP_AUTH_EMULATOR_HOST="localhost:9099"
These default to localhost:9999, localhost:9199, and localhost:9099 respectively if not specified.
Mock Data Files
- Local data location:
src/mocks/data/(gitignored - not committed) - Mock data definitions:
src/mocks/definitions/ - Seed script:
src/mocks/SeedMockData.ts
Seeding Commands
-
Initial seed (first time or after clearing data):
npm run seed
Creates mock organizations and consultants with authentication records.
-
Force re-seed (clear and regenerate all data):
npm run seed:force
Deletes all existing data and creates fresh mock data. Use this when:
- You've updated mock data definitions in
src/mocks/definitions/ - You want to start with a clean slate
- Mock data has become corrupted or inconsistent
- You've updated mock data definitions in
What Gets Seeded
- Organizations with profiles, summaries, and people spotlights
- Consultant users with:
- Firebase Authentication accounts
- Firestore user documents
- Profile photos in Firebase Storage
To update mock data:
- Modify the test data in
src/mocks/definitions/ - With the emulator running, run
npm run seed:forceto clear and regenerate the data - The updated data will be saved locally in
src/mocks/data/for your use
Troubleshooting Seeding Issues
- Ensure emulators are running before seeding (
npm run emulators) - Check that
.env.development.localhas correct emulator configuration - Verify Firebase Admin SDK is installed (
npm list firebase-admin) - Review emulator logs in the terminal for any connection errors
Distributed under the MIT License. See LICENSE.txt for more information.
