Thank you for your interest in contributing to nsecbunker-java! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
- Check existing issues - Search existing issues to avoid duplicates
- Use the bug report template - Fill out all required fields
- Provide reproduction steps - Include minimal code to reproduce the issue
- Include version information - Java version, library version, OS
- Check existing discussions - Your idea may already be proposed
- Use the feature request template - Describe the problem and proposed solution
- Include API examples - Show how you'd like the API to look
- Fork the repository and create your branch from
master - Follow coding standards (see below)
- Add tests for new functionality
- Update documentation as needed
- Run the full build before submitting
- JDK 17 or higher
- Maven 3.8+
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/nsecbunker-java.git
cd nsecbunker-java
# Build the project
mvn clean install
# Run tests only
mvn test
# Run with quality checks
mvn verify -Pquality
# Generate site documentation
mvn site# Run Checkstyle
mvn checkstyle:check
# Run SpotBugs
mvn spotbugs:check
# Run PMD
mvn pmd:check
# Run all quality checks
mvn verify -Pquality- Follow Google Java Style Guide with modifications in
checkstyle.xml - Maximum line length: 150 characters
- Use 4 spaces for indentation (no tabs)
- Always use braces for control structures
- Classes: PascalCase (e.g.,
RemoteSigner,BunkerPolicy) - Methods/Variables: camelCase (e.g.,
signEvent,publicKey) - Constants: UPPER_SNAKE_CASE (e.g.,
DEFAULT_TIMEOUT) - Packages: lowercase (e.g.,
xyz.tcheeric.nsecbunker.client)
- Add Javadoc for all public classes and methods
- Include
@param,@return, and@throwstags - Keep comments concise and meaningful
Example:
/**
* Signs a Nostr event using the remote signer.
*
* @param event the event to sign (must not be null)
* @return a CompletableFuture containing the signed event
* @throws SigningException if signing fails
*/
public CompletableFuture<GenericEvent> signEvent(GenericEvent event) {
// implementation
}- Write unit tests for all new functionality
- Use descriptive test method names
- Follow the Arrange-Act-Assert pattern
- Aim for high test coverage on critical paths
Example:
@Test
void signEvent_shouldReturnSignedEvent_whenValidEventProvided() {
// Arrange
GenericEvent event = createTestEvent();
// Act
GenericEvent signed = signer.signEvent(event).join();
// Assert
assertNotNull(signed.getSig());
assertTrue(signed.verify());
}Use clear, descriptive commit messages:
- Start with a verb in present tense (add, fix, update, remove)
- Keep the first line under 72 characters
- Reference issues when applicable
Examples:
feat: Add NIP-44 encryption support
fix: Handle connection timeout gracefully (#123)
docs: Update installation instructions
refactor: Extract connection logic to separate class
test: Add integration tests for admin API
nsecbunker-java/
├── nsecbunker-core/ # Core models and interfaces
├── nsecbunker-connection/ # Relay connection management
├── nsecbunker-protocol/ # NIP-46 protocol implementation
├── nsecbunker-client/ # Remote signer client
├── nsecbunker-admin/ # Admin operations
├── nsecbunker-monitoring/ # Logging, metrics, health
├── nsecbunker-account/ # Account management
└── nsecbunker-spring-boot-starter/ # Spring Boot integration
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards
-
Run the full build
mvn clean verify -Pquality
-
Push to your fork
git push origin feature/your-feature-name
-
Open a Pull Request
- Fill out the PR template completely
- Link related issues
- Request review from maintainers
-
Address review feedback
- Make requested changes
- Push additional commits
- Re-request review when ready
Pull requests are reviewed for:
- Correctness - Does it work as intended?
- Tests - Is the code adequately tested?
- Style - Does it follow coding standards?
- Documentation - Are changes documented?
- Performance - Any performance implications?
- Security - Any security concerns?
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
By contributing, you agree that your contributions will be licensed under the MIT License.