Skip to main content

Installation

This page covers cloning the project, installing dependencies, generating the Prisma client, and building both the bot and the dashboard.

Clone the Repository

git clone https://github.com/your-username/mj-bot.git
cd mj-bot

Install Bot Dependencies

cd bot
npm install

Install Dashboard Dependencies

cd dashboard
npm install

Generate the Prisma Client

From the bot directory, generate the Prisma client so TypeScript can interact with your database:

cd bot
npx prisma generate

Push the Database Schema

Once your DATABASE_URL is configured in the .env file (see Configuration), push the schema to your database:

npx prisma db push
info

prisma db push creates or updates the database tables to match the Prisma schema. This is safe to run on a fresh database. For production migrations over time, consider using npx prisma migrate dev instead.

Build the Bot

cd bot
npm run build

This compiles the TypeScript source into JavaScript in the dist/ directory.

Build the Dashboard

cd dashboard
npm run build

This produces an optimized Next.js production build.

Project Structure

After installation, your directory should look like this:

mj-bot/
├── bot/
│ ├── src/ # Bot TypeScript source
│ ├── dist/ # Compiled JavaScript (after build)
│ ├── prisma/ # Prisma schema and migrations
│ ├── .env # Bot environment variables
│ └── package.json
├── dashboard/
│ ├── src/ # Next.js dashboard source
│ ├── .next/ # Production build (after build)
│ ├── .env # Dashboard environment variables
│ └── package.json
└── README.md
tip

If you encounter permission errors during npm install, avoid using sudo. Instead, fix npm permissions or use nvm as described in the Requirements page.