InterChat LogoInterChat

    Installation Guide

    Step-by-step instructions for installing InterChat

    Installation Guide

    This guide will walk you through the process of installing and setting up your own instance of InterChat.

    These instructions are for Linux-based systems. The process may differ for other operating systems.

    Prerequisites

    Before you begin, ensure you have:

    • A server running Linux (Ubuntu 20.04+ recommended)
    • Root or sudo access
    • A Discord application with a bot token
    • A MongoDB Atlas account and cluster
    • Basic knowledge of command line and server administration

    Installation Steps

    Install system dependencies

    First, install the necessary system dependencies:

    # Update package lists
    sudo apt update
     
    # Install dependencies
    sudo apt install -y git curl build-essential

    Install Node.js

    InterChat requires Node.js and npm runtime:

    # Install Node.js
    curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
    sudo apt install -y nodejs
     
    # Install Bun
    curl -fsSL https://bun.sh/install | bash
    source ~/.bashrc  # or restart your terminal

    Set up MongoDB Atlas

    InterChat uses MongoDB Atlas for its database:

    1. Create a MongoDB Atlas account
    2. Create a new cluster (the free tier is sufficient for small deployments)
    3. Set up a database user with read/write permissions
    4. Configure network access to allow connections from your server's IP
    5. Get your connection string from the Atlas dashboard

    Your connection string will look like this:

    mongodb+srv://username:[email protected]/interchat?retryWrites=true&w=majority

    Install Redis

    InterChat uses Redis for caching and session management:

    # Install Redis
    sudo apt install -y redis-server
     
    # Start and enable Redis
    sudo systemctl start redis-server
    sudo systemctl enable redis-server

    Clone the InterChat repository

    # Clone the repository
    git clone https://github.com/discord-interchat/InterChat.git
    cd InterChat

    Install dependencies

    # Install dependencies
    npm install

    Configure environment variables

    Create a .env file in the root directory and edit it:

    vim .env # or use any other text editor

    Fill in the required environment variables (see Configuration Guide for details).

    Set up the database

    # Generate Prisma client
    npx prisma generate

    Build the application

    # Build the application
    npm run build
    npm run locale-types
     
    # Sync commands and emojis
    npm run sync:commands --private --public
    npm run sync:emojis

    Start InterChat

    # Start in development mode
    npm dev

    Verifying Installation

    To verify that InterChat is running correctly:

    1. Check the logs for any errors:

      # If using PM2
      pm2 logs interchat
    2. Invite your bot to a Discord server and test basic commands like /stats.

    3. Try creating a hub with /hub create and connecting a channel with /connect.

    If you encounter issues, check the logs for error messages and refer to the troubleshooting section below.

    Updating InterChat

    To update your InterChat instance to the latest version:

    # Pull the latest changes
    git pull
     
    # Install dependencies
    npm install
    npm run locale-types
     
    # Build the application
    npm run build
     
    # Sync commands and emojis
    npm run sync:commands --private --public
    npm run sync:emojis
     
    # Restart the application
    pm2 restart interchat

    Troubleshooting

    Common Issues

    1. Database connection errors:

      • Check your MongoDB Atlas connection string in the .env file
      • Ensure your IP address is whitelisted in the MongoDB Atlas Network Access settings
      • Verify that your MongoDB Atlas user has the correct permissions
    2. Redis connection errors:

      • Ensure Redis is running: sudo systemctl status redis-server
      • Check your Redis configuration in the .env file
    3. Discord API errors:

      • Verify your bot token is correct
      • Ensure your bot has the necessary permissions
      • Check that you've enabled the required Gateway Intents in the Discord Developer Portal
    4. Build errors:

      • Ensure you have the correct version of Node.js
      • Try deleting node_modules, build, tsconfig.tsbuildinfo and reinstalling dependencies

    For more help, join our support server or check the GitHub issues.