- Diagram Architecture
- Firestore Database Structure
- Tech Architecture
- Dependencies
- Recap Endpoint Routes
- API Endpoint
- Installation
- Setup Google Cloud
- Setup Service Account
- Deploy Google Cloud
- Contributor
- Node.js
- Express.js
- App Engine
- Cloud Storage
- Tensorflow Lite
- Firestore
- @google-cloud/firestore - Version: ^7.7.0
- bcrypt - Version: ^5.1.1
- cors - Version: ^2.8.5
- dotenv - Version: ^16.4.5
- express - Version: ^4.19.2
- express-validator - Version: ^7.1.0
- firebase-admin - Version: ^12.1.1
- jsonwebtoken - Version: ^9.0.2
- multer - Version: ^1.4.5-lts.1
Route | HTTP Method | Description | Auth |
---|---|---|---|
/login | POST | Log in a user | Not Required |
/register | POST | Register a new user | Not Required |
/logout | POST | Log out a user | Not Required |
/profile | GET | Get user profile | Required |
/dictionary/alphabet | GET | Get dictionary alphabet | Required |
/dictionary/number | GET | Get dictionary number | Required |
/quizzes | POST | Submit a quiz | Required |
/quizzes/:id | GET | Get quiz details | Required |
/quizzes/type/number | GET | Get number quiz | Required |
/quizzes/type/alphabet | GET | Get alphabet quiz | Required |
/quizzes/history | GET | Get all user quiz history | Required |
/quizzes/history?count | GET | Get count user quiz history | Required |
For detailed information on each API endpoint, refer to the API Endpoint Documentation
- Prerequisites
- Ensure you have Node.js installed, preferably version 18.x or later.
- Clone The Project
git clone https://github.com/gesturo-team/Cloud-Computing.git
cd Cloud-Computing
- Install Dependencies
npm install
- Environment Variables (.env)
- Create a
.env
file in the root directory of the project. - Set the following environment variables:
PORT=<Your_Port>
JWT_SECRET=<Your_JWT>
- Running the Application
- To start the application in development mode, run:
npm run start:dev
- For production mode, simply run:
npm start
- Open Google Cloud Console.
- Go to App Engine.
- Start a app engine by clicking CREATE APPLICATIOn button.
- Choose your region (We Use asia-souteast-2) and click next.
- Click I'LL DO THIS LATER.
- Open Google Cloud Console.
- Go to Cloud Storage.
- Create a bucket by clicking CREATE button.
- Set your globally unique bucket name.
- Choose your region (We Use asia-souteast-2).
- Set a default class (Standard).
- Uncheck the Enforce public access prevent ...
- Select Access Control as
Fine-grained
. - Then, hit CREATE.
- On your buckets, click the three dots at the right of your bucket.
- Click Edit Access and click Add Principal.
- In the new principal column type
allUsers
. - In the role column select Cloud Storage >
Storage Object Viewer
. - Click Save.
- Open Google Cloud Console.
- Go to Firestore.
- Crete a databases by clicking CREATE DATABASE button.
- Set a firestore mode (Native Mode) and click continue.
- Set a database id (default).
- Choose your region (We Use asia-souteast-2).
- Click CREATE DATABASE button.
- Go to IAM & Admin > Service Accounts or click here.
- Select your project.
- Click Create Service Account
- Set your name, Select role
Firebase Admin
- Click your service account email > KEYS > Select ADD KEY and click Create new key.
- Select JSON and click CREATE.
- Save your credential account.
- Go to IAM & Admin > Service Accounts or click here.
- Select your project.
- Click Create Service Account
- Set your name, Select role Cloud Storage >
Storage Admin
- Click your service account email > KEYS > Select ADD KEY and click Create new key.
- Select JSON and click CREATE.
- Save your credential account.
- Open your Cloud Shell by clicking here.
- Set your project.
gcloud config set project [PROJECT_ID]
- Clone this repository by the below command.
git clone -b master https://github.com/gesturo-team/Cloud-Computing
cd Cloud-Computing/api
- Create a .env file and import your JWT Secret Key and Port into .env file.
touch .env && nano .env
PORT=<Your_Port>
JWT_SECRET=<Your_JWT>
-
Upload your Service Account Credentials to the Cloud Computing/api/src/configs.
-
Rename the file as
serviceKey.json
. -
Install node package by the bellow command.
npm install
- Deploy the API by running the command on your cloud shell.
gcloud app deploy
- Type youyr service name and select your region (We Use asia-souteast-2).
- Wait until it finishes.
Name | University | Role | Links |
---|---|---|---|
Ryan Rizky Pratama | Politeknik Negeri Banjarmasin | Cloud Computing | |
Reja Revaldy. F. | Politeknik Negeri Banjarmasin | Cloud Computing |