Skip to main content
Open source · FiveM · Lua 5.4

The ORM that makes SQL disappear.

A lightweight ORM for FiveM. Transform your SQL queries into readable Lua code.

server.lua
local User = OrvexORM.model("users", {
identifier = "string",
money = "number",
position = "json",
}, { primaryKey = "identifier" })

local player = User.find({ identifier = id })
player:update({ money = 1000 })
player:increment("money", 500)

Features

Everything you need to manage your database on FiveM.

CRUD

create, find, update, delete — OrvexORM generates SQL automatically.

Relations

hasOne, hasMany, belongsTo, belongsToMany with attach/detach.

Query Builder

Chainable. WHERE, LIKE, IN, BETWEEN, JOIN, GROUP BY, ORDER BY.

Migrations

Create your tables with sync() or versioned migrations.

Cache

Built-in TTL cache with automatic invalidation on writes.

JSON

JSON columns and auto-detection. Lua tables converted automatically.

MODELS

Define, create, use

One model = one table. SQL is generated automatically.

local User = OrvexORM.model("users", {
identifier = "string",
money = "number",
job = "string",
position = "json",
}, { primaryKey = "identifier" })

User.sync()

local player = User.create({
identifier = "license:abc",
money = 500,
job = "unemployed",
position = { x = 0, y = 0, z = 0 },
})
QUERIES

Chainable query builder

Filters, sorting, pagination, joins, aggregations, relations.

local richCops = User.query()
:where({ job = "police" })
:where("money", ">", 1000)
:orderBy("money", "DESC")
:limit(10)
:get()

local avgMoney = User.avg("money")
local totalCops = User.count({ job = "police" })

User.hasMany("vehicles", Vehicle, {
foreignKey = "owner"
})

local cars = player:get("vehicles")