Redix LogoDocumentation

Installation

Prerequisites

Before installing Redix, make sure you have:

  • A working FiveM or RedM server
  • Docker installed (see instructions below)
  • Access to the server.cfg file
  • Access to the server resources folder

Installing Docker

Docker is required to run Redis Stack Server. Choose the installation method that best suits your needs:

Docker Desktop provides a graphical interface and is easier to manage:

Docker Desktop

Docker Desktop includes Docker Engine, Docker CLI, Docker Compose, and a graphical interface to manage containers easily.

Docker Engine (CLI only)

For servers or if you prefer the command line:

  • Ubuntu:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
  • Debian:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
  • CentOS/RHEL:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh

For other distributions, visit the official Docker Engine installation guide.

Verify Docker Installation

After installation, verify that Docker is working correctly:

docker --version
docker run hello-world

You should see the Docker version and a "Hello from Docker!" message.

Docker Installation

If you're new to Docker, we recommend starting with Docker Desktop for a better experience. For production servers, Docker Engine is lighter and more suitable.

Installation Guide

Install Redis Server

Redix requires Redis with JSON module support. You can choose between:

  • Redis Stack Server: Includes RedisJSON modules without the dashboard. Recommended for most use cases - lighter and production-ready.
  • Redis Stack: Complete version with RedisJSON modules + Redis Insight dashboard (on port 8001). Heavier but useful for development and debugging.
  • Redis standard: Lightest but lacks JSON modules. Only suitable if you don't use JSON operations.

Option A: Installation with Docker

Docker is the simplest and most reliable method. This is the recommended version - includes JSON support without the dashboard overhead.

docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest

This version includes all necessary modules (RedisJSON) without the web interface, making it lighter and suitable for production.

Option A2: Redis Stack (with dashboard)

If you want the Redis Insight web dashboard for development:

docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest

Redis Insight Dashboard

This version includes Redis Insight on port 8001, a web interface to view and manage Redis data in real-time. Access it via http://localhost:8001.

Only if you don't need JSON operations:

docker run -d --name redis -p 6379:6379 redis:latest

⚠️ This version does not support JSONSet, JSONGet and similar operations.

Docker Compose

For Redis Stack Server (recommended):

version: "3.8"

services:
  redis-stack-server:
    image: redis/redis-stack-server:latest
    container_name: redis-stack-server
    ports:
      - "6379:6379"
    environment:
      - REDIS_ARGS=--requirepass yourSecurePassword
    volumes:
      - redis-data:/data
    restart: unless-stopped

volumes:
  redis-data:

Then start with:

docker-compose up -d

Choosing the Right Version

  • Redis Stack Server (recommended): Includes JSON modules, lightweight, production-ready
  • Redis Stack: Same as Server + web dashboard for debugging (heavier)
  • Standard Redis: No JSON support, only use if you avoid all JSON operations

Verify Redis Installation

Before proceeding, verify that Redis is running:

# Test the connection
docker exec -it redis-stack-server redis-cli ping

You should receive the response: PONG

To verify that RedisJSON is available:

docker exec -it redis-stack-server redis-cli
127.0.0.1:6379> JSON.SET test $ '{"hello":"world"}'
127.0.0.1:6379> JSON.GET test

You should see: "{\"hello\":\"world\"}"

Download and Install Redix

Method 1: Download Release

  1. Go to the Redix GitHub releases page
  2. Download the latest version
  3. Extract the contents to your server resources folder
  4. You should have the structure: resources/redix/fxmanifest.lua

Method 2: Build from Source

If you prefer to compile from source:

# Clone the repository
git clone https://github.com/CrystalTwoK/redix.git
cd redix

# Install dependencies
npm install

# Build
npm run build

# The result will be in dist/redix/
# Copy this folder to your resources folder

Configure server.cfg

Add the following lines to your server.cfg file:

Basic Configuration

# Redis Connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:db "0"

# Start Redix
ensure redix

Configuration with Password

If you set a password for Redis:

set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "yourSecurePassword"
set redix:db "0"

ensure redix

Complete Configuration

# Connection
set redix:host "127.0.0.1"
set redix:port "6379"
set redix:password "yourSecurePassword"
set redix:db "0"

# Advanced Options
set redix:username ""
set redix:family "4"
set redix:connectTimeout "10000"
set redix:keepAlive "30000"
set redix:lazyConnect "false"
set redix:retryEnabled "true"
set redix:maxRetries "3"

# Logging
set redix:logging "true"
set redix:logErrors "true"
set redix:logConnections "true"

# Localization
set redix:locale "en"

# Testing
set redix:testOnStartup "false"

# Start Redix
ensure redix

Startup Order

Ensure that ensure redix is present before the resources that use it in your server.cfg

Verify Installation

Start your FiveM or RedM server and check the console. You should see:

...
[Redix]            @@@@@@@@@@@@@@@                                   @@@@@
[Redix]         @@@@@@   @@@@@ @@@@                          @@@@@@  @@@@
[Redix]        @@@@@   @@@@@@  @@@@@                       @@@@@@    @@@             @
[Redix]        @@@    @@@@@@  @@@@@      @@@@@       @@@@@@@@@@    @@@@@   @@@@@   @@@
[Redix]              @@@@@@  @@@@@@   @@@@@ @@@@  @@@@@ @@@@@@   @@@@@@   @@@@@@ @@@
[Redix]             @@@@@@  @@@@@    @@@@@ @@@@ @@@@@@ @@@@@@   @@@@@@   @@@@@@@@@@
[Redix]             @@@@@  @@@@     @@@@@ @@@@  @@@@@  @@@@@   @@@@@@   @@@@@@@@@
[Redix]            @@@@@@@@@       @@@@@@@@@  @@@@@@  @@@@@   @@@@@    @@@ @@@@@    @@
[Redix]           @@@@@ @@@@@     @@@@@       @@@@@  @@@@@   @@@@@@    @@  @@@@@   @@
[Redix]           @@@@@  @@@@@    @@@@@      @@@@@  @@@@@@  @@@@@@   @@  @@@@@@@  @@
[Redix]           @@@@   @@@@@@@  @@@@@    @@ @@@@@@@@@@@@@@@@@@@@ @@@ @@@ @@@@@@@@
[Redix]           @@@@    @@@@@@@@ @@@@@@@@    @@@@   @@@@@   @@@@@@  @@@   @@@@@
[Redix]                    @@@@@@@                                                   vX.X.X
[Redix]
[Redix]   Redis Wrapper for FiveM/RedM
...

Manual Test

You can test the connection with the server console command:

-- In your resource server.lua file
local Redix = exports.redix:GetInterface()

-- Connection test
exports.redix:TestConnection()

Or enable automatic tests on startup:

set redix:testOnStartup "true"

This will run a complete test suite on server startup, verifying all operations.

First Use

Now you are ready to use Redix! In any server-side resource:

local Redix = exports.redix:GetInterface()

-- Save data
Redix.Save('test:key', {message = 'Redix works!'})

-- Retrieve data
Redix.Get('test:key', function(err, data)
    if not err and data then
        print('Message:', data.message)
    end
end)

Troubleshooting

Redis Does Not Connect

Error: Failed to connect to Redis

Solutions:

  • Verify that the Docker container is running: docker ps
  • Check that the host and port are correct in server.cfg
  • If Redis is on a remote server, check firewall rules
  • Verify that the password is correct if one is set

JSON Modules Not Available

Error: ERR unknown command 'JSON.SET'

Solution: You are using standard Redis instead of Redis Stack Server. You must use the redis/redis-stack-server:latest or redis/redis-stack:latest image instead of redis:latest.

Redix Does Not Start

Problem: No startup message in console

Solutions:

  • Verify that the resource path is correct
  • Check that fxmanifest.lua is present in the redix folder
  • Ensure that ensure redix is in server.cfg
  • Check server logs for errors

Performance Issues

If you notice latency:

  • Verify that Redis is local or on a fast network
  • Increase connectTimeout if the network is slow
  • Reduce keepAlive for more frequent connections

Production Configuration

For a production server, consider:

1. Data Persistence

Configure Redis to save data to disk:

docker run -d \
  --name redis-stack-server \
  -p 6379:6379 \
  -v redis-data:/data \
  redis/redis-stack-server:latest \
  redis-server --save 60 1 --appendonly yes

2. Strong Password

Always set a strong password in production:

docker run -d \
  --name redis-stack-server \
  -p 6379:6379 \
  redis/redis-stack-server:latest \
  redis-server --requirepass "ComplexPassword123!"

3. Network Limitations

If possible, expose Redis only on localhost and not on the internet:

docker run -d \
  --name redis-stack-server \
  -p 127.0.0.1:6379:6379 \
  redis/redis-stack-server:latest

4. Automatic Backups

Configure periodic backups of Redis data:

docker run -d \
  --name redis-stack-server \
  -p 6379:6379 \
  -v redis-data:/data \
  -v /path/to/backup:/backup \
  redis/redis-stack-server:latest

Completed!

You have now successfully installed and configured Redis Stack Server and Redix! You are ready to start developing.

Next Steps