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 -y curl software-properties-common sudo apt install -y mariadb-server mariadb-client
    • Start MariaDB:
    sudo systemctl start mariadb
    • Enable MariaDB Service at Server Startup:
    sudo systemctl enable mariadb
    • 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

    • Update Existing Pacakages
    sudo apt update && sudo apt upgrade -y
    • Install Required Dependencies:
    sudo apt install -y curl ca-certificates build-essential
    • Install NVM (Node Version Manager):
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    • Reload terminal:
    source ~/.bashrc
    • Check NVM version:
    nvm -v
    • 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
    • Move Node and NPM to /usr/bin:
    sudo ln -s ~/.nvm/versions/node/v20.19.4/bin/node /usr/bin/node sudo ln -s ~/.nvm/versions/node/v20.19.4/bin/npm /usr/bin/npm
    • 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

    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.

    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;
                    }
                }
              
    • Save and close the file:
    • Press CTRL + O → press Enter (to save)
    • Press CTRL + X (to exit nano)
    • Enable the site:
    sudo ln -s /etc/nginx/sites-available/funbundev.yourdworld.com /etc/nginx/sites-enabled/
    • Test Nginx configuration:
    sudo nginx -t
    • Expected output:
    
              nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
              nginx: configuration file /etc/nginx/nginx.conf test is successful
              
    • If you see the above message, your configuration is valid.
    • 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.
    • Upload Build to Server
    • Access admin panel via configured domain.
  • General Settings

    • The General Settings section allows administrators to control core application behavior, feature availability, and maintenance mode.
    • To access this section, navigate to Admin Panel → Configuration → General Settings.
    • Configure the following options:
      1. Force Set to Maintenance – When enabled, the application will enter maintenance mode and users will see a maintenance screen instead of the regular app interface.
      2. Repeat Days for this Dish – Defines how many days a dish should repeat or appear in the menu. Users will see the dish repeated based on the number of days entered.
    • These settings are useful for controlling temporary downtime, testing environments, and menu or feature repetition logic.
    • After updating the values, click the Save button to apply the changes across the platform.

    Storage Settings

    • The Storage Settings section allows administrators to configure how and where application files, media, and assets are stored. This directly impacts performance, scalability, and reliability.
    • To access this section, navigate to Admin Panel → Configuration → Storage Settings.
    • Configure the following options:
      1. Storage Type – Select the storage provider used by the application. Currently supported option is AWS.
      2. AWS Endpoint – Enter the AWS service endpoint URL used for storage operations.
      3. AWS CDN URL – Specify the CDN URL used to serve stored files quickly across different regions.
      4. AWS Region – Define the AWS region where the storage bucket is hosted.
      5. AWS Access Key – Enter the access key associated with your AWS IAM user.
      6. AWS Secret Key – Enter the secret key corresponding to the AWS access key. This field is masked for security.
      7. AWS Bucket Name – Provide the name of the S3 bucket where files will be stored.
    • Ensure all AWS credentials are correct and have the required permissions before saving the configuration.
    • Click the Save button to apply the storage configuration changes.

    Ads Configuration

    • The Ads Configuration section allows administrators to enable advertisements and configure ad provider keys for monetizing the application.
    • To access this section, navigate to Admin Panel → Configuration → Ads Config.
    • Configure the following options:
      1. Enable Ads – Enables or disables advertisements across the application. When disabled, no ads will be shown to users.
      2. Ad Type – Select the ad provider to be used. Supported providers include AdMob and Meta (Facebook Ads).
      3. AdMob Banner Ad Key – Banner ad unit ID used for displaying banner advertisements.
      4. AdMob Interstitial Ad Key – Interstitial ad unit ID used for full-screen ads.
      5. AdMob App Open Ad Key – Ad unit ID used to show ads when the application is opened.
      6. AdMob Native Advanced Ad Key – Native advanced ad unit ID for custom-designed ad placements.
      7. AdMob Rewarded Ad Key – Rewarded ad unit ID that allows users to earn rewards by watching ads.
      8. AdMob Publisher ID – Publisher identifier associated with the AdMob account.
      9. AdMob App ID – Application ID provided by AdMob for platform-level ad integration.
      10. Meta Banner Ad Key – Banner ad placement ID for Meta (Facebook) ads.
      11. Meta Interstitial Ad Key – Interstitial ad placement ID for Meta ads.
      12. Meta App Open Ad Key – App open ad placement ID for Meta ads.
      13. Meta Native Advanced Ad Key – Native advanced ad placement ID for Meta ads.
      14. Meta Rewarded Ad Key – Rewarded ad placement ID for Meta ads.
      15. Meta Publisher ID – Publisher ID associated with the Meta Ads account.
      16. Meta App ID – Application ID used for Meta Ads integration.
    • Ensure that all ad keys are correctly configured according to the selected ad provider to avoid ad delivery issues.
    • Click the Save button to apply the advertisement configuration.

    Regenerate / Redo Settings

    • The Regenerate / Redo Settings section allows administrators to configure advertisement rules for redo and regenerate actions within the application.
    • To access this section, navigate to Admin Panel → Configuration → Regenerate / Redo.
    • Each configuration row defines how ads are triggered based on user actions:
      1. Action Type – Select whether the rule applies to Redo or Regenerate actions.
      2. Action Count – Specifies how many times the action (Redo or Regenerate) can be performed before an ad is shown.
      3. Ad Format – Choose the type of advertisement to display:
        • Interstitial – Full-screen ad
        • Rewarded – User receives a reward after watching the ad
        • App Open – Ad shown when the app is opened
      4. Delete Rule – Allows removing a specific rule using the delete icon.
    • Multiple rules can be configured to create flexible ad strategies based on different user behaviors.
    • Changes are applied immediately after saving the configuration.

    Legal Information

    • The Legal Information section allows administrators to manage essential legal and regulatory content displayed within the application.
    • To access this section, navigate to Admin Panel → Configuration → Legal Information.
    • Configure the following legal documents:
      1. Terms and Conditions – Define the rules, guidelines, and agreements that users must accept to use the application.
      2. Privacy Policy – Specify how user data is collected, stored, processed, and protected in compliance with regulations.
      3. Contact Us – Provide official contact information such as email address, phone number, or support details for user inquiries.
    • All entered content is reflected across the application wherever legal or compliance information is required.
    • Ensure the information is accurate and legally compliant before saving changes.