Installation

Fetch the code and install DaSCR-Board

Fetch the code

Navigate to a folder where you want the app to reside in and clone it’s repository using git (or unzip the master.zip downloaded from GitHub Repo there):

git clone https://github.com/dascr/dascr-board
cd dascr-board

Content of the root directory

As this is a monorepo where the backend and the frontend reside, it might be a bit confusing at first. But fear not as I will describe how that works now.

.
├── api
├── config
├── database
├── docker-compose.yml
├── Dockerfile
├── frontend <--- Frontend App (SvelteKit)
├── game
├── go.mod
├── go.sum
├── LICENSE
├── logger
├── main.go
├── Makefile
├── player
├── podium
├── README.md
├── score
├── settings
├── throw
├── undo
├── uploads
├── utils
└── ws

Everything except the frontend folder is the backend app. The frontend Svelte app resides in the frontend folder. It is that easy.

Content of frontend folder for reference:

.
├── caddy
├── Dockerfile
├── jsconfig.json
├── node_modules
├── package.json
├── postcss.config.cjs
├── src
├── static
├── svelte.config.js
└── tailwind.config.cjs

DaSCR is using “.env”

What does that mean? There are different variables which are not read from a config file, but which are read from the environment. So you could for example do this:

export API_IP=0.0.0.0

This would set the variable API_IP used by the backend for this very session of your terminal. To ease the pain I am using .env files with my Makefile. Consider this as a kind of a config file itself.

So to use the Makefile you will need to create two files.

Backend

In the root folder of the project create a fille called .env. The content of it is:

API_IP=0.0.0.0
API_PORT=8000
DEBUG=FALSE

Here is the explanation of the content:

  • API_IP: This one will determine to which ip address the backend server is bound to. 0.0.0.0 means to any interface address. It could also read something like 192.168.1.X to bound it to a local network address.
  • API_PORT: This one will determine to which port the backend server is bound to.
  • DEBUG: This one will control how much output the application is giving you. Most of the time the value FALSE is good enough. But if you want to develop this you might want to choose TRUE instead.

Frontend

In the frontend folder also create a file called .env. The content of it is:

VITE_API_URL=http://localhost:8000/api
VITE_API_BASE=http://localhost:8000/
VITE_WS_URL=ws://localhost:8000/ws

This example reflects hosting it on a system in host only mode. You will not be able to use it other than on the system itself this way.

Here is the explanation of the content:

  • API_URL: This one points to the api endpoint of the backend which is protocol://ip address:port/api
  • API_BASE: This one points to the base address and has to match everything above but leaving out /api
  • WS_URL: This one points to the websocket endpoint of the backend. Instead of api it should read ws

Checked out code and created .env * 2?

Continue with building either one of those: