Introduction

  • Thank you for choosing the Melto app. We are pleased to have you with us. Enclosed is the documentation to help you set up and launch the app easily. Please read it carefully, as it contains important information. If you need any assistance or have questions, our support team is just a message away.

Extract Project Zip

  • All setup is performed using Terminal (SSH).
  • Connect to your AWS server using:
ssh ubuntu@YOUR_SERVER_IP
  • Upload the backend zip file using WinSCP or SCP.
  • Navigate to your project directory and extract:
cd /home/ubuntu/melto unzip backend.zip -d backend

Create Instance In AWS

  • Launch an AWS EC2 Instance.
  • Instance Type: t3a.medium
  • Operating System: Ubuntu 24.04 LTS
  • Enable ports in Security Group:
    • 22 – SSH
    • 80 – HTTP
    • 443 – HTTPS
  • Attach key pair and launch the instance.
  • Setup MariaDB (MySQL)

    • Update system packages:
    sudo apt update && sudo apt upgrade -y
    • Install MariaDB (MySQL compatible):
    sudo apt install mariadb-server -y
    • Verify version:
    mysql --version mysql Ver 15.1 Distrib 10.6.22-MariaDB
    • Secure the database:
    sudo mysql_secure_installation
  • Setup Nginx

    • Install Nginx:
    sudo apt install nginx -y
    • Check Nginx version:
    nginx -v nginx/1.18.0 (Ubuntu)
    • Start and enable Nginx:
    sudo systemctl start nginx sudo systemctl enable nginx
  • Setup Node.js And PM2

    • Install NVM (Node Version Manager):
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    • Reload terminal:
    source ~/.bashrc
    • Install Node.js version v20.19.4:
    nvm install 20.19.4 nvm use 20.19.4 nvm alias default 20.19.4
    • Verify Node and npm:
    node -v v20.19.4 npm -v 10.8.2
    • Install PM2 globally:
    npm install -g pm2
  • Setup Database In MariaDB

    • Login to MariaDB:
    sudo mysql
    • Create database and user:
    CREATE DATABASE melto_db; CREATE USER 'melto_user'@'localhost' IDENTIFIED BY 'StrongPassword@123'; GRANT ALL PRIVILEGES ON melto_db.* TO 'melto_user'@'localhost'; FLUSH PRIVILEGES;
    • copy schema.sql file from database folder into /home/ubuntu folder in server
    • Import the database schema:
    mysql -u melto_user -p melto_db < /home/ubuntu/schema.sql
  • Setup Project In Server

    • Navigate to project directory:
    cd /home/ubuntu/melto/backend
    • Setup and configure the .env file:
    mv .env.example .env
    • Edit the .env file and update database, server, and app settings.
    • Install project dependencies:
    npm install
    • Notification Setup (Firebase)
    • Go to Firebase Console → Project Settings → Service Accounts.
    • Click Generate new private key and download the JSON file.
    • Upload the downloaded file to the backend config folder:
    /home/ubuntu/melto/backend/config
    • Rename the downloaded file to firebase.json:
    mv firebase-adminsdk-xxxxx.json firebase.json
    • Start backend using PM2:
    pm2 start index.js --name melto pm2 save pm2 startup
    • Restart backend after Firebase setup:
    pm2 restart melto