Skip to content

bettersg/Mendisphere

Repository files navigation


Logo

Mendisphere

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

Mendisphere is a platform that helps nonprofit mental health organisations who are struggling financially, specifically with securing grants.

(back to top)

Built With

  • React

(back to top)

Data Model

See the Data Model documentation for a detailed ER diagram and description of the Firestore structure.

(back to top)

Getting Started

Instructions on setting up your project locally.

Prerequisites

  1. Node and npm are installed on your machine
  2. Firebase CLI installed globally: npm install -g firebase-tools
  3. Firebase app secrets stored in the root level of the project in file named: .env.development.local
  4. Firebase Admin SDK - automatically installed when running npm install

Firebase Emulator Setup

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.json in 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:4000 when running
  • View and manage Firestore data, Authentication users, and Storage files

For more details, see the Firebase Emulator Suite documentation.

Installation

  1. Clone the repo

    git clone https://github.com/bettersg/MindBetter-Frontend.git
  2. Install NPM packages

    npm install
  3. Authenticate with Firebase (required for emulators)

    firebase login
  4. 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.

  5. Access the application at http://localhost:3000

Working with Mock Data

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

  1. Initial seed (first time or after clearing data):

    npm run seed

    Creates mock organizations and consultants with authentication records.

  2. 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

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:

  1. Modify the test data in src/mocks/definitions/
  2. With the emulator running, run npm run seed:force to clear and regenerate the data
  3. 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.local has correct emulator configuration
  • Verify Firebase Admin SDK is installed (npm list firebase-admin)
  • Review emulator logs in the terminal for any connection errors

(back to top)

Contributing

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

(back to top)

About

Front end for Mendisphere

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages