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
Configure Nginx Reverse Proxy (Without SSL)
- All steps are performed using Terminal (SSH).
- Create a new Nginx configuration file for your domain:
sudo nano /etc/nginx/sites-available/melto.yourdworld.com
- Paste the following configuration (WITHOUT SSL):
server {
listen 80;
server_name melto.yourdworld.com;
access_log /var/log/nginx/melto.yourdworld.com.access.log;
error_log /var/log/nginx/melto.yourdworld.com.error.log;
location / {
proxy_pass http://127.0.0.1:9219;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- Enable the site:
sudo ln -s /etc/nginx/sites-available/melto.yourdworld.com
/etc/nginx/sites-enabled/
- Test Nginx configuration:
sudo nginx -t
- Restart Nginx:
sudo systemctl restart nginx
- Verify your application is accessible at:
http://melto.yourdworld.com
Install SSL Certificate Using Certbot
- Install Certbot and Nginx plugin:
sudo apt update
sudo apt install certbot python3-certbot-nginx -y
- Generate SSL certificate for your domain:
sudo certbot --nginx -d melto.yourdworld.com
- During installation:
- Select option to redirect HTTP to HTTPS
- Provide email address for renewal notifications
- Certbot will automatically update your Nginx config to:
- Add SSL certificates
- Enable HTTPS (443)
- Redirect HTTP → HTTPS
- Verify SSL auto-renewal:
sudo certbot renew --dry-run
- Final access URL:
https://melto.yourdworld.com
Admin Panel Setup
- Open Admin Code in Vs studio code
- Rename .env.example to .env
- Edit env file in admin
- update backend url to https://melto.yourdworld.com
- install Node modules
npm i
- Create production build:
npm run build
- Upload build files into backend admin directory.
- Access admin panel via configured domain.
Backend Env File Explanation
- PORT: The port on which your Node.js server will run (e.g., 3000, 4000, 5000).
- TOKEN_KEY: Secret key for JWT-based authentication and secure API token generation.
- DATABASE_HOST: Hostname or IP address of your SQL server (e.g., localhost or a remote server).
- DATABASE_NAME: Name of the SQL database to which your application connects.
- DATABASE_USERNAME: Username required to authenticate and access your SQL database.
- DATABASE_PASSWORD: Password for the database user.
- DATABASE_PORT: The port number used by your SQL server (commonly 3306 for MySQL/MariaDB).
- APP_URL: Backend base URL that will be used by frontend/mobile apps to interact with APIs.