{"id":45157449,"url":"https://github.com/couchbase-examples/cxx-quickstart","last_synced_at":"2026-02-20T05:02:52.564Z","repository":{"id":277943615,"uuid":"931699910","full_name":"couchbase-examples/cxx-quickstart","owner":"couchbase-examples","description":"Entry level Couchbase demo/tutorial with C++","archived":false,"fork":false,"pushed_at":"2025-02-24T06:30:37.000Z","size":888,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-24T07:33:59.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase-examples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-12T17:58:11.000Z","updated_at":"2025-02-13T09:57:01.000Z","dependencies_parsed_at":"2025-02-17T06:24:45.570Z","dependency_job_id":"24d704c4-1449-4250-8dc3-288bb46d7736","html_url":"https://github.com/couchbase-examples/cxx-quickstart","commit_stats":null,"previous_names":["couchbase-examples/cxx-quickstart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/couchbase-examples/cxx-quickstart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fcxx-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fcxx-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fcxx-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fcxx-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase-examples","download_url":"https://codeload.github.com/couchbase-examples/cxx-quickstart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase-examples%2Fcxx-quickstart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29641929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T03:21:14.183Z","status":"ssl_error","status_checked_at":"2026-02-20T03:18:24.455Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-20T05:02:42.695Z","updated_at":"2026-02-20T05:02:52.556Z","avatar_url":"https://github.com/couchbase-examples.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quickstart in Couchbase with C++\n\n#### Overview\nThis repository provides a simple guide to get started with integrating Couchbase with a C++ application. It is designed to give you a starter project in order to give you an idea about how to start working with the Couchbase [C++ SDK](https://github.com/couchbase/couchbase-cxx-client). \n\n\u003cdetails\u003e\n\u003csummary\u003eMore Info\u003c/summary\u003e\nFollowing topics are \n1. How to create, read, update, and delete documents using [Key Value operations](https://docs.couchbase.com/python-sdk/current/howtos/kv-operations.html) (KV operations). KV operations are unique to couchbase and provide super fast (think microseconds) queries.\n\n2. How to write simple parametrized [SQL++ queries](https://docs.couchbase.com/python-sdk/current/howtos/n1ql-queries-with-sdk.html) using the built-in travel-sample bucket.\n\n3. How to create and use [Search indexes](https://docs.couchbase.com/server/current/search/search.html#indexes) for near real-time search capabilities for a diverse range of data types.\n\nFull documentation for the tutorial can be found on the [Couchbase Developer Portal](https://developer.couchbase.com/tutorial-cxx-quickstart).\n\u003c/details\u003e\n\n\n\n## Prerequisites\n\nTo run this prebuilt project, you will need:\n\n- [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster or a self managed Couchbase cluster with [travel-sample](https://docs.couchbase.com/python-sdk/current/ref/travel-app-data-model.html) bucket loaded.\n\n- [CMake](https://cmake.org/) 3.9 or higher installed\n- [C++17](https://en.cppreference.com/w/cpp/17) and a compatible compiler, [clang++](https://clang.llvm.org/) or [g++](https://gcc.gnu.org/)\n- Loading Travel Sample Bucket\n  If travel-sample is not loaded in your cluster, you can load it by following the instructions:\n  - [Load travel-sample bucket in Couchbase Capella](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html#import-sample-data)\n  - [Load travel-sample bucket in self-managed cluster](https://docs.couchbase.com/server/current/getting-started/do-a-quick-install.html#load-the-sample-dataset)\n\n## Application Setup\n\nWe will walk through the different steps required to get the application running.\n\n### Cloning Repo\n\n```sh\ngit clone https://github.com/couchbase-examples/cxx-quickstart.git\n```\n\n\n### Setup Database Configuration\n\nTo know more about connecting to your Capella cluster, please follow the [instructions](https://docs.couchbase.com/cloud/get-started/connect.html).\n\nSpecifically, you need to do the following:\n\n- Create the [database credentials](https://docs.couchbase.com/cloud/clusters/manage-database-users.html) to access the travel-sample bucket (Read and Write) used in the application.\n- [Allow access](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html) to the Cluster from the IP on which the application is running.\n\nAll configuration for communication with the database is read from the environment variables. We have provided a convenience feature in this quickstart to setup the required environment variables using a shell script `setup_env_vars.sh`. Change the values of the following lines:\n\n```sh\nexport DB_CONN_STR=\u003cconnection_string\u003e\nexport DB_USERNAME=\u003cusername\u003e\nexport DB_PASSWORD=\u003cpassword\u003e\nexport BUCKET_NAME=\u003cbucket_name\u003e\nexport SCOPE_NAME=\u003cinventory\u003e\nexport COL_NAME=\u003ccollection_name\u003e\n```\n\u003e Note: The connection string expects the `couchbases://` or `couchbase://` part.\n\nRun the command:\n```sh\nsource setup_env_vars.sh\n```\nThis will set the environment variables for that session.\n\n### Install Dependencies and Building\n\nThis project makes use of CMake and CPM to install dependencies. \n\n\n```sh\nmkdir build\ncd build\ncmake ..\ncmake --build .\n```\n\nThis will download and install all the dependencies required for the project to built. Along with that it will build the executable required to run the application.\n\n## Running The Application\n\n### Directly on Machine\n\nAt this point, we have installed the dependencies, loaded the travel-sample data and configured the application with the credentials. The application is now ready and you can run it by executing the following command from the build directory:\n\n```sh\n./cxx_quickstart\n```\n\n\n### Verifying the Application\n\nOnce you run the executable, your terminal should fill up with the results of the executed statements written in the main function of the `main.cpp` and should look something like this:\n![image](./images/cli_output.png)\n\n\n### Running Tests\n\nFor running tests, a self-managed cluster is required with travel-sample bucket loaded or you need to update the connection details in the `tests/test.cpp` file. To run the tests, use the following command from the build directory:\n\n```sh\n./tests/u_tests\n```\n\n### Data Model\n\nFor this quickstart, we use one collection, `airline`  and `hotels` collection that contains sample airline and sample hotel information. For CRUD operations, we make use of the `airline` collection, whereas for Search indexes and Query execution we use the `hotel`collection.\nYou can find the schema for both these collections in the model folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Fcxx-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase-examples%2Fcxx-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase-examples%2Fcxx-quickstart/lists"}