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.
- Docker and Docker Compose (when using the
ccp-toolsdevelopment 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.
git clone https://github.com/prrathnayake/cpp-base.git
cd cpp-baseThe 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.
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=missingThe command generates the CMake toolchain files and pulls any required third-party packages that are not already available in your remotes.
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.
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
- 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.
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.
This project is distributed under the MIT License. See LICENSE for details.