- DermaSeer API is an app that analyzes skin condition images using machine learning that provide diagnoses and use AI-powered to get product recommendations.
Name | Bangkit-ID | Github-Profile | |
---|---|---|---|
Rojak Kurniawan | C318B4KY3957 | @rojakkurniawan | |
Muhammad Rizqi Faadhilah | C318B4KY3071 | @mr-fadh |
- Ensure you are on the right or your desired directory.
git clone https://github.com/DermaSeer/DermaSeer-api.git
-
Machine Learning Model API
- Ensure that you already have the machine learning model deployed. You can follow the instructions in the DermaSeer-Model-API.
- Save the deployed model URL to the .env file.
# example: https://dermaseer-ml-api-id.asia-southeast2.run.app MODEL_API_URL=""
-
VertexAI Models
- Ensure that you have the VertexAI models deployed. You can deploy our selected HuggingFace models on VertexAI.
- Save the VertexAI model endpoint details to the .env file.
# Vertex AI Model Endpoint VERTEX_AI_PROJECT_ID="" VERTEX_AI_LOCATION="" VETEX_AI_ENDPOINT_ID=""
-
PostgreSQL Installation
- Ensure you have PostgreSQL installed on your machine. You can download it from PostgreSQL official website.
-
Create Database
- Create a new PostgreSQL database for the project.
CREATE DATABASE [db_name]
-
Configure .env file
- Use PostgreSQL
- Create Database and setup DATABASE_URL in .env
DATABASE_URL=postgresql://username:password@localhost:5432/[db_name]
- Create a Storage Bucket
- Create a storage bucket on Google Cloud Platform.
- Save the bucket name to the .env file.
# Google Cloud Storage GOOGLE_CLOUD_PROJECT_ID="" GOOGLE_CLOUD_BUCKET_NAME=""
- Fine-Grained Access Control
- Ensure that you enable Fine-grained access control for your bucket.
- Service Account Permissions
- Create a Service Account in Google Cloud IAM with Storage Object Admin permissions.
- Download the Service Account JSON key file
- Save Credentials
- Save the downloaded Service Account credentials file to:
./src/application/credentials/cloudStorage.json
- Firebase Admin
- Go to your Firebase project settings.
- Under Service Accounts, generate a new private key.
- Save the Firebase Admin Service Account JSON file to:
./src/application/credentials/firebaseAdmin.json
- Firebase App Web
- In Firebase project settings, click General then add a new Web App.
- Copy the Firebase configuration object.
- Save the Firebase configuration object to ./src/application/firebaseAuth.js Example of firebaseAuth.js :
const firebaseConfig = { apiKey: "", authDomain: "", projectId: "", storageBucket: "", messagingSenderId: "", appId: "" };
- Local Development
- Install dependencies
npm install
- Run database migrations
npx prisma migrate
- Start the application
# Production mode npm run start # Development mode npm run dev
- Install dependencies
- Docker Deployment
- Build docker image
docker build -t dermaseer-api:1.0.0 .
- Run the container
docker run -d -p 5001:5001 --name backend dermaseer-api:1.0.0
- Build docker image
- Google Cloud Run Deployment
- Create Artifact Registry Repository
gcloud artifacts repositories create dermaseer \ --repository-format=docker \ --location=asia-southeast2
- Set Up Environment Variables
# Set your project ID export GOOGLE_CLOUD_PROJECT=your-project-id # Set your region export REGION=asia-southeast2 # Set your service name export SERVICE_NAME=dermaseer-api # Setu your Artifact Registry Repository export ARTIFACT_REPO=dermaseer
- Build and push docker image to Artifact Registry
gcloud builds submit --tag asia-southeast2-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPO}/dermaseer-api:1.0.0
- Deploy to Cloud Run
gcloud run deploy ${SERVICE_NAME} \ --image asia-southeast2-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPO}/dermaseer-api:1.0.0 \ --platform managed \ --region ${REGION} \ --allow-unauthenticated \ --port 5001
- Create Artifact Registry Repository
Once the installation is complete:
- Access the application at http://localhost:5001 or the provided Cloud Run URL.
- Take a look at the API documentation to interact with the endpoints.
Variable | Description |
---|---|
DATABASE_URL | Connection string for the PostgreSQL database |
PORT | Port number for the Express.js server |
GOOGLE_CLOUD_PROJECT_ID | Google Cloud project ID |
GOOGLE_CLOUD_BUCKET_NAME | Name of Google Cloud Storage bucket |
MODEL_API_URL | URL for the external model API (e.g., deployed on Google Cloud Run) |
VERTEX_AI_PROJECT_ID | Google Cloud project ID for Vertex AI |
VERTEX_AI_LOCATION | Location for the Vertex AI model |
VERTEX_AI_ENDPOINT_ID | Endpoint ID for the deployed Vertex AI model |
You can also explore and interact with these endpoints directly using our Postman collection: Postman API Documentation