Skip to content

Vizia-Project/vizia-backend-service

Repository files navigation

Vizia API 💻

TechnologiesSystem DesignFolder StrcutureGetting StartedAPI EndpointsCollaboratorsContribute

Documentation of Backend API Application for Vizia Project

💻 Technologies

  • Javascript
  • HapiJS
  • MySQL
  • Postman
  • Swagger
  • App Engine
  • Cloud Storage
  • Cloud SQL

☁️ System Design

📁 Folder Structure

.
├── .github                    # CD pipeline configuration, triggered by GitHub Actions
├── article-service            # Scrap and serves eye health articles from various sources
├── database-migrator          # Database migration to define schema in cloud DBMS
├── default-service            # OpenAPI Swagger documentation from whole of services
├── history-service            # Handles the storage and retrieval of eye prediction data
├── user-auth-service          # Manages user authentication and authorization
├── setup.sh                   # Entrypoint to setup nodejs dependency foreach services
├── vizia-openapi.yaml         # API definition for API Gateway
└── README.md

🚀 Getting started

Here is describe how to run this project locally

Prerequisites

Here is list all prerequisites necessary for running this project. For example:

Cloning

How to clone this project

git clone https://github.com/Vizia-Project/vizia-backend-service

Config .env variables

Use the .env.example as reference to create your configuration file .env with your GCP and Database Credentials

NODE_ENV=development
PORT=3002

DB_HOST=
DB_PORT=3306
DB_USER=
DB_PASSWORD=
DB_NAME=

JWT_SECRET=

GOOGLE_CLOUD_PROJECT_ID=
GOOGLE_CLOUD_BUCKET_NAME=

Do the same thing on the app.yaml file of app.example.yaml

Put GCP service account

  1. Log in to the Google Cloud Platform (GCP) console
  2. Create a service account. Go to the IAM & Admin section in the navigation menu. Select Service Accounts. Click Create Service Account. Enter a Name and ID for your service account. Optionally, add a Description. Click Create and continue.
  3. Create a key On the service account page, click the Keys tab. Click Add Key. Select Create new key. Choose JSON as the key type. Click Create. A JSON file containing the service account key will be downloaded to your computer.
  4. Put service json in each service.

Starting

How to start this project

cd vizia-backend-service
./setup.sh # For linux or macos

Use setup.sh without './' for Windows

📍 API Endpoints

Here is list the main routes of this API, and what are their expected request bodies and responses. ​

route description
POST /login Validate existing account by email and password request details
POST /register Add a new user account and validate each of input request details
GET /user/{id} Get account information and settings of user request details
PUT /user/{id} Update account information and settings of user request details
GET /articles Fetch all articles from all resources request details
GET /articles/detail Get detail from an article request details
GET /histories Fetch all histories of predicts result by user account request details
POST /histories Save predicts result by user account request details
GET /histories/{id} Fetch history detail of predicts result by history id request details

POST /login

REQUEST

{
  "email": "[email protected]",
  "password": "4444444"
}

RESPONSE

{
  "status": "success",
  "message": "Login and get user are success",
  "data": {
    "id": 115,
    "name": "Teme Wakaihasite",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwiaWF0IjoxNzMzMTQ5MDU0fQ"
  }
}

POST /register

REQUEST

{
  "name": "Teme Wakaihasite",
  "email": "[email protected]",
  "password": "4444444",
  "password_confirmation": "4444444"
}

RESPONSE

{
  "status": "success",
  "message": "New account creation is success",
  "data": {
    "id": 115,
    "name": "Teme Wakaihasite",
    "email": "[email protected]"
  }
}

For more API endpoint details, please visit Vizia OpenAPI Docs

🤝 Collaborators

Special thank you for all people that contributed for this project.

Fernanda Kipper Profile Picture
Abu Toyib Al Aziz
Elon Musk Picture
Anna Stefanie Ruitan

📫 Contribute

Here you will explain how other developers can contribute to your project. For example, explaining how can create their branches, which patterns to follow and how to open an pull request

  1. git clone https://github.com/Vizia-Project/vizia-backend-service
  2. git checkout -b feature/NAME
  3. Follow commit patterns
  4. Open a Pull Request explaining the problem solved or feature made, if exists, append screenshot of visual modifications and wait for the review!

Documentations that might help

📝 How to create a Pull Request

💾 Commit pattern

Releases

No releases published

Packages

No packages published