Skip to content

Database

shr0x edited this page Mar 25, 2026 · 1 revision

Database

This page explains how to install, configure, and connect to the PostgreSQL database used by the project.


Overview

The project uses PostgreSQL together with TypeORM for data persistence.

The database stores:

  • Accounts
  • Characters
  • Inventory data
  • Other server-side entities

โš ๏ธ Important Notes

  • The database must be created manually
  • PostgreSQL must be running before starting the server
  • Incorrect credentials will prevent the server from starting

๐Ÿ“ฆ Installing PostgreSQL

Step 1 โ€” Download PostgreSQL

Download PostgreSQL from the official website:

https://www.postgresql.org/download/

Choose your operating system and install it.


Step 2 โ€” Installation Setup

During installation:

  • Set a password for the postgres user (IMPORTANT โ€” remember this)
  • Keep default port: 5432
  • Install all default components

Step 3 โ€” Verify Installation

After installation, PostgreSQL should be running as a service.


๐Ÿงฑ Creating the Database (Manual Step)

You must create the database yourself.

You can do this using either:

  • pgAdmin (comes with PostgreSQL)
  • or a GUI like HeidiSQL (recommended)

๐Ÿงฐ Using HeidiSQL (Recommended)

HeidiSQL is a lightweight database client that supports PostgreSQL.

Step 1 โ€” Download HeidiSQL

https://www.heidisql.com/download.php


Step 2 โ€” Create a New Session

Open HeidiSQL and create a new session with the following settings:

  • Network type: PostgreSQL (TCP/IP)
  • Hostname / IP: 127.0.0.1
  • Port: 5432
  • User: postgres
  • Password: (the one you set during installation)

Step 3 โ€” Connect

Click Open to connect to PostgreSQL.


Step 4 โ€” Create Database

Right click on the server โ†’ Create new โ†’ Database

Example name: ragemp_rp


โš™๏ธ Environment Configuration

Configure your .env file in the server project.

Example:

DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=your_password_here
DB_DATABASE=ragemp_rp

๐Ÿ”Œ How Connection Works

On server startup:

  • TypeORM reads your .env configuration
  • Establishes a connection to PostgreSQL
  • Loads all entities
  • Initializes repositories/services

If the connection fails:

  • The server will not start correctly
  • Errors will appear in the console

โ— Common Issues

Connection refused

  • PostgreSQL is not running

Authentication failed

  • Wrong username or password

Database does not exist

  • You forgot to create it manually

Wrong port

  • Default PostgreSQL port is 5432

โœ… Final Checklist

Before starting the server, make sure:

  • PostgreSQL is installed
  • PostgreSQL service is running
  • Database is created manually
  • .env credentials are correct
  • You can connect using HeidiSQL

๐Ÿง  Recommendation

Using a database GUI like HeidiSQL is highly recommended for:

  • viewing data
  • debugging issues
  • editing records
  • understanding how your data is structured

๐Ÿš€ Getting Started

๐Ÿง  Architecture

๐ŸŽฎ Features

๐Ÿ›  Development

โ— Help

Clone this wiki locally