dsgo

module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: MIT

README

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

  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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL