FlatBuffers serializes structured data so programs can read fields directly from a buffer without unpacking into separate objects. It targets games and other performance-sensitive apps and supports many languages.
Overview
FlatBuffers is a serialization library built for low memory overhead and direct access to encoded data. You define a schema, generate language-specific code with the flatc compiler, build a buffer with the generated APIs, and later read values through accessors without an extra parse step.
The design emphasizes forward and backward compatibility across schema changes and across languages, so a buffer produced in one language can be read in another. Serialized data can be stored, sent over a network, or mmap’d while readers touch only the buffer memory they need.
Workflow centers on schema files, the flatc code generator, and per-language runtime libraries. Bindings and runtimes exist for C++, C, C#, Go, Java, Kotlin, JavaScript, TypeScript, Python, Rust, Swift, and several other languages listed in the project docs.
Compared with Protocol Buffers, the project notes that FlatBuffers skips unpacking into heap objects before access, tends toward smaller generated code, and differs in versioning style. JSON remains optional as a human-readable text format but suits dynamic languages more than static ones for large structured payloads.
Key features
- Direct access without parsing entire message
- Schema-driven code generation via flatc
- Cross-language and schema-version compatibility
- Optional JSON text format
- Minimal runtime dependencies
- Windows, macOS, Linux, and Android support
Use cases
- Game and real-time client data exchange
- Compact RPC or file formats
- mmap-friendly on-disk structures
- Multi-language service payloads