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.
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
-
pkg/context
- It is the logical core that contains all the necessary functionalities that are independent of any presentation (application).
-
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.
-
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)
-
System Requirements
-
Start VS Code
code .
-
Open Command Palette
-
Run
Dev Containers: Reopen in Container
Locally
-
System Requirements
-
Run
make init
ZIP
-
System Requirements
-
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
- Contributions and Feedback are always welcome!
License