{"id":33278838,"url":"https://github.com/reductstore/reduct-cpp","last_synced_at":"2026-02-04T09:17:26.085Z","repository":{"id":38412017,"uuid":"453724459","full_name":"reductstore/reduct-cpp","owner":"reductstore","description":"ReductStore Client SDK for C++","archived":false,"fork":false,"pushed_at":"2025-10-15T08:30:19.000Z","size":336,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-15T23:14:42.900Z","etag":null,"topics":["cpp","cpp-20","http-client","reductstore","sdk"],"latest_commit_sha":null,"homepage":"https:/ww.reduct.store/docs","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reductstore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-30T15:51:31.000Z","updated_at":"2025-10-15T08:30:21.000Z","dependencies_parsed_at":"2024-01-23T23:39:04.976Z","dependency_job_id":"c4e1f455-f2ca-4879-991e-b8c4f1e8176a","html_url":"https://github.com/reductstore/reduct-cpp","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/reductstore/reduct-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reductstore%2Freduct-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reductstore%2Freduct-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reductstore%2Freduct-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reductstore%2Freduct-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reductstore","download_url":"https://codeload.github.com/reductstore/reduct-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reductstore%2Freduct-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284861038,"owners_count":27075155,"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","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cpp","cpp-20","http-client","reductstore","sdk"],"created_at":"2025-11-17T10:00:53.138Z","updated_at":"2026-02-04T09:17:26.078Z","avatar_url":"https://github.com/reductstore.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReductStore Client SDK for C++\n\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/reductstore/reduct-cpp)]()\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reductstore/reduct-cpp/ci.yml?branch=main)\n\nThe ReductStore Client SDK for C++ is an open source client for [ReductStore](https://www.reduct.store) written\nin C++20. It allows developers to easily interact with the database from their C++ applications.\n\n## Features\n\n* Written in C++20\n* Support ReductStore https://www.reduct.store/docs/http-api\n* Support HTTP and HTTPS protocols\n* Support Linux AMD64 and Windows\n* Conan and Vpkg package managers support\n\n## Example\n\nHere is a simple example of how to use the ReductStore Client SDK for C++ to create a bucket, write data to it, and\nread the data back:\n\n```cpp\n#include \u003creduct/client.h\u003e\n\n#include \u003ciostream\u003e\n#include \u003ccassert\u003e\n\nusing reduct::IBucket;\nusing reduct::IClient;\nusing reduct::Error;\nusing sec = std::chrono::seconds;\n\nint main() {\n    // 1. Create a ReductStore client\n    auto client = IClient::Build(\"http://127.0.0.1:8383\",{\n        .api_token = \"my-token\"\n    });\n\n    // 2. Get or create a bucket with 1Gb quota\n    auto [bucket, create_err] = client-\u003eGetOrCreateBucket(\"my-bucket\", {\n        .quota_type = IBucket::QuotaType::kFifo,\n        .quota_size = 1'000'000'000\n    });\n\n    if (create_err) {\n        std::cerr \u003c\u003c \"Error: \" \u003c\u003c create_err;\n        return -1;\n    }\n\n    // 3.  Write some data with timestamps and labels to the 'entry-1' entry\n    IBucket::Time start = IBucket::Time::clock::now();\n    auto write_err =\n            bucket-\u003eWrite(\"sensor-1\", {\n                .timestamp = start,\n                .labels = {{\"score\", \"10\"}}\n                }, [](auto rec) { rec-\u003eWriteAll(\"\u003cBlob data\u003e\"); });\n    assert(write_err == Error::kOk);\n\n    write_err = bucket-\u003eWrite(\"sensor-1\", {\n        .timestamp = start + sec(1),\n        .labels = {{\"score\", \"20\"}}\n    }, [](auto rec) { rec-\u003eWriteAll(\"\u003cBlob data\u003e\"); });\n    assert(write_err == Error::kOk);\n\n    // 4. Query the data by time range and condition\n    auto err = bucket-\u003eQuery(\"sensor-1\", start,  start + sec(2), {\n            .when = R\"({\"\u0026score\": {\"$gt\": 10}})\"\n\n        }, [](auto\u0026\u0026 record) {\n        std::cout \u003c\u003c \"Timestamp: \" \u003c\u003c record.timestamp.time_since_epoch().count() \u003c\u003c std::endl;\n        std::cout \u003c\u003c \"Content Length: \" \u003c\u003c record.size \u003c\u003c std::endl;\n\n        auto [blob, read_err] = record.ReadAll();\n        if (!read_err) {\n            std::cout \u003c\u003c \"Read blob: \" \u003c\u003c blob \u003c\u003c std::endl;\n        }\n\n        return true;\n    });\n\n    if (err) {\n        std::cerr \u003c\u003c \"Error: \" \u003c\u003c err;\n        return -1;\n    }\n\n    return 0;\n}\n```\n\n## Integration\n\n### Build and Install reduct-cpp system-wide\n\n#### Dependencies\n\n* GCC 11.2 or higher (support C++20)\n* CMake \u003e= 3.23\n* OpenSSL \u003e= 3.0.13\n* fmt \u003e= 11.0.2\n* nlohmann_json \u003e= 3.11.3\n* httplib \u003e= 0.16.0\n* concurrentqueue \u003e= 1.0.4\n\nFor Ubuntu, you can install the dependencies using the following command:\n\n```shell\n# Ubuntu\nsudo apt install g++ cmake libssl-dev \\\n        libfmt-dev \\\n        nlohmann-json3-dev \\\n        libcpp-httplib-dev \\\n        libconcurrentqueue-dev \\\n        libhowardhinnant-date-dev\n```\n\n#### Build and Install\n\nTo build and install the ReductStore C++ SDK system-wide, you can use the following steps:\n\n```shell\ngit clone https://github.com/reductstore/reduct-cpp.git\ncd reduct-cpp\n\n# Run cmake configuration\ncmake -S . -B build  # for linux\ncmake -S . -B build -DOPENSSL_ROOT_DIR=\"\u003cpath\u003e\"   # for windows\n\n# Build\ncmake --build build # for linux\ncmake --build build --config Release # for windows\n\n# Install\nsudo cmake --install build\n```\n\n#### CMake Configuration\n\nYou can use the ReductStore C++ SDK in your CMake project by linking against the `reductcpp` target. Here is an example of how to do this:\n\n```cmake\ncmake_minimum_required(VERSION 3.23)\n\nproject(ReductCppExample)\n\nfind_package(reductcpp)\n\nadd_executable(quick_start quick_start.cc)\ntarget_link_libraries(quick_start reductcpp::reductcpp)\n```\n\n### Using fetchContent (recommended)\n\nIf you want to use the ReductStore C++ in your project without installing it system-wide, you can use `FetchContent` to\ndownload the ReductStore C++ SDK and its dependencies automatically. This way, you don't need to install the\ndependencies (except OpenSSL)\n\n#### Dependencies\n* GCC 11.2 or higher (support C++20)\n* CMake \u003e= 3.23\n* OpenSSL \u003e= 3.2.2\n```shell\n\n# Ubuntu\nsudo apt install g++ cmake libssl-dev\n```\n\n#### CMake Integration\n\nYou can use the following CMake code to integrate the ReductStore C++ SDK into your project using `FetchContent`:\n\n```cmake\ncmake_minimum_required(VERSION 3.23)\n\nproject(ReductCppExample)\n\ninclude(FetchContent)\n\n# Enable using fetchcontent for reductcpp dependencies\nset(REDUCT_CPP_USE_FETCHCONTENT ON CACHE BOOL \"\" FORCE)\nFetchContent_Declare(\n    reductcpp\n        URL https://github.com/reductstore/reduct-cpp/archive/refs/tags/v1.16.0.zip\n)\nFetchContent_MakeAvailable(reductcpp)\n\nadd_executable(quick_start quick_start.cc)\ntarget_link_libraries(quick_start reductcpp::reductcpp)\n```\n\n### Building with Conan\n\nAlternatively, you can use Conan to install the dependencies and build the library:\n\n```shell\nconan install . --build=missing\ncmake --preset conan-release\ncmake --build --preset conan-release --config Release\n```\n\n### Examples\n\nFor more examples, see the [Guides](https://reduct.store/docs/guides) section in the ReductStore documentation.\n\n### Supported ReductStore Versions and  Backward Compatibility\n\nThe library is backward compatible with the previous versions. However, some methods have been deprecated and will be\nremoved in the future releases. Please refer to the [Changelog](CHANGELOG.md) for more details.\nThe SDK supports the following ReductStore API versions:\n\n* v1.18\n* v1.17\n* v1.16\n\nIt can work with newer and older versions, but it is not guaranteed that all features will work as expected because\nthe API may change and some features may be deprecated or the SDK may not support them yet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freductstore%2Freduct-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freductstore%2Freduct-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freductstore%2Freduct-cpp/lists"}