Manual Installation

Manual Panel Setup Lite and Deploy Fast

index.js
const { spawnSync, spawn } = require('child_process');
const { existsSync, readFileSync, writeFileSync } = require('fs');
const path = require('path');

const APP_DIR = 'Arch-md';
const ENV_PATH = path.join(APP_DIR, '.env');

// 🔐 Replace with your actual session ID
const SESSION_ID = 'PASTE_YOUR_SESSION_HERE';

const MAX_RESTARTS = 5;
const RESTART_WINDOW = 30000;
let restartCount = 0;
let lastRestart = Date.now();

// ✅ Logger with color
global.log = function (level, msg) {
  const now = new Date();
  const dd = now.getDate().toString().padStart(2, '0');
  const mm = (now.getMonth() + 1).toString().padStart(2, '0');
  const yy = now.getFullYear().toString().slice(-2);
  const timestamp = now.toLocaleTimeString("en-GB") + ` ${dd}-${mm}-${yy}`;

  const tag = level.toUpperCase();
  const color = tag === 'INFO' ? '\x1b[36m' : tag === 'ERROR' ? '\x1b[31m' : '\x1b[33m';
  const reset = '\x1b[0m', blue = '\x1b[34m';

  console.log(`${color}${tag}${reset} [${timestamp}]:`, `${blue}${msg}${reset}`);
};

function cloneRepo() {
  log('INFO', 'Cloning Arch-md repository...');
  const res = spawnSync('git', ['clone', 'https://github.com/Ednut001/Arch-md.git', APP_DIR], {
    stdio: 'inherit'
  });
  if (res.status !== 0) {
    log('ERROR', 'Failed to clone repository!');
    process.exit(1);
  }
}

function installDependencies() {
  log('INFO', 'Installing dependencies...');
  const res = spawnSync('npm', ['install'], {
    cwd: APP_DIR,
    stdio: 'inherit'
  });
  if (res.status !== 0) {
    log('ERROR', 'Dependency installation failed!');
    process.exit(1);
  }
}

function writeEnvVariables() {
  let env = existsSync(ENV_PATH) ? readFileSync(ENV_PATH, 'utf-8') : '';

  if (!env.includes('SESSION_ID=')) {
    env += `\nSESSION_ID=${SESSION_ID}`;
  } else {
    env = env.replace(/SESSION_ID=.*/g, `SESSION_ID=${SESSION_ID}`);
  }

  if (!env.includes('AUTO_UPDATE=')) {
    env += `\nAUTO_UPDATE=true`;
  } else {
    env = env.replace(/AUTO_UPDATE=.*/g, `AUTO_UPDATE=true`);
  }

  writeFileSync(ENV_PATH, env.trim() + '\n');
  log('INFO', 'SESSION_ID written to .env'); // Silent about AUTO_UPDATE
}

function startBot() {
  const bot = spawn('node', ['index.js'], {
    cwd: APP_DIR,
    stdio: 'inherit'
  });

  bot.on('exit', (code) => {
    if (code !== 0) {
      const now = Date.now();
      if (now - lastRestart > RESTART_WINDOW) restartCount = 0;
      restartCount++;
      lastRestart = now;

      if (restartCount > MAX_RESTARTS) {
        log('ERROR', 'Too many restarts. Exiting...');
        process.exit(1);
      }

      log('ERROR', `Bot crashed. Restarting... (${restartCount}/${MAX_RESTARTS})`);
      startBot();
    }
  });
}

// === MAIN EXECUTION ===
if (!existsSync(APP_DIR)) {
  cloneRepo();
}

installDependencies();
writeEnvVariables();
startBot();
package.json
{
  "name": "arch-md-lite",
  "version": "1.0.0",
  "description": "Auto-clone and launch Arch-MD with session injection",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "keywords": ["whatsapp", "bot", "arch-md", "baileys"],
  "author": "Ednut",
  "license": "MIT"
}

Local Setup

Terminal Commands
git clone https://github.com/Ednut001/Arch-Md.git
cd Arch-Md
npm install
npm start

Ubuntu / SSH Setup

Ubuntu Commands
sudo apt update && sudo apt upgrade -y
sudo apt install -y git nodejs ffmpeg libwebp-dev
git clone https://github.com/Ednut001/Arch-Md.git
cd Arch-Md
npm install
npm start

Termux Setup

Termux Commands
pkg update && pkg upgrade
pkg install git nodejs-lts
git clone https://github.com/Ednut001/Arch-Md.git
cd Arch-Md
npm install
npm start