Skip to content

set of c++ libraries that build with different technologies like kafka, rabbitmq, UberH3 library etc.

License

Notifications You must be signed in to change notification settings

prrathnayake/cpp-base

Repository files navigation

cpp-base

Overview

cpp-base is a modular C++ backend workspace that centralises the build recipes for a collection of microservice-oriented libraries. The repository is designed to be used together with the ccp-tools environment, which provides reproducible Docker images and helper scripts for building the toolchain and third-party dependencies. The project demonstrates messaging (Kafka, RabbitMQ), geospatial indexing (H3), configuration/authentication/cache helpers, and general-purpose utilities that can be reused across microservices. Every library now routes diagnostics through utils::SingletonLogger, so consuming projects inherit consistent structured logging out of the box.

Getting Started

Prerequisites

  • Docker and Docker Compose (when using the ccp-tools development containers).
  • Conan 2 package manager.
  • CMake 3.21 or newer.
  • A C++20-compatible compiler (GCC 11+, Clang 12+, or MSVC 2019 16.11+).
  • Git submodules pulled for any modules you keep in separate repositories.

Optional integrations such as Kafka, RabbitMQ, PostgreSQL, MySQL, and OpenSSL require their respective development headers and runtime libraries when building outside the pre-configured containers.

Clone the repository

git clone https://github.com/prrathnayake/cpp-base.git
cd cpp-base

Using ccp-tools

The recommended way to work with the repository is via the dedicated ccp-tools workspace. It supplies a container image with the required compilers and dependency mirrors, and exposes helper scripts for starting interactive shells inside that environment. Refer to the ccp-tools documentation for detailed setup instructions.

Configure dependencies with Conan

Install the remotes you need and authenticate with your Conan server if applicable. Once you are inside the container (or on a host with the necessary tooling), install the dependencies:

conan install . --output-folder=build --build=missing

The command generates the CMake toolchain files and pulls any required third-party packages that are not already available in your remotes.

Build the project

After dependency resolution you can configure and build all modules via Conan:

python3 cpp-tools/module/scripts/buildBase.py ./cpp-base/

The build artefacts and generated files will be placed under the build/ directory. You can customise the build type and other settings via the standard Conan options, for example -s build_type=Release.

Repository layout

cpp-base/
├── app_algorithms/   # Algorithmic utilities shared across services
├── app_database/     # Database client helpers (PostgreSQL, MySQL, SQLite)
├── app_h3/           # Geospatial indexing helpers powered by Uber's H3
├── app_http/         # HTTP-related abstractions and clients
├── app_kafka/        # Kafka producers/consumers built on librdkafka
├── app_rabbitMQ/     # RabbitMQ connectors using rabbitmq-c and AMQP-CPP
├── app_utils/        # Shared logging, configuration, and system helpers
├── app_config/       # Layered configuration loading with env resolution
├── app_auth/         # JWT authentication helpers backed by OpenSSL
├── app_monitoring/   # Metrics, health checks, and scoped timers
├── app_cache/        # Cache abstraction with TTL-aware in-memory backend
├── CMakeLists.txt    # Top-level CMake entry point
├── conanfile.py      # Conan recipe orchestrating sub-packages
└── README.md         # Project documentation

Development guidelines

  • Follow the existing directory structure when adding new modules.
  • Keep public headers minimal and document any exported APIs.
  • Prefer Conan packages for external dependencies so builds remain reproducible across environments.
  • Remember to update this README and the NOTICE file when new third-party dependencies are introduced.

Support and contributions

Issues and contributions are welcome. Please open a GitHub issue to report bugs or discuss feature requests. When submitting pull requests, ensure the CI pipeline (if configured) passes and adds tests forthe new behaviour.

License

This project is distributed under the MIT License. See LICENSE for details.

About

set of c++ libraries that build with different technologies like kafka, rabbitmq, UberH3 library etc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published