# INSTALLATION

Welcome to **Koja-Crafting**, a fluent crafting system designed to enhance gameplay on your FiveM server. This guide will walk you through the installation process step by step.

***

## 📋 Requirements

Before installing Koja-Crafting, ensure you have the following dependencies:

* [**koja-lib**](https://github.com/Koja-Scripts/koja-lib/releases) - Required library that must be started **before** koja-crafting
* [**ox-mysql**](https://github.com/communityox/oxmysql/releases) - Database resource

***

## 🚀 Installation

{% stepper %}
{% step %}

### Download and install koja-lib

1. Download [**koja-lib**](https://github.com/Koja-Scripts/koja-lib/releases) from the official repository
2. Place it in your `resources` folder

Add to your `server.cfg`:

{% code title="server.cfg" %}

```cfg
ensure koja-lib
```

{% endcode %}

{% hint style="warning" %}
koja-lib **must** be started before koja-crafting!
{% endhint %}
{% endstep %}

{% step %}

### Install Koja-Crafting

1. Download the **koja-crafting** resource
2. Extract it to your `resources` folder

The folder structure should look like this:

```
resources/
├── koja-lib/
└── koja-crafting/
```

{% endstep %}

{% step %}

### Database setup

You have two options for setting up the database:

#### Option A: Automatic Database Creation (Recommended)

1. Open `shared/config.lua`
2. Ensure this setting is enabled:

{% code title="shared/config.lua" %}

```lua
Config.CreateAutoTable = true
```

{% endcode %}

The script will automatically create all required tables on first start.

#### Option B: Manual SQL Import

1. Open your database management tool (TablePlus, HeidiSQL, etc.)
2. Import the `koja-crafting.sql` file

This will create three tables:

* `koja-crafting` - Stores player progression (level, exp, blueprints)
* `koja-crafting-objects` - Stores placed crafting station objects
* `koja-crafting-queue` - Stores active and completed crafting queues
  {% endstep %}

{% step %}

### Configure server.cfg (order matters)

Add the following to your `server.cfg` in the correct order:

{% code title="server.cfg" %}

```cfg
# Database
ensure oxmysql

# Dependencies
ensure koja-lib

# Crafting System
ensure koja-crafting
```

{% endcode %}

{% hint style="danger" %}
The load order matters! koja-lib must start before koja-crafting.
{% endhint %}
{% endstep %}
{% endstepper %}

***

## 📚 Additional Resources

* **Documentation**: <https://docs.kojascripts.eu>
* **Discord Support**: <https://discord.gg/kojascripts>
* **GitHub**: Check for updates and report issues

✅ **Installation Complete!** Your crafting system is now ready to use. Enjoy enhancing your server's gameplay experience!


---

# Agent Instructions: 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/~/revisions/wtS8RQ73KLBYIwBpyLwg/new/crafting/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.
