Server & Database Setup - bym-refitted/backyard-monsters-refitted GitHub Wiki

πŸŽ₯ Tutorial

Watch the tutorial



πŸ”§ Prerequisites

Before proceeding with the setup, please ensure the following tools are installed:

Tool Download Link Notes
Git git-scm.com/downloads Required for cloning the repository and version control
PostgreSQL postgresql.org/download Database server
pgAdmin Usually bundled with PostgreSQL Optional but recommended database management tool
Redis redis-windows releases Choose the cygwin.zip version (not the service)
Node.js nodejs.org LTS version recommended
Beekeeper Studio beekeeperstudio.io Optional database management tool



πŸ—„οΈ Database Setup

We have adopted PostgreSQL with MikroORM due to its advanced transaction handling, JSONB support, and strong consistency guaranteesβ€”making it ideal for scalable, high-performance applications.

βœ… Steps to Set Up PostgreSQL

  1. Download PostgreSQL
    Install it here. We recommend allowing the installer to include pgAdmin (it should by default).

  2. Set the Password
    During installation, set the password for the postgres user to dev12345 β€” this matches the default in our .env file. If you choose a different password, be sure to update .env.

  3. Create the Database
    Open pgAdmin, expand Servers, and create a new database called bym.



⚑ Redis Setup

We use Redis to store user tokens, providing fast and efficient in-memory read/writes.

βœ… Steps to Set Up Redis (Windows)

  • Download Redis for Windows

    Choose the cygwin.zip version (not the service).

  • Extract the ZIP to a folder (e.g., Desktop).

  • Run redis-server.exe to launch Redis.

Redis

🌐 Server Setup

Our backend is a Node.js web server using Koa with TypeScript.

βœ… Getting Started

  1. Open your terminal and navigate to the server directory:

    cd server
  2. Install dependencies:

    npm install
  3. Initialize the database tables:

    npm run db:init
  4. Compile and run the server:

    npm run db:init

If successful, the admin dashboard will be available at http://localhost:3001/

Configuration can be modified via the .env file.



🐝 Beekeeper Studio

For managing your database, we recommend using Beekeeper Studio.

βœ… Connect to PostgreSQL

  1. Open Beekeeper β†’ New Connection β†’ Select PostgreSQL
  2. Use the following details:
Connection Type:      PostgreSQL
Connection Mode:      Host & Port
Host:                 localhost
Port:                 5432
User:                 postgres
Password:             dev12345 (or your custom one)
Default Database:     bym
  1. Give it a name and connect.

Once Connected

  • Your tables will appear on the left panel.
  • Right-click a table β†’ View Data.
  • If you haven't run the game yet, tables will be empty.
  • After starting the server and running the game, refresh to view populated data.
⚠️ **GitHub.com Fallback** ⚠️