# objectbox/objectbox-c architecture

> Architecture diagram of the GitHub repository objectbox/objectbox-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/objectbox/objectbox-c
- Repository: https://github.com/objectbox/objectbox-c

## Overview

This repository provides the public C and C++ interfaces for ObjectBox’s embedded, offline-first object and vector database; the core runtime implementation is supplied as a prebuilt library rather than appearing in this tree. The principal workflow is to define a model, open a store, then put, query, and read FlatBuffers-backed objects. The headers also expose relations, asynchronous operations, tree data, and optional Sync capabilities. The graph represents documented API responsibilities and the README’s major capabilities; it does not infer internal core wiring beyond the documented interface boundary.

Main entry points: [`include/objectbox.h`](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h) (C API), [`include/objectbox.hpp`](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.hpp) (C++ API), [`external/flatbuffers/flatbuffers.h`](https://github.com/objectbox/objectbox-c/blob/main/external/flatbuffers/flatbuffers.h) (FlatBuffers Support), [`external/flatcc/flatcc_builder.h`](https://github.com/objectbox/objectbox-c/blob/main/external/flatcc/flatcc_builder.h) (C Buffer Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Application APIs"]
  node_cpp["C++ API<br/>[objectbox.hpp]"]
  node_capi["C API<br/>[objectbox.h]"]
end

subgraph group_persistence["Persistence"]
  node_model["Model Definition<br/>[objectbox.h]"]
  node_store["Store and Transactions<br/>[objectbox.h]"]
  node_objects["Object CRUD<br/>[objectbox.hpp]"]
  node_queries["Queries and Indexes<br/>[objectbox.h]"]
  node_relations["Object Relations<br/>[objectbox.h]"]
  node_vectors["Vector Search<br/>[objectbox.h]"]
  node_migration["Schema Migration<br/>[objectbox.h]"]
  node_async["Async Operations<br/>[objectbox.h]"]
  node_tree["Tree Data<br/>[objectbox.h]"]
  node_core["ObjectBox Runtime"]
  node_database[("Embedded Database")]
end

subgraph group_formats["Data Formats"]
  node_flatbuffers["FlatBuffers Support<br/>[flatbuffers.h]"]
  node_flatcc["C Buffer Builder<br/>[flatcc_builder.h]"]
end

subgraph group_sync["Synchronization"]
  node_syncapi["Sync API<br/>[objectbox-sync.h]"]
  node_syncservice["Sync Backend"]
end

node_app(("C/C++ Application"))

node_app -->|"uses"| node_cpp
node_app -->|"uses"| node_capi
node_cpp -->|"wraps"| node_capi
node_capi -->|"defines schema"| node_model
node_capi -->|"opens store"| node_store
node_cpp -->|"operates on"| node_objects
node_objects -->|"calls"| node_capi
node_capi -->|"executes"| node_queries
node_capi -->|"accesses"| node_relations
node_capi -->|"searches"| node_vectors
node_capi -->|"supports"| node_migration
node_capi -->|"dispatches"| node_async
node_capi -->|"accesses"| node_tree
node_flatcc -->|"builds buffers"| node_flatbuffers
node_capi -->|"accepts bytes"| node_flatbuffers
node_cpp -->|"invokes"| node_core
node_capi -->|"invokes"| node_core
node_core -->|"reads and writes"| node_database
node_syncapi -.->|"extends runtime"| node_core
node_core -.->|"synchronizes"| node_syncservice

click node_cpp "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.hpp"
click node_capi "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_model "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_store "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_objects "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.hpp"
click node_queries "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_relations "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_vectors "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_migration "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_async "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_tree "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h"
click node_flatbuffers "https://github.com/objectbox/objectbox-c/blob/main/external/flatbuffers/flatbuffers.h"
click node_flatcc "https://github.com/objectbox/objectbox-c/blob/main/external/flatcc/flatcc_builder.h"
click node_syncapi "https://github.com/objectbox/objectbox-c/blob/main/include/objectbox-sync.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cpp,node_capi toneBlue
class node_model,node_store,node_objects,node_queries,node_relations,node_vectors,node_migration,node_async,node_tree,node_core,node_database toneAmber
class node_flatbuffers,node_flatcc toneMint
class node_syncapi,node_syncservice toneRose
class node_app toneIndigo
```

## Components

### Application APIs

- [C++ API](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.hpp): `include/objectbox.hpp`
- [C API](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`

### Persistence

- [Model Definition](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Store and Transactions](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Object CRUD](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.hpp): `include/objectbox.hpp`
- [Queries and Indexes](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Object Relations](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Vector Search](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Schema Migration](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Async Operations](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- [Tree Data](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox.h): `include/objectbox.h`
- **ObjectBox Runtime**
- **Embedded Database**

### Data Formats

- [FlatBuffers Support](https://github.com/objectbox/objectbox-c/blob/main/external/flatbuffers/flatbuffers.h): `external/flatbuffers/flatbuffers.h`
- [C Buffer Builder](https://github.com/objectbox/objectbox-c/blob/main/external/flatcc/flatcc_builder.h): `external/flatcc/flatcc_builder.h`

### Synchronization

- [Sync API](https://github.com/objectbox/objectbox-c/blob/main/include/objectbox-sync.h): `include/objectbox-sync.h`
- **Sync Backend**

### Other components

- **C/C++ Application**

## Connections

- C/C++ Application → C++ API: uses
- C/C++ Application → C API: uses
- C++ API → C API: wraps
- C API → Model Definition: defines schema
- C API → Store and Transactions: opens store
- C++ API → Object CRUD: operates on
- Object CRUD → C API: calls
- C API → Queries and Indexes: executes
- C API → Object Relations: accesses
- C API → Vector Search: searches
- C API → Schema Migration: supports
- C API → Async Operations: dispatches
- C API → Tree Data: accesses
- C Buffer Builder → FlatBuffers Support: builds buffers
- C API → FlatBuffers Support: accepts bytes
- C++ API → ObjectBox Runtime: invokes
- C API → ObjectBox Runtime: invokes
- ObjectBox Runtime → Embedded Database: reads and writes
- Sync API → ObjectBox Runtime: extends runtime
- ObjectBox Runtime → Sync Backend: synchronizes
