1Dmar / discord-bot-template

Best Discord Bot template with Dashboard and Documentation

Home Page:https://money-shark.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discord Bot Template

The powerful discord bot template with Next.js Dashboard and Discord.js v14.

Features

  • Node.js Discord Bot with discord-fp
  • Kafka Event Streaming
  • Dashboard using Next.js App Router
  • Documentation Website

Quick Start

Demo: https://money-shark.vercel.app

Installation

Clone the project:

git clone https://github.com/SonMooSans/discord-bot-template.git

Install dependencies, notice that this project uses pNPM as package manager:

pnpm i

Commands

This project is a monorepo, You can run the project in development mode:

pnpm run dev

Create Production Build:

pnpm run build

Discord OAuth

Add https://<app_url>/api/auth/callback as a Redirect Uri in Developer Portal.

Environment Variables

Required variables are listed in .env.example.

This project uses Upstash Kafka, you can register an account and get required credentials there.

Notice that you need to update Prisma schema as your database change.

Database

This project uses Prisma ORM, you may migrate to other ORMs such as Drizzle ORM if you wanted.

Push database changes:

pnpm run db:push

Please make sure all environment variables are all settled before running the command.

Learn More about Prisma ORM from their documentation.

Project Structure

This project is using Turborepo, you can learn more about it from their documentation.

Package Description
apps/web Web App + Documentation (Frontend)
apps/bot Discord Bot
packages/docs Documentation (Content + Utils)
packages/ui Components & Utils
packages/config Configuration Files

Learn more about these packages by reading their README.md file

Security

It'll checks for user permissions before doing any operations.

You can enable permission checking in a Server Action or Route Handler by doing:

import { checkPermissions } from "@/utils/actions/permissions";

export async function myAction() {
    "use server";

    //notice that it is an async function
    await checkPermissions();
}

Scalability

Don't depend on "Server"

We use Kafka for handling real operations via dashboard, so that no requests will be sent to the server that hosts the discord bot directly.

This brings a faster load speed and more better stability because the dashboad will still works even if the discord bot is temporarily unavailable.

Serverless Ready

The dashboard is built for serverless, you are able to deploy it to any serverless hosting platforms such as Vercel, Azure and AWS.

Notice that the Discord bot server can only be deployed to traditional Node.js Server hosting services, serverless environment is incompatible.

Typesafe

Typesafe is the key to maintain a large codebase. Although Javascript + JSDocs is perfect for libraries, it's still recommended to use Typescript for writing applications.

This template is fully written in Typescript, all the type errors will be reported at build time.

Deploy

It is easy to deploy this application.

Web App

The fastest way to deploy Next.js applications is to use Vercel.

Bot Server

Any hosting platform that supports Node.js, such as AWS, Render, Railway.

About

Best Discord Bot template with Dashboard and Documentation

https://money-shark.vercel.app

License:MIT License


Languages

Language:TypeScript 93.3%Language:CSS 3.8%Language:JavaScript 2.9%