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

# sure_lib

> Modern Lua utilities for FiveM resources

<Frame>
  <img src="https://mintcdn.com/999s/Tgs9be_01EM6q-GY/images/hero.png?fit=max&auto=format&n=Tgs9be_01EM6q-GY&q=85&s=a8c1701af7d580bebfeee260e90d662b" alt="sure_lib documentation cover" width="1475" height="570" data-path="images/hero.png" />
</Frame>

# sure\_lib

<Badge icon="package" color="white" size="sm">v2.2.1</Badge> <Badge icon="terminal" color="surface" size="sm">Lua 5.4</Badge> <Badge icon="server" color="surface" size="sm">FiveM</Badge>

sure\_lib is a modern-first Lua 5.4 utility library for FiveM resources. It gives resource authors focused modules for validation, event safety, reactive state, config loading, entity spawning, cooldown synchronization, database models, ESX transactions, player shortcuts, and Lua-driven NUI rendering.

<CardGroup cols={2}>
  <Card title="Start with installation" icon="rocket" href="scripts/sure_lib/getting-started.mdx">
    Add the shared loader, confirm dependencies, and load your first module.
  </Card>

  <Card title="Understand modules" icon="boxes" href="scripts/sure_lib/module-loader.mdx">
    Learn how `sure.getModule(...)` resolves shared, client, and server modules.
  </Card>

  <Card title="Validate runtime data" icon="shield-check" href="scripts/sure_lib/validator.mdx">
    Build schemas for events, callbacks, configs, and command payloads.
  </Card>

  <Card title="Reference every API" icon="list-check" href="scripts/sure_lib/api-reference.mdx">
    Scan method signatures, parameters, return values, and runtime availability.
  </Card>

  <Card title="Build Lua UI" icon="panels-top-left" href="scripts/sure_lib/lui.mdx">
    Render bundled NUI pages from Lua node trees, reactive state, and motion components.
  </Card>
</CardGroup>

<Info>
  This documentation is written for the latest `sure_lib` repository state at commit `30b3cfd` and resource version `2.2.1`.
</Info>

## Runtime map

```mermaid theme={"dark"}
flowchart LR
  Loader["sure.getModule(name)"]
  Shared["Shared modules"]
  Client["Client modules"]
  Server["Server modules"]

  Loader --> Shared
  Loader --> Client
  Loader --> Server
  Shared --> Validator["validator"]
  Shared --> Listener["listener"]
  Shared --> Track["track"]
  Shared --> Config["config"]
  Client --> Player["player"]
  Client --> Spawn["spawn"]
  Client --> LUI["lui"]
  Client --> ClientCooldown["cooldown"]
  Server --> ESX["esx"]
  Server --> DB["db"]
  Server --> ServerCooldown["cooldown"]
```

## Recommended path

<Steps>
  <Step title="Install the loader">
    Add `shared_script '@sure_lib/init.lua'` to any resource that consumes sure\_lib.
  </Step>

  <Step title="Load only what you need">
    Call `sure.getModule('validator')`, `sure.getModule('lui')`, `sure.getModule('db')`, or another module from the side where it exists.
  </Step>

  <Step title="Keep boundaries explicit">
    Use shared modules for cross-side logic, client modules for local player/UI work, and server modules for authoritative database, ESX, or cooldown state.
  </Step>
</Steps>
