> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thunder-studio.net/llms.txt
> Use this file to discover all available pages before exploring further.

# TS-Lib

> A comprehensive, universal utility wrapper and bridge library for FiveM.

## Overview

**TS-Lib** is designed to eliminate the headache of supporting multiple frameworks, inventories, garage systems, and key management scripts. Instead of cluttering your resources with endless `if/else` checks, `ts-lib` handles it all under one unified `TS` namespace.

It is designed to be injected dynamically into any script, keeping your resource code clean, fast, and completely independent.

<CardGroup cols={2}>
  <Card title="Download TS-Lib" icon="download" href="https://store.thunder-studio.net/download/ts-lib">
    Get the latest version of the resource.
  </Card>

  <Card title="Contribute to TS-Lib" icon="hands-holding-circle" href="/scripts/ts-lib/contributing">
    Learn how to propose bridges, fixes and improvements.
  </Card>
</CardGroup>

***

## Features

* **Automated Framework Detection**: Natively supports `qb-core`, `qbx_core`, `es_extended`, and `standalone`. It prioritizes the most modern framework available automatically or via forced config.
* **Unified Bridges**:
  * **Framework**: Native support for `qb-core`, `es_extended`, `qbx_core`, and `standalone`.
  * **Garages**: Native support for `qb-garages`, `esx_garage`, `vms_garagesv2`, `jg-advancedgarages`, and `standalone`.
  * **Keys**: Native support for `qb-vehiclekeys`, `qs-vehiclekeys`, and `standalone`.
  * **Notify**: Native support for framework notifications (QBCore/ESX) with unified API.
* **Centralized Utils**: Prints, debugs, and resource checks are completely centralized (`Utils.Print`, `Utils.DebugPrint`, `Utils.ErrorPrint`, `Utils.SuccessPrint`).
* **Built-in UI helpers**: Simple NUI-based subtitle, text UI, and text input helpers (`TS.Lib.Subtitle`, `TS.Lib.TextUI`, `TS.Lib.TextInput`) that can also be called via exports.
* **Command System**: Built-in command registration with type validation and permission support (`TS.Lib.Command.add`).
* **Update Checker**: Automatic update checking for Thunder Scripts resources (`TS.CheckUpdate`).

***

## Installation

Integrating `ts-lib` into your own scripts is incredibly simple.

1. Place the `ts-lib` folder in your `resources` directory.
2. In the `fxmanifest.lua` of the script that needs to use `ts-lib`, add this single line to your `shared_scripts`:

```lua theme={null}
shared_scripts {
    '@ts-lib/import.lua',
    -- Your other shared scripts...
}
```

That's it! `ts-lib` will automatically boot up, detect the server's framework, fetch the configurations, expose the `TS` namespace, and dynamically load the required modules.

***

## Configuration

You can configure exactly which systems `ts-lib` uses via `ts-lib/config.lua`.

```lua theme={null}
Config = {
    debug = true,

    -- Framework selection: 'auto', 'qbcore', 'esx', 'qbox', 'standalone'
    Framework = 'auto',

    -- Garage system: 'auto', 'qb-garages', 'esx_garage', 'vms_garagesv2', 'jg-advancedgarages', 'standalone'
    Garages = 'auto',

    -- Vehicle keys system: 'auto', 'qb-vehiclekeys', 'qs-vehiclekeys', 'standalone'
    VehicleKeys = 'auto',

    -- Notification system: 'auto', 'qbcore', 'esx'
    Notify = 'auto',

    -- zUI compatibility fix for text input (set to true if using zUI-v2)
    zUIFix = true,

    -- URLs for automatic update checking
    UpdateCheckURL = 'https://raw.githubusercontent.com/thunder-scripts/ts-lib/main/version.json',
    UpdateCheckChangelogURL = 'https://docs.thunder-studio.net/scripts/ts-lib/changelog',

    Data = {
        Framework = {
            qbcore = 'qb-core',
            esx = 'es_extended',
            qbox = 'qbx_core',
            standalone = 'standalone',
        },
        Garages = {
            ['qb-garages']        = 'qb-garages',
            ['esx_garage']        = 'esx_garage',
            ['vms_garagesv2']     = 'vms_garagesv2',
            ['jg-advancedgarages']= 'jg-advancedgarages',
            ['standalone']        = 'standalone',
        },
        VehicleKeys = {
            ['qb-vehiclekeys'] = 'qb-vehiclekeys',
            ['qs-vehiclekeys'] = 'qs-vehiclekeys',
            ['standalone']     = 'standalone',
        },
        Notify = {
            qbcore = 'qb-core',
            esx = 'esx_notify',
        },
    },
}
```

***

## API Reference

For a detailed, function-by-function description of the TS-Lib surface and its bridges, see the dedicated [API Reference](/scripts/ts-lib/api-reference) page.
