Git Product home page Git Product logo

discordvoicevoxdashboardback's Introduction

Go to Frontend

Discord Bot Dashboard Backend Demo

Tech Stack

  • Database (Prisma)
  • Nest.js with Typescript
  • Discord.js
  • PnPM (Package Manager)

Install Dependencies

Make sure you're using pnpm, in order to load the lock file

pnpm install

Environment variables

You need some Environment variables in order to run it

Database url

It is used for Prisma, I am using PostgreSQL but you may use any supported databases as well

DATABASE_URL="postgresql://postgres:password@localhost:5432/my-db?schema=public"

Discord Bot Token

The bot token is also required

BOT_TOKEN="YOUR_TOKEN"

Web URL

The WEB_URL is the default origin of the CORS configuration

WEB_URL="https://my-bot.vercel.app"

We will use localhost:3000 in default

Create Prisma Migrate baseline

You need to create a migration baseline before deploying your app

  1. Reset Development database

    prisma migrate dev
    
  2. Production database

    prisma migrate resolve --applied 20230305142521_initial
    

Learn More

Deploy

We recommend using https://railway.app to deploy your backend

You are able to host both your database and node.js server on Railway


File Structure

Path Description
./src/bot The Discord bot
./src/api The API service
./src/api/controllers API controllers
./src/api/services 3rd party services

Add a Feature

Create new routes in the guild controller

Learn More

@Get('/features/welcome-message')
async getWelcomeMessage(@Param('guild') guild: string) {
   //Database calls

  return {
    message: 'message',
    channel: '1111',
  };
}

@Post('/features/welcome-message')
async enableWelcomeMessage(@Req() req: AuthRequest, @Param('guild') guild: string) {
   //Enables the feature

   return 'Success';
}

@Patch('/features/welcome-message')
async updateWelcomeMessage(
  @Req() req: AuthRequest,
  @Param('guild') guild: string,
  @Body() body: Partial<WelcomeMessage>,
) {
   //Update the feature

   return updated;
}

@Delete('/features/welcome-message')
async disableWelcomeMessage(@Param('guild') guild: string, @Req() req: AuthRequest) {
   //Disables the feature

   return 'Success';
}

discordvoicevoxdashboardback's People

Contributors

lenlino avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.