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

# Flux

> A lightweight, strictly typed networking library for Roblox, built on buffer serialization.

## <Icon icon="book-open" /> About

Flux is a networking library for Roblox. It replaces direct `RemoteEvent`,
`UnreliableRemoteEvent` and `RemoteFunction` usage with a small, strictly typed API.

Rather than creating one remote per message, Flux sends every event through a single
`RemoteEvent` and `UnreliableRemoteEvent` pair. Payloads are packed into a `buffer`,
batched once per frame, and unpacked on the other side, so you write declarative
Luau and never touch a cursor yourself.

<CardGroup cols={2}>
  <Card title="Install Flux" icon="download" href="/installation">
    Drop the module into `ReplicatedStorage` and you're done.
  </Card>

  <Card title="Quickstart" icon="bolt" href="/quickstart">
    A working server and client in under twenty lines.
  </Card>

  <Card title="Guides" icon="book-open" href="/guides/events">
    Events, invocations, schemas, generics and lifecycle.
  </Card>

  <Card title="API Reference" icon="code" href="/api/flux">
    Every function, type and namespace Flux exposes.
  </Card>
</CardGroup>

## <Icon icon="wand-magic-sparkles" /> Features

<CardGroup cols={2}>
  <Card title="Fast" icon="bolt" horizontal>
    Buffer serialization with pooled readers and writers, so steady traffic reuses
    allocations instead of churning them.
  </Card>

  <Card title="Type safe" icon="lock" horizontal>
    Written in `--!strict` Luau. The generic `Server<Args..., Out...>` and
    `Client<Args..., Out...>` types give you real autocomplete on both ends.
  </Card>

  <Card title="Compact" icon="box" horizontal>
    Varint lengths, integer width narrowing, and a two-bit packet header. Adding a
    schema drops the per-value type tags too.
  </Card>

  <Card title="Reliable and unreliable" icon="arrows-rotate" horizontal>
    Every event carries both channels out of the box. There is no second object to
    create; call `Fire` or `FireUnreliable`.
  </Card>

  <Card title="Automatic batching" icon="layer-group" horizontal>
    Sends made within a frame coalesce into one buffer per recipient and flush on
    `Heartbeat`, collapsing dozens of remote calls into one.
  </Card>

  <Card title="Small API" icon="feather" horizontal>
    `Connect`, `Once`, `Wait`, `Fire`, `Invoke`. Declarative syntax that gets out of
    your way.
  </Card>
</CardGroup>

## At a glance

<CodeGroup>
  ```luau Server theme={null}
  local Flux = require(ReplicatedStorage.Flux)

  local Chat = Flux.Server("Chat")

  Chat:Connect(function(player, message)
  	print(player.Name, "said:", message)
  	Chat:FireAll(player.Name .. ": " .. message)
  end)
  ```

  ```luau Client theme={null}
  local Flux = require(ReplicatedStorage.Flux)

  local Chat = Flux.Client("Chat")

  Chat:Connect(function(line)
  	print(line)
  end)

  Chat:Fire("Hello from the client!")
  ```
</CodeGroup>

## <Icon icon="handshake" /> Contributing and Feedback

Flux is actively developed, and help is welcome in three areas.

<AccordionGroup>
  <Accordion title="Testing" icon="flask">
    The dynamic encoder has a lot of branches, and the batching layer has timing
    behaviour that is easy to get subtly wrong. Coverage for the edge cases is the
    most valuable contribution: deeply nested tables, mixed array and dictionary
    shapes, players leaving mid-flush, invoke timeouts.
  </Accordion>

  <Accordion title="Improvements" icon="gauge-high">
    Suggestions or PRs that improve throughput, shrink packets, or make the API
    harder to misuse. The [Limits](/reference/limits) page lists the rough edges that
    are known and unclaimed.
  </Accordion>

  <Accordion title="Bug fixes" icon="bug">
    Identifying and fixing issues as they surface. A minimal reproduction in a place
    file is worth far more than a description.
  </Accordion>
</AccordionGroup>

<Tip>
  New to the codebase? [Architecture](/concepts/architecture) walks through all seven
  modules and follows a single `Fire` from the call site to the callback.
</Tip>
