Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

google/flatbuffers

Data

A cross-platform zero-copy serialization library with schema compiler and runtimes for many languages.

26,615
3,721
C++
Apache-2.0
12 years old

What it does

FlatBuffers stores structured data in a compact buffer that can be read directly, without an unpacking or parsing step. Generated accessors resolve fields at their offsets, which suits latency-sensitive and memory-constrained workloads such as game assets, mobile apps, and inter-process or RPC payloads. A schema (.fbs) defines the data, and the flatc compiler generates typed code for each target language. Cross-language and schema-version compatibility are part of the design goal.

Quick start

Build the compiler from a checkout, then generate code from a schema. The README's Linux example:

cmake -G "Unix Makefiles"
make -j
./flatc --cpp --rust monster.fbs

This produces monster_generated.h and monster_generated.rs. Use the generated types with a FlatBufferBuilder to construct a buffer, then transmit or store it. Reading uses the generated accessors and does not require the same language or schema version that wrote the data; the writing schema guide and the monster.fbs sample are starting points, with C++ and Rust read/write samples in the repository.

Runtime and platform support

Generated runtimes are available for C, C++, C#, Dart, Go, Java, JavaScript, Kotlin, Lobster, Lua, PHP, Python, Rust, Swift, TypeScript, and Nim, with packages on the usual registries such as PyPI, crates.io, npm, NuGet, and Maven. Supported hosts include Windows, macOS, Linux, and Android, plus any platform with a C++11-or-newer compiler. Official documentation lives on the project site.

Versioning and licensing

Releases are dated rather than following SemVer, so version numbers encode a release date; the maintainers explain the reasoning in the versioning rationale. Code is under Apache-2.0, and vulnerability reporting follows the security policy.

HotRepo's take

The library has a long history: it was created in 2014 and one early Hacker News thread framed it as a Cap'n Proto alternative, drawing 83 points and 31 comments on 2014-10-25 (discussion). In that thread, a commenter weighing the two libraries cited FlatBuffers' simpler codebase as a practical advantage and noted the absence of Windows/CMake support in the alternative (comment). A separate point of contention was whether the library reported usage to Google; a later reply in the same thread corrected the impression, describing it as a version string in the binary that the Play Store scanner reads rather than a call-home feature (comment, reply). The most recent HotRepo snapshot, on 2026-11-06, shows 26,613 stars and 3,722 forks with a gain of one star in the C++ daily list, ranking 7th that day. As with any serialization choice, the tradeoff is schema-driven code generation versus the flexibility of self-describing formats.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

Flatbuffers by Google – CapnProto alternative
▲ 83 · 31 comments · October 25, 2014
Google/flatbuffers – efficient serialization library
▲ 2 · 0 comments · July 12, 2014
Google FlatBuffers
▲ 1 · 0 comments · July 2, 2014