Repo-Init
โก Modern C++ Application Template with Enterprise-Grade Features โก
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.
Table of Contents
- What is Repo-Init?
- Table of Contents
- CMake Modules
- Utility Scripts
- Dependencies
- Testing Setup
- Build Targets
- 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 |
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
|
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
-
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
Made with โค๏ธ for the C++ community
Star โญ this repo if you find it useful!