Skip to content

bastean/dsgo

Repository files navigation

logo readme

Example of interoperability between a Web App and a Discord Bot using a layered architecture.

Important

  • dsGO is still in the early stages of development.

license MIT go report card commitizen friendly release it

upgrade workflow ci workflow release workflow

go reference github release

Showcase

CLI

Installation

go install github.com/bastean/dsgo/cmd/dsgo@latest

Usage

Note

  • We can follow this guide "Building your first Discord app" to create a new app in case we do not have one already created.
  • SQLite will be used as the default database instead of MySQL.
dsgo -h
Usage: dsgo [OPTIONS]

Example of interoperability between a Web App and a Discord Bot using a layered architecture.

  -app string
        Discord App Id Token (required)
  -database string
        SQLite database file path (default "In-Memory")
  -guild string
        Discord Test Guild Id (optional)
  -port string
        Fiber Server Port (optional)
  -token string
        Discord Bot Token (required)

Docker (Demo)

Usage

Note

  • System Requirements
  • We must define our own Discord configuration in the file .env.demo by modifying the variables DSGO_BOT_DISCORD_*.
    • The required values are DSGO_BOT_DISCORD_APP_ID and DSGO_BOT_DISCORD_APP_TOKEN, the other values are optional.
    • We can follow this guide "Building your first Discord app" to create a new app in case we do not have one already created.
  • MySQL will be used as the default database, SQLite will only be used in case there is a connection problem with MySQL.
make demo

Workflow

Functionality

It is a simple monolith where CRUD operations are performed from the Web App and the Discord Bot to the same database, this allows us to manage users from different applications (presentations).

Folders

  1. pkg/context

    • It is the logical core that contains all the necessary functionalities that are independent of any presentation (application).
  2. internal/pkg/service

    • It is responsible for initializing all “context” functionalities so that they are ready for use, as well as for “mapping” certain values to centralize all imports of presentations (applications) in a single place.
  3. internal/app/(bot|server)

    • These applications will be used as “presentations” in order to serve the functionalities to an end user.

First Steps

Clone

HTTPS

git clone https://github.com/bastean/dsgo.git && cd dsgo

SSH

git clone git@github.com:bastean/dsgo.git && cd dsgo

Initialize

Dev Container (recommended)

  1. System Requirements

  2. Start VS Code

    code .
  3. Open Command Palette

    • Ctrl+Shift+P
  4. Run

    Dev Containers: Reopen in Container

Locally

  1. System Requirements

  2. Run

    make init

ZIP

  1. System Requirements

  2. Run

    make init-zero

Run

ENVs

Important

Before running it, we must initialize the following environment variable files:

  • .env.example
    • We will have to create a .env.(dev|test|prod) for each runtime environment.
    • In the .env.example.demo file, we can see the values that can be used.

In case we only want to run the Integration or Acceptance tests, in addition to having the .env.test file, we must have the following files created:

Development

make compose-dev

Tests

Unit
make test-unit
Integration
make compose-test-integration
Acceptance
make compose-test-acceptance
Unit/Integration/Acceptance
make compose-tests

Production

make compose-prod

Tech Stack

Base

Please see

Contributing

License