> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/koja-lib/getting-started/installation.md).

# Installation

## Requirements

| Dependency              | Required | Notes                              |
| ----------------------- | -------- | ---------------------------------- |
| `oxmysql`               | Yes      | Database driver                    |
| `es_extended`           | No       | Required only for ESX framework    |
| `qb-core` or `qbx_core` | No       | Required only for QBCore framework |
| `ox_inventory`          | No       | Optional — auto-detected           |

## Setup

{% stepper %}
{% step %}

## Place the `koja-lib` folder inside your resources directory

```
resources/
  [dev]/
    koja-lib/
```

{% endstep %}

{% step %}

## Add to your `server.cfg` before any script that depends on it

```
ensure koja-lib
```

{% hint style="info" %}
koja-lib must start before any resource that uses it.
{% endhint %}
{% endstep %}

{% step %}

## Open `editable/shared/config.lua` and configure the options for your server

See [Configuration](broken://pages/14fe29f7ebe65781d0a41d785bd639d17bd17c1f).
{% endstep %}
{% endstepper %}

## Accessing the API

{% tabs %}
{% tab title="In a client script" %}

```lua
local KOJA = exports['koja-lib']:getSharedObject()

-- or via event
TriggerEvent('koja:getSharedObject', function(obj)
    KOJA = obj
end)
```

{% endtab %}

{% tab title="In a server script" %}

```lua
local KOJA = exports['koja-lib']:getSharedObject()

-- or via event
TriggerEvent('koja:getSharedObject', function(obj)
    KOJA = obj
end)
```

{% endtab %}
{% endtabs %}

> The shared object exposes `KOJA.Client` on the client and `KOJA.Server` on the server, along with `KOJA.Framework`, `KOJA.Inventory`, and `KOJA.Misc`.

## File Structure

```
koja-lib/
  editable/
    shared/
      config.lua        ← Main configuration
      utils.lua         ← Framework detection
      inventory.lua     ← Inventory detection
    custom/
      framework_client.lua  ← Custom framework stubs (client)
      framework_server.lua  ← Custom framework stubs (server)
      inventory_client.lua  ← Custom inventory stubs (client)
      inventory_server.lua  ← Custom inventory stubs (server)
  client/
  server/
  web/
```

Only files inside `editable/` are intended to be modified.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kojascripts.eu/koja-lib/getting-started/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
