First off, thank you for considering contributing to lightlib. It's people like you that make lightlib a great tool.
This project and everyone participating in it is governed by the lightlib Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to hello@lightlib.org.
Before creating bug reports, please check the issue tracker as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include code snippets or links to repositories that demonstrate the issue
Please do not report security vulnerabilities in public issues!
Instead, report by email to hello@lightlib.org with [SECURITY] in the
subject line.
Enhancement suggestions are tracked as issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
- Fill in the required pull request template
- Do not include issue numbers in the PR title
- Follow the C++ style guide (see below)
- Include thoughtfully-worded, well-structured tests
- Document new code
- End all files with a newline
- Sign off your commits:
git commit -s -m "Your message" - Ensure every new or modified file has the LGPL header (see example below)
- Fork the repository on GitHub:
https://github.com/lev2p1/lightlib - Clone your fork:
git clone https:github.ru/your-username/lightlib.git cd lightlib - Build the project using CMake and vcpkg:
mkdir build && cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake cmake --build . --config Release
Now you can create branches, start adding features & bugfixes, and create pull requests.
Based on the existing lightlib code style (see Model.hpp for reference):
- Use 4 spaces for indentation (not tabs)
- Use
snake_casefor functions and variables - Use
PascalCasefor class names - Use
UPPER_CASEfor macros and constants - Place opening braces on the same line for functions
- Use
#pragma onceinstead of include guards - Keep lines under 100 characters when possible
- Include headers in the following order:
- Corresponding header for the .cpp file
- C++ standard library headers (
<string>,<vector>,<map>, etc.) - Third-party library headers (
<nlohmann/json.hpp>) - lightlib internal headers (
Database.hpp,Logger.hpp, etc.)
Every source file (.cpp, .h, .hpp) must start with the LGPL header:
/*
* Copyright (c) 2025 Kirill Sergeev, Nikolay Sugonyako, Andrey Agarkov, Gleb Safyannikov
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of lightlib.
*
* lightlib is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* lightlib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with lightlib; if not, see <https:www.gnu.org/licenses/>.
*/- Write all comments in English
- For new public API, use Doxygen format:
/**
* @brief Brief description of the method
* @param param_name Description of parameter
* @return Description of return value
*/Following the pattern from Model.hpp:
namespace lightlib {
template <typename Derived>
class Model {
public:
static ModelQueryBuilder<Derived> query() {
return ModelQueryBuilder<Derived>(Derived::table_name);
}
void setAttribute(const std::string& key, const std::string& value) {
if (isField(key)) {
attributes[key] = value;
}
}
bool save() {
implementation
return true;
}
private:
std::map<std::string, std::string> attributes;
};
} namespace lightlibAll commits must be signed off, certifying that you have the right to submit the code under LGPL-3.0-or-later:
git commit -s -m "Your commit message"The sign-off line should look like:
Signed-off-by: Kirill Sergeev <kirill@lightlib.org>
By signing off, you agree to the Developer Certificate of Origin (DCO).
Before submitting a PR, make sure your changes compile:
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build . --config ReleaseIf you add new functionality, please add corresponding tests. If you fix a bug, write a test that breaks in the old version but works in the new one.
Use descriptive branch names to make your intent clear:
fix/123-fix-memory-leak— for bug fixes (123 = issue number)feat/456-add-websocket— for new featuresdocs/update-readme— for documentation changes- Skip the number if no issue exists:
fix/fix-typo
Write clear, descriptive commit messages in English:
- Good: "Add WebSocket support for async handlers"
- Good: "Fix connection pool memory leak"
- Bad: "fix bug" or "update code"
Collaborators with write access should follow these guidelines:
- Ensure all tests pass before merging
- Use Squash and Merge for PRs with multiple small commits
- Write a descriptive commit message for the squashed PR (or use the PR title)
- Keep the
mainbranch history clean and readable
By contributing to lightlib, you agree that your contributions will be licensed under LGPL-3.0-or-later.
Thank you for contributing to lightlib! ----------------------------------------------------------------------------//