Product Capstone Bangkit Academy 2022
Mobile: Kotlin
Machine Learning: Fast API, Tensorflow, Gunicorn
Client: React, React-dom, Axios, Bulma CSS, CKEditor 5, Lodash
Server: NodeJS, ExpressJS, MySQL, Sequelize, Google Cloud Storage, Multer, Joi, Jsonwebtoken, Cookie-Parser, Dotenv, Cors, Bcrypt
Scraping App: Python, request, ReGex, csv, GoogleTrans. & NodeJS, ExpressJs, Cheerio, Axios.
-
JWT Login with access and refresh token (http only cookie) (access token expired in 20s)
-
2 Users role, admin & users with login validation and admin user management (ban, make admin, etc)
-
Role based route authorization
-
Upload files to Google Cloud Storage (Max 5mb)
-
CRUD diseases, diseases categories, drugs, deseases-drugs with deletion validation (won't delete data if used by other table)
-
Search to database
-
Form validation using JOI
-
SSL connection
https://api.capstone.matthewbd.my.id
deployed in GCP CE (N2 High CPU 2 Cores 2Gb ram) + Google Cloud Storage Bucket
deployed in GCP CE (N2 High CPU 2 Cores 2Gb ram)
https://capstone.matthewbd.my.id
deployed in GCP CE
Auto check user request from JWT Token (can't change another user's data when the token doesn't match).
POST /login
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
password |
string |
Required |
Already response with userdata. and if user "isactive" == 0 or banned, API will response 403.
POST /login-app
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
password |
string |
Required |
Already response with userdata. and if user "isactive" == 0 or banned, API will response 403.
POST /register
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
username |
string |
Required |
name |
string |
Required |
address |
string |
|
phonenum |
string |
|
birthdate |
string |
|
password |
string |
Required |
confpassword |
string |
Required |
user image automatically use default profile picture. Update!, check email and username that exist and joi form validation
GET /token
Access token expired in 20s. Please read web in Acknowledgement
POST /token-app
Parameter | Type | Description |
---|---|---|
refreshToken |
string |
Required |
Access token expired in 20s. Please read web in Acknowledgement
GET /logout
POST /user/update
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
name |
string |
Required |
address |
string |
|
phonenum |
string |
|
birthdate |
string |
POST /user/updatepassword
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
oldpassword |
string |
Required |
newpassword |
string |
Required |
confpassword |
string |
Required |
POST /user/update-profile-picture
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
file |
file |
Required |
"file" use http post file upload. Max file 5Mb (.jpg, .png, .jpeg). Please read web in Acknowledgement
use Authorization -> Bearer Token (.addHeader("Authorization", "Bearer " + token))
GET /diseases
GET /diseases/${slug}
GET /diseases-category
GET /diseases-category/${slug}
GET /drugs
GET /drugs/${slug}
GET /diseases-drugs/${slug}
POST /search
Parameter | Type | Description |
---|---|---|
keyword |
string |
Required. Anything in diseases and drugs |
POST /diseases
Parameter | Type | Description |
---|---|---|
keyword |
string |
Required. Anything in diseases |
POST /drugs
Parameter | Type | Description |
---|---|---|
keyword |
string |
Required. Anything in drugs |
POST /adminlogin
GET /users
GET /banuser/:email
GET /unbanuser/:email
GET /makeadmin/:email
GET /makeuser/:email
GET /admin/diseases
GET /admin/diseases/:slug
POST /admin/diseases
PATCH /admin/diseases/:slug
DELETE /admin/diseases/:slug
Install dependency first
npm install
To deploy this project run
npm run start
API app will run in port 5000 & React app will run in port 3000
To run this project, you will need to add the following environment variables to your .env file
ACCESS_TOKEN_SECRET
REFRESH_TOKEN_SECRET
GCS_BUCKET
GCLOUD_PROJECT
GCLOUD_CLIENT_EMAIL
GCLOUD_PRIVATE_KEY
Sequelize MySql database configuration in config/database.js
Set your frontend domain in cors configuration in index.js
If deployment have ssl, set secure mode in login cookie setting in app/controllers/Users.js