An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Repo-Init

Repo-Init Logo

### โšก **Modern C++ Application Template with Enterprise-Grade Features** โšก


Top Language
License



Build Status


Coverage


Quality Gate


OpenSSF Score

---

## 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.

[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](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





๐Ÿ› ๏ธ 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 deactivate when 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




  1. Import Dashboard: Use our pre-built Grafana template


  2. Connect Prometheus: Point to your app's metrics endpoint


  3. 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


Grafana Dashboard

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!*

---