AmrTlwr.in ← Back to Home
Developer Documentation

Complete Installation Guide

Follow these step-by-step instructions to deploy the InstaBot engine to your own server.

Highly Recommended

Server & Hosting Environment

For the best performance and ease of deployment, we strongly suggest setting up your own Virtual Private Server (VPS) (e.g., DigitalOcean, Hetzner, Vultr) rather than using shared hosting.

Once you have your VPS running Ubuntu/Debian, install a free server control panel to easily manage your Node.js apps, databases, and SSL certificates:

Step 1: Firebase Configuration

1. Backend Admin SDK

Go to your Firebase Console > Project Settings > Service Accounts. Click "Generate new private key". Download the file, rename it exactly to firebase-service-account.json, and place it in the root directory of your backend server files.

2. Frontend Client SDK

In your Firebase Console, go to Project Settings > General > Your Apps. Copy your Firebase Config object. Open index.html (or your frontend files) and paste it over the existing configuration:

// Firebase Configuration (Replace in index.html)
const firebaseConfig = {
    apiKey: "YOUR_API_KEY",
    authDomain: "YOUR_PROJECT.firebaseapp.com",
    projectId: "YOUR_PROJECT_ID",
    storageBucket: "YOUR_PROJECT.firebasestorage.app",
    messagingSenderId: "YOUR_SENDER_ID",
    appId: "YOUR_APP_ID"
};

Step 2: Meta Developer Setup

To automate Instagram, you need official API credentials from Meta.

  1. Go to the Meta for Developers Dashboard.
  2. Click Create App and select the "Business" or "Other" type depending on your interface.
  3. Add the Instagram Graph API product to your app.
  4. Navigate to API setup with Instagram business login to find your Instagram app ID and Instagram app secret. You will need these for the .env file.

Step 3: Configure .env File

Create a new file named .env in the root folder of your backend and paste the following template. Fill in the values with your specific credentials.

# Meta / Instagram Credentials
VERIFY_TOKEN=my_super_secret_token_123
CLIENT_ID=Instagram app ID
CLIENT_SECRET=Instagram app secret
REDIRECT_URI=https://yourdomain.com/auth/instagram/callback

# MongoDB Connection
MONGO_URI=mongodb://127.0.0.1:27017/instagram_bot_db

# Cloudflare R2 Storage (For Image Uploads)
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
R2_ACCESS_KEY_ID=your_r2_access_key
R2_SECRET_ACCESS_KEY=your_r2_secret_key
R2_BUCKET_NAME=your_bucket_name
R2_PUBLIC_CUSTOM_DOMAIN=https://cdn.yourdomain.com

# Redis Connection (For Task Queues)
REDIS_URL=redis://127.0.0.1:6379/1

Step 4: MongoDB & Redis Setup

MongoDB (Database)

The bot uses MongoDB to store users, automation rules, and logs. You can either install MongoDB locally on your VPS (via aaPanel) or use a managed cloud service like MongoDB Atlas. Update your MONGO_URI accordingly.

Redis (Task Queues & Anti-Block)

Redis is required for the BullMQ background job processor to handle rate limiting and message queues safely. Install the Redis server on your VPS (aaPanel has a 1-click install for this). The default local URL is usually redis://127.0.0.1:6379/1.

Step 5: Start the Application

Once your environment variables and databases are configured, open your terminal, navigate to the project directory, and run the following commands to install dependencies and start the server.

# Install required Node.js packages
npm install

# Start the server (Development)
node server.js

# OR Start the server (Production via PM2)
pm2 start server.js --name "instabot"

Note: If you are using aaPanel, you can use the built-in "Node.js Environment" app to add your project, map it to your domain, set up Let's Encrypt SSL, and start the service via the GUI without using the terminal.