{"id":15394913,"url":"https://github.com/kassane/tigerbeetle-cpp","last_synced_at":"2025-04-15T23:53:55.980Z","repository":{"id":165688942,"uuid":"641024948","full_name":"kassane/tigerbeetle-cpp","owner":"kassane","description":"TigerBeetle C++ client","archived":false,"fork":false,"pushed_at":"2025-03-17T20:25:12.000Z","size":103,"stargazers_count":11,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T03:05:31.026Z","etag":null,"topics":["cmake","cplusplus","cpp","distributed-database","header-only","hpp-library","tigerbeetle","tigerbeetle-client"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kassane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-15T16:06:27.000Z","updated_at":"2025-03-22T17:52:14.000Z","dependencies_parsed_at":"2024-02-21T13:31:33.493Z","dependency_job_id":"909eda0e-dbef-4c2c-802a-ef2266dba952","html_url":"https://github.com/kassane/tigerbeetle-cpp","commit_stats":{"total_commits":45,"total_committers":2,"mean_commits":22.5,"dds":"0.022222222222222254","last_synced_commit":"7b258353b52b07347ad948819607f94def2c67df"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kassane%2Ftigerbeetle-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kassane%2Ftigerbeetle-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kassane%2Ftigerbeetle-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kassane%2Ftigerbeetle-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kassane","download_url":"https://codeload.github.com/kassane/tigerbeetle-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173061,"owners_count":21224481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","cplusplus","cpp","distributed-database","header-only","hpp-library","tigerbeetle","tigerbeetle-client"],"created_at":"2024-10-01T15:24:53.884Z","updated_at":"2025-04-15T23:53:55.958Z","avatar_url":"https://github.com/kassane.png","language":"CMake","readme":"# TigerBeetle C++ client (Header only)\n\n[TigerBeetle] is a financial accounting database designed for mission critical safety and performance to power the future of financial services.\n\n### Prerequisites\n\n C++ version: 20\n\n**Libraries**\n- fmtlib v11.1\n- TigerBeetle C client library (latest version - branch main)\n\n**Tools**\n- cmake v3.14 or higher\n- zig v0.13.0 (tigerbeetle compatible)\n\n\n### How to Build and Run\n\n**CMake Presets**\n\n```bash\n$\u003e cmake --preset dev\n# OR\n$\u003e cmake --preset release\n$\u003e cmake --build build -t run_with_tb\n```\n\n**Another C++ toolchain**\n\n```bash\n$\u003e cmake -B build # (tb_client.[a|lib])\n# OR\n$\u003e cmake -B build -DTIGERBEETLE_BUILD_SHARED_LIBS=ON # (tb_client.[so|dll|dylib])\n# Build and test - build client examples\n$\u003e cmake --build build -DBUILD_EXAMPLES=ON --target run_with_tb # run TigerBeetle server + your client \n```\n\n**Zig toolchain**\n\n```bash\n# Linux/MacOS\n$\u003e cmake -B build -DCMAKE_CXX_COMPILER=scripts/zigcxx.sh\n# Windows\n$\u003e cmake -B build -DCMAKE_CXX_COMPILER=scripts/zigcxx.cmd\n```\n\n### How to use\n\n- Add on your cmake project:\n\n```cmake\ninclude(FetchContent)\n\nfind_package(TigerBeetle 0.3.1 QUIET)\nif (NOT TigerBeetle_FOUND)\n    FetchContent_Declare(TigerBeetle GIT_REPOSITORY https://github.com/kassane/tigerbeetle-cpp.git\n        GIT_TAG main)\n    FetchContent_GetProperties(TigerBeetle)\n# required\n    set(APP_TARGETS ${PROJECT_NAME}) # executable or executables (need foreach) names\n# optional\n#   set(TB_VERSION 0.13.137) # tigerbeetle branch/tag repo (default: main)\n#   set(TB_ADDRESS 3000) # tb_server port (default: 3001)\n    FetchContent_MakeAvailable(TigerBeetle)\nendif()\n\n# linking your app to tb_client library\ntarget_link_libraries(${PROJECT_NAME}\n    PRIVATE tb_client\n)\ntarget_include_directories(${PROJECT_NAME} PUBLIC ${TigerBeetle_SOURCE_DIR}/include)\ntarget_link_directories(${PROJECT_NAME} PUBLIC ${TigerBeetle_BINARY_DIR})\n```\n\n### Build Samples\n\n**See:**\n- [examples/basic.cpp](examples/basic.cpp)\n- [examples/two_phase.cpp](examples/two_phase.cpp)\n- [examples/two_phase_many.cpp](examples/two_phase_many.cpp)\n\n\u003cdetails\u003e\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```bash\n# possible output\n[100%] Built target tb_cpp\nRunning tb_cpp with TigerBeetle\nStarting replica 0\n\nrunning client...\nerror(message_bus): error connecting to replica 0: error.ConnectionRefused\ninfo(message_bus): connected to replica 0\nTigerBeetle C++ Sample\n\n[trace] Connecting...\n[trace] Creating accounts...\n[info] Accounts created successfully\n[trace] Creating transfers...\n[info] Transfers created successfully\n============================================\n[trace] 194 transfers per second\n[trace] create_transfers max p100 latency per 8191 transfers = 1294686ms\n[trace] total 819100 transfers in 4200636ms\n[info] Looking up accounts ...\n[info] 2 Account(s) found\n============================================\n[trace] id=1\n[trace] debits_posted=819100\n[trace] credits_posted=0\n[trace] id=2\n[trace] debits_posted=0\n[trace] credits_posted=819100\n\nDone!!\nKilling tigerbeetle start process...\nTerminating tigerbeetle start process...\n[100%] Built target run_with_tb\n```\n\u003c/details\u003e\n\n| Compiler | Tested | `tb_client` library |\n| --- | --- | --- |\n| GCC | 🆗 | Shared |\n| GCC | 🆗 | Static |\n| Clang | 🆗 | Shared |\n| Clang | 🆗 | Static |\n| AppleClang | 🆗 | Shared |\n| AppleClang | 🆗 | Static |\n| zig `cc/c++` | 🆗 | Shared |\n| zig `cc/c++` | 🆗 | Static |\n| MSVC | None | Shared |\n| MSVC | None | Static |\n\n**Note:** `zig c++` equal to `clang++ -stdlib=libc++ -fuse-ld=lld` for all targets (builtin), except to MacOS target, replacing `lld` to [`zld`](https://github.com/kubkon/zld)!!\n\n## Frequently Asked Questions\n\n#### Do I need to install Zig to compile this project?\n\n**A:** No! You can use the C and/or C++ compiler of your choice.\n\nHowever, as mentioned in issue [#3](https://github.com/kassane/tigerbeetle-cpp/issues/3), it will only be possible to link dynamically. The Zig static library does not include `compiler-rt` library, it only includes executables and shared libraries.\n\n- [undefined reference to `__zig_probe_stack`](https://github.com/tigerbeetledb/tigerbeetle/pull/792) - **Fixed**.\n\nIt is also not limited to C++, you just need to modify the `CMakeLists.txt` to use it with other languages supported by CMake.\n\n\u003e :information_source: CMake: Supported languages are C, CXX (i.e. C++), CSharp (i.e. C#), CUDA, OBJC (i.e. Objective-C), OBJCXX (i.e. Objective-C++), Fortran, HIP, ISPC, Swift, ASM, ASM_NASM, ASM_MARMASM, ASM_MASM, and ASM-ATT.\n\n**See:** [cmake docs](https://cmake.org/cmake/help/latest/command/enable_language.html)\n\n\n#### Is this project an official binding for TigerBeetleDB?\n\n**A:** No! It's only a community project. But there's nothing stopping the main developers from porting it to the official repository if they want to.\n\n#### What is the goal of `tigerbeetle-cpp`?\n\n**A:** Firstly, to provide a simple C++ solution derived from the [C binding][client-c] (thanks to [@batiati](https://github.com/batiati)).\n\nAlso, to demonstrate that it's possible to use Zig with CMake to build the `tb_client` library without the user needing to use the Zig toolchain (C and/or C++). They don't even need to learn it if they don't want to. (I suggest reconsidering this matter!!)\n\nAnother important point is that TigerBeetle is a product in the early stages of development, subject to flaws and mistakes. The best way to improve this new tool is by testing, and that's where the relevance of the clients (language bindings) comes into play.\n\n## References\n\n\n| language | binding | description |\n| --- | --- | --- |\n| **C** | [client-c] | Official |\n| **Elixir** | [tigerbeetlex] | Community |\n| **Go** | [client-go] | Official |\n| **Java** | [client-java] | Official |\n| **.Net** | [client-dotnet] | Official |\n| **Node** | [client-node] | Official |\n| **Rust** | [tigerbeetle-rs] | Community |\n\n## License\n\nSee: [LICENSE](LICENSE)\n\n[TigerBeetle]: https://github.com/tigerbeetledb/tigerbeetle\n[client-c]:https://github.com/tigerbeetledb/tigerbeetle/tree/main/src/clients/c\n[client-go]: https://github.com/tigerbeetledb/tigerbeetle/tree/main/src/clients/go\n[client-node]: https://github.com/tigerbeetledb/tigerbeetle/tree/main/src/clients/node\n[client-java]: https://github.com/tigerbeetledb/tigerbeetle/tree/main/src/clients/java\n[client-dotnet]: https://github.com/tigerbeetledb/tigerbeetle/tree/main/src/clients/dotnet\n[tigerbeetlex]: https://github.com/rbino/tigerbeetlex\n[tigerbeetle-rs]: https://github.com/ZetaNumbers/tigerbeetle-rs\n","funding_links":[],"categories":["Database"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkassane%2Ftigerbeetle-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkassane%2Ftigerbeetle-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkassane%2Ftigerbeetle-cpp/lists"}