Nyenyak uses Google Cloud Platform (GCP) and Firebase to develop a system capable of classifying sleep disorders, such as insomnia and sleep apnea, based on user data. Additionally, the system will provide actionable suggestions to enhance the sleep quality of users experiencing sleep disturbances. The project involves a collaboration between machine learning, mobile development, and cloud computing teams.
- Create Project & Configure Identity and Access Management.
- Enable the following APIs:
- App Engine API
- Cloud Run Admin API
- Google Container Registry API
- Firebase API (Management, Realtime Database, etc.)
- Cloud Monitoring API
- Cloud Logging API
- Open Firebase, go to the console, and connect it to your Google Cloud Project.
- Activate Firebase Auth & Firebase Realtime Database.
- Create a Service Account and download the corresponding
seviceAccountKey.json
file.
- Open cloud shell or your preferred code editor (Visual Studio Code).
- Clone the Nyenyak project from Nyenyak-Backend-Repo using the command
git clone -b BackEnd https://github.com/w0n0g1ren/Nyenyak.git
. - Initialize a Git repository with
git init
and connect it to your Google Cloud account.
In the terminal, set your project by executing gcloud config set project nyenyak-project-dev
.
Deploy both nodeJS and model API to App Engine and Cloud Run.
- Open Model-API directory
cd Model-API
- Follow
readme
toinstall depencies
- Build and Push Docker Image
docker build -t gcr.io/nyenyak-project-dev/nyenyak-api-model . docker push gcr.io/nyenyak-project-dev/nyenyak-api-model
- Deploy Docker Image by Cloud Run
gcloud run deploy nyenyak-api-model \ --image gcr.io/nyenyak-project-dev/nyenyak-api-model \ --platform managed \ --allow-unauthenticated
- Wait and save deployed Model-API link
- Open Backend-API directory
cd ../Backend-API
- Follow
readme
toinstall depencies
and addserviceAccountKey.json
- Copy deployed Model-API link and paste to
Backend-API/routes/diagnosis.js
in line 156 (Make sure to add /prediction to endpoint, example:https://nyenyak-model-api-z2dhcxitca-et.a.run.app
tohttps://nyenyak-model-api-z2dhcxitca-et.a.run.app/prediction
) - Deploy to App Engine
gcloud app deploy
- For API Documentation, refer to the following link: API Documentation
Additional Backend Details:
- Backend API is built using Node Express.js to handle user authentication, diagnosis, articles, and user details.
- We deployed the backend API to App Engine for easier scalability and reliability.
- A separate API for TensorFlow model, built using Flask and deployed to Cloud Run.
- Utilize Cloud Monitoring & Logging for comprehensive resource monitoring and alerting.
The Nyenyak project integrates Google Cloud Platform and Firebase Realtime Database to create a robust and scalable solution. The backend architecture ensures efficient communication between the mobile app, backend API, and machine learning model, providing users with accurate sleep disorder diagnoses and solution for improvement.