Repository navigation
Database
This page explains how to install, configure, and connect to the PostgreSQL database used by the project.
The project uses PostgreSQL together with TypeORM for data persistence.
The database stores:
- Accounts
- Characters
- Inventory data
- Other server-side entities
- The database must be created manually
- PostgreSQL must be running before starting the server
- Incorrect credentials will prevent the server from starting
Download PostgreSQL from the official website:
https://www.postgresql.org/download/
Choose your operating system and install it.
During installation:
- Set a password for the
postgresuser (IMPORTANT โ remember this) - Keep default port:
5432 - Install all default components
After installation, PostgreSQL should be running as a service.
You must create the database yourself.
You can do this using either:
- pgAdmin (comes with PostgreSQL)
- or a GUI like HeidiSQL (recommended)
HeidiSQL is a lightweight database client that supports PostgreSQL.
https://www.heidisql.com/download.php
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)
Click Open to connect to PostgreSQL.
Right click on the server โ Create new โ Database
Example name: ragemp_rp
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_rpOn server startup:
- TypeORM reads your
.envconfiguration - 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
- PostgreSQL is not running
- Wrong username or password
- You forgot to create it manually
- Default PostgreSQL port is
5432
Before starting the server, make sure:
- PostgreSQL is installed
- PostgreSQL service is running
- Database is created manually
-
.envcredentials are correct - You can connect using HeidiSQL
Using a database GUI like HeidiSQL is highly recommended for:
- viewing data
- debugging issues
- editing records
- understanding how your data is structured