https://github.com/egecetin/repo-init
C++ Application Template. It has already integrated a Telnet and ZeroMQ server to receive commands, Crashpad handler to generate minidump, a Prometheus server to broadcast performance metrics. Also, it can send logs to syslog using Spdlog, to a Sentry server and Grafana Loki instance
https://github.com/egecetin/repo-init
application-template cmake cpp cpp-template grafana-loki-client prometheus-client sentry-client template
Last synced: 4 months ago
JSON representation
C++ Application Template. It has already integrated a Telnet and ZeroMQ server to receive commands, Crashpad handler to generate minidump, a Prometheus server to broadcast performance metrics. Also, it can send logs to syslog using Spdlog, to a Sentry server and Grafana Loki instance
- Host: GitHub
- URL: https://github.com/egecetin/repo-init
- Owner: egecetin
- License: mit
- Created: 2022-04-10T19:49:06.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-15T11:52:57.000Z (11 months ago)
- Last Synced: 2025-03-28T01:53:30.529Z (11 months ago)
- Topics: application-template, cmake, cpp, cpp-template, grafana-loki-client, prometheus-client, sentry-client, template
- Language: C++
- Homepage: https://egecetin.github.io/Repo-Init/
- Size: 28.2 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
## What is Repo-Init?
**Repo-Init** is a powerful, production-ready CMake template designed to kickstart your C++ applications with enterprise-grade features built-in. Say goodbye to boilerplate code and hello to modern, robust software development!
> ๐ง **Requires**: C++17 supported compiler
> ๐ก **Perfect for**: Microservices, CLI tools, system applications, and performance-critical software
### **Key Features at a Glance**
๐ก๏ธ Crash Protection
Automatic minidump generation with Crashpad
Never lose critical debugging information
๐ Advanced Logging
Multi-output logging with Spdlog
File rotation โข Syslog โข Colorized console
๐ Service Integration
Sentry โข Grafana Loki โข Prometheus
Real-time monitoring & alerting
โก Performance Metrics
- Success/failure counters
- Min/max timing analysis
- Quantile-based bottleneck detection
๐ Network Ready
- Built-in Telnet server
-
ZeroMQ messaging - HTTP connectivity
๐ Developer Experience
- One-command setup
- Comprehensive testing
- Auto-generated docs
---
> ๐ฌ **Questions? Issues? Contributions?**
> Feel free to ask, use, and report any bugs you encounter! We โค๏ธ community feedback.
[](https://sonarcloud.io/summary/new_code?id=egecetin_Repo-Init)
---
## Table of Contents
- [What is Repo-Init?](#-what-is-repo-init)
- [Table of Contents](#-table-of-contents)
- [CMake Modules](#-cmake-modules)
- [Utility Scripts](#-utility-scripts)
- [Dependencies](#-dependencies)
- [Testing Setup](#-testing-setup)
- [Build Targets](#-build-targets)
- [Grafana Integration](#-grafana-integration)
## CMake Modules
Our carefully crafted CMake modules provide powerful build automation:
| Module | ๐ฏ Purpose | โจ Benefits |
|--------|------------|-------------|
| **CodeCoverage** | Detects and enables `gcovr` | ๐ Automatic test coverage reports |
| **CompilerSecurityOptions** | Enables/Disables secure compiler flags | ๐ก๏ธ Hardened binary security |
| **Doxy** | Finds Doxygen package and prepares docs | ๐ Auto-generated documentation |
| **GenerateSymbols** | Adds target for symbol file generation | ๐ Enhanced debugging with minidumps |
| **GitVersion** | Gets SHA1 hash of current commit | ๐ท๏ธ Version tracking and build reproducibility |
| **GraphViz** | Finds GraphViz and dot executable | ๐จ Visual dependency graphs |
---
## Utility Scripts
> ๐ก **Tip**: All scripts should be executed from the top-level directory
| Script | ๐ Function | ๐ Description |
|--------|-------------|----------------|
| `firstName.sh` | **Name Changer** | Replaces placeholder names throughout the project |
| `crashpad_manual_upload.py` | **Manual Minidump Uploader** | Uploads bulk of minidump files in given directory |
| `dump_syms.py` | **Symbol Dumper** | Generates symbol files for crash analysis |
---
## Dependencies
### **Core Runtime Libraries**
๐ฅ Integrated Dependencies
Built and bundled automatically
- ๐ CppZMQ - Modern C++ ZeroMQ
bindings - ๐ฅ Crashpad -
Crash reporting system - ๐
Date - C++ date/time
library - ๐ Http-status-codes
- HTTP utilities - ๐ Prometheus-cpp -
Metrics collection - โก RapidJSON - Ultra-fast
JSON parser - ๐ Sentry - Error
monitoring - ๐ฅ๏ธ TelnetServLib -
Modified & embedded
๐ ๏ธ Development Dependencies
For building and testing only
- ๐ง Breakpad -
Symbol dumping - โ
GoogleTest - Unit testing
framework - ๐ MemPlumber - Memory leak
detection - ๐ฆ ZLIB - Compression (required by Breakpad)
๐ System Dependencies
Install via package manager (apt/dnf/brew)
- ๐ cURL - HTTP client library
- ๐ Spdlog - Fast logging library
- โก ZeroMQ - High-performance
messaging
> ๐ **Want to see the full picture?** Check out our complete [**dependency graph**](doc/dependency-tree.svg)!
---
## Testing Setup
### **Python Test Dependencies**
Our test suite requires some Python dependencies for comprehensive testing. Here's how to set them up:
๐ Quick Setup
# Create virtual environment
python3 -m venv .venv
# Activate virtual environment
source .venv/bin/activate # Linux/macOS
# OR
.venv\Scripts\activate # Windows
# Install test dependencies
pip install -r tests/data/requirements.txt
๐ Required Dependencies
-
pyzmq - Python ZeroMQ bindings for testing messaging functionality
โ ๏ธ Important Notes
- Virtual environment must be activated before running tests
- Dependencies are automatically detected by the test suite
- Deactivate with
deactivatewhen done
---
## Build Targets
### **One Command, Multiple Possibilities**
| Target | ๐ Command | ๐ Description |
|--------|------------|----------------|
| **all** | `cmake --build .` | Builds the complete project with all components |
| **coverage** | `cmake --build . --target coverage` | Generates comprehensive test coverage reports |
| **docs** | `cmake --build . --target docs` | Creates beautiful documentation with Doxygen |
| **dependency-graph** | `cmake --build . --target dependency-graph` | Visualizes project dependencies with GraphViz |
| **package** | `cmake --build . --target package` | Creates distribution packages (DEB/RPM + systemd service) |
| **test** | `ctest . --parallel` | Runs the complete test suite with GoogleTest |
> ๐ก **Pro Tips**:
> - For packages, specify your preferred format with `-DCPACK_GENERATOR="DEB"` or `"RPM"`
> - Ensure Python virtual environment is activated before running tests!
---
### **Build Options**
**Customize your build with powerful CMake configuration options**
> ๐ก **Important**: Re-run CMake configuration (`cmake -B build`) after changing any options
๐งช Testing & Quality Assurance
Option
Description
Default
๐ฏ Use Case
XXX_BUILD_TESTS
๐ง Build all test suites
ON
Complete testing pipeline
XXX_BUILD_UNITTESTS
โ Build unit tests only
ON
Fast development feedback
XXX_BUILD_FUZZTESTS
๐ฒ Build fuzz testing suite
OFF
Security & robustness testing
XXX_ENABLE_COVERAGE
๐ Generate test coverage reports
OFF
Code quality metrics
XXX_ENABLE_MEMLEAK_CHECK
๐ Memory leak detection with MemPlumber
OFF
Debug memory issues
๐ Release & Distribution
Option
Description
Default
๐ฏ Use Case
XXX_ENABLE_SYMBOL_GENERATION
๐ง Generate debug symbols for crash dumps
OFF
Production debugging
XXX_ENABLE_PACKAGING
๐ฆ Enable DEB/RPM packaging with systemd
OFF
Distribution & deployment
๐ก Quick Examples
# Development build with all tests
cmake -B build -DXXX_BUILD_TESTS=ON \
-DXXX_ENABLE_COVERAGE=ON
# Production build with packaging
cmake -B build -DXXX_BUILD_TESTS=OFF \
-DXXX_ENABLE_PACKAGING=ON \
-DXXX_ENABLE_SYMBOL_GENERATION=ON
# Security testing build
cmake -B build -DXXX_BUILD_FUZZTESTS=ON \
-DXXX_ENABLE_MEMLEAK_CHECK=ON
# Minimal build (fastest)
cmake -B build -DXXX_BUILD_TESTS=OFF
โก Pro Tips
- ๐ Fast Iteration: Disable tests for quick builds during development
- ๐ Security Focus: Enable fuzz tests and memory checks for critical code
- ๐ CI/CD: Use coverage reports in your automated pipelines
- ๐ Production: Always enable symbol generation for crash analysis
## Grafana Integration
### **Real-Time Monitoring Made Beautiful**
Thanks to our integrated **Prometheus server**, monitoring your application has never been easier! Get instant insights into your application's performance, health, and behavior.
๐ Quick Setup
-
Import Dashboard: Use our pre-built Grafana template -
Connect Prometheus: Point to your app's metrics endpoint -
Monitor: Watch real-time metrics flow in!
โจ What You Get
-
Performance Metrics: Response times, throughput, resource usage -
Error Tracking: Real-time error rates and alerting -
Resource Monitoring: CPU, memory, and system metrics -
Custom Metrics: Track your application-specific KPIs
๐ธ Live Dashboard Preview
Beautiful, responsive, and information-rich monitoring
---
## **Contributing & Support**
๐ Report Issues โข
๐ฌ Discussions โข
๐ง Pull Requests
**Made with โค๏ธ for the C++ community**
*Star โญ this repo if you find it useful!*
---
