Jaga Mental

banner

Jaga Mental - Backend

Table of Contents


Introduction📚

Mental health issues among Gen Z in Indonesia have been on the rise, with limited access to services tailored to their needs. Our team identified this gap and developed an innovative solution combining machine learning, mobile development, and cloud computing to empower users in managing their mental health. By leveraging technology, we aim to help users independently understand their mood patterns and improve their overall well-being.

Service Architecture🏛

Deskripsi Gambar

Prerequisites📋

Ensure you have the following installed on your system:

Installation💾

1. Clone the Repository

git clone https://github.com/Jaga-Mental-Dev/jaga-mental-backend.git
cd jaga-mental-backend

2. Install Dependencies

npm install

or if you're using yarn

yarn install

Configuration⚙

1. Create Firebase Key

Create a firebase-key.json file inside the src/ directory and place your Firebase credentials in it.

touch src/firebase-key.json

Example firebase-key.json :

{
  "type": "service_account",
  "project_id": "your-project-id",
  "private_key_id": "your-private-key-id",
  "private_key": "your-private-key",
  "client_email": "your-client-email",
  "client_id": "your-client-id",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "your-cert-url"
}

2. Set up environment variables

Create .env file in the root of directory and add following variables:

# Server Configuration
PORT=3000
HOST=localhost
HOST_URL=http://localhost:3000
 
# Supabase Configuration
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-key
 
# Bucket
BUCKET_NAME=your-bucket-name
 
# Base Model URL
BASE_MODEL_URL=your-base-model-url

Running The Application🚀

Development Mode

To start app in development mode :

npm run start-dev

Production Mode

To start app in production mode :

npm start

Folder Structure📁

jaga-mental-backend/
├── src/
   ├── firebase-key.json    # Firebase credentials file
   ├── config/              # Configuration files
   ├── controllers/         # Route controllers
   ├── services/            # Services functions 
   ├── middlewares/         # Middleware functions
   ├── routes/              # Application routes
   └── server.js            # Entry point of the application
├── .env                     # Environment variables
├── package.json             # Project dependencies and scripts
├── README.md                # Project documentation
└── .gitignore               # Ignored files in Git
└── .gcloudignore            # Ignored files in Google cloud deployment
└── Dockerfile               # Docker configuration