# 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

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

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


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

```
ensure koja-lib
```

:::hint{type="info"}
koja-lib must start before any resource that uses it.
:::


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

See [Configuration](/koja-lib/getting-started/configuration).
::::

## Accessing the API

**In a client script**

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

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


**In a server script**

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

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

> 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.

## Related pages

- [Configuration](/koja-lib/getting-started/configuration) — All configuration lives in editable/shared/config.lua.
- [Getting Started](/koja-lib/getting-started) — back to the section overview
