Contributing to nself


We welcome contributions to nself! This guide will help you understand how to contribute effectively, whether you're fixing bugs, adding features, improving documentation, or helping the community.

Thank You!

Every contribution makes nself better for everyone. Whether it's code, documentation, or community support, your help is valuable and appreciated.

Ways to Contribute

Code Contributions

Bug fixes, new features, performance improvements, and code cleanup.

Documentation

Writing guides, fixing typos, adding examples, and improving clarity.

Testing & Bug Reports

Finding and reporting bugs, testing new features, platform compatibility.

Community Support

Helping users in discussions, answering questions, sharing knowledge.

Getting Started

Development Setup

# Fork the repository on GitHub
# Clone your fork
git clone https://github.com/YOUR_USERNAME/nself.git
cd nself

# Set up development environment
make setup

# Install dependencies
go mod download
npm install

# Run tests to ensure everything works
make test

Development Workflow

# Create a feature branch
git checkout -b feature/my-new-feature

# Make your changes
# ... code, test, commit ...

# Run tests and linting
make test
make lint

# Push to your fork
git push origin feature/my-new-feature

# Create a pull request on GitHub

Code Contributions

Finding Issues to Work On

  • Good First Issues: Issues labeled "good first issue" are perfect for beginners
  • Help Wanted: Issues labeled "help wanted" need community assistance
  • Bugs: Check the issue tracker for bugs that need fixing
  • Feature Requests: Popular feature requests that you're interested in

Code Standards

Go Code

// Follow Go conventions and best practices
package main

import (
    "context"
    "fmt"
    "log"
    
    "github.com/acamarata/nself/internal/config"
    "github.com/acamarata/nself/pkg/utils"
)

// Use clear, descriptive function names
func ProcessUserData(ctx context.Context, userID string) error {
    // Add comprehensive error handling
    if userID == "" {
        return fmt.Errorf("userID cannot be empty")
    }
    
    // Include helpful comments for complex logic
    userData, err := fetchUserFromDatabase(ctx, userID)
    if err != nil {
        return fmt.Errorf("failed to fetch user %s: %w", userID, err)
    }
    
    return processData(userData)
}

// Add unit tests for all public functions
func TestProcessUserData(t *testing.T) {
    ctx := context.Background()
    
    t.Run("valid user ID", func(t *testing.T) {
        err := ProcessUserData(ctx, "user123")
        assert.NoError(t, err)
    })
    
    t.Run("empty user ID", func(t *testing.T) {
        err := ProcessUserData(ctx, "")
        assert.Error(t, err)
        assert.Contains(t, err.Error(), "cannot be empty")
    })
}

TypeScript/JavaScript Code

// Use TypeScript for type safety
interface UserConfig {
  id: string;
  name: string;
  email: string;
  preferences: UserPreferences;
}

// Write clear, self-documenting code
export class ConfigManager {
  private config: Map<string, any> = new Map();

  /**
   * Loads configuration from the specified file
   * @param filePath - Path to the configuration file
   * @returns Promise that resolves when config is loaded
   */
  async loadConfig(filePath: string): Promise<void> {
    try {
      const configData = await fs.readFile(filePath, 'utf-8');
      const parsed = JSON.parse(configData);
      
      this.validateConfig(parsed);
      this.config = new Map(Object.entries(parsed));
    } catch (error) {
      throw new Error(`Failed to load config from ${filePath}: ${error.message}`);
    }
  }

  private validateConfig(config: any): void {
    // Configuration validation logic
    if (!config || typeof config !== 'object') {
      throw new Error('Invalid configuration format');
    }
  }
}

// Include comprehensive tests
describe('ConfigManager', () => {
  let configManager: ConfigManager;

  beforeEach(() => {
    configManager = new ConfigManager();
  });

  test('should load valid configuration', async () => {
    await expect(configManager.loadConfig('valid-config.json'))
      .resolves
      .not.toThrow();
  });

  test('should throw error for invalid configuration', async () => {
    await expect(configManager.loadConfig('invalid-config.json'))
      .rejects
      .toThrow('Invalid configuration format');
  });
});

Commit Message Guidelines

# Use conventional commit format
type(scope): brief description

# Types:
feat: new feature
fix: bug fix
docs: documentation changes
style: formatting, no code change
refactor: code change that neither fixes a bug nor adds a feature
test: adding or modifying tests
chore: maintenance tasks

# Examples:
feat(cli): add database backup command
fix(hasura): resolve connection timeout issue
docs(readme): update installation instructions
test(database): add integration tests for migration system

# Include detailed description for complex changes
feat(cli): add database backup command

- Add 'nself db backup' command with compression
- Support custom backup names and schedules  
- Include validation for backup directory permissions
- Add progress indicators for large databases

Closes #123

Pull Request Process

Before Submitting

  • Test Thoroughly: Ensure all tests pass and add new tests if needed
  • Update Documentation: Update relevant documentation for your changes
  • Check Code Style: Run linting and formatting tools
  • Small Focused Changes: Keep PRs focused on a single feature or fix

PR Description Template

## Description
Brief description of changes and why they were made

## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring

## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
- [ ] New tests added (if applicable)

## Related Issues
Closes #123
Related to #456

## Screenshots (if applicable)
Add screenshots for UI changes

## Checklist
- [ ] My code follows the project's coding standards
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or my feature works
- [ ] New and existing unit tests pass locally with my changes

Documentation Contributions

Documentation Structure

docs/
├── installation/          # Installation guides
├── quick-start/           # Getting started guide
├── configuration/         # Configuration options
├── api-reference/         # API documentation
├── tutorials/            # Step-by-step tutorials
├── examples/             # Code examples
├── troubleshooting/      # Common issues and solutions
├── contributing/         # This guide
└── faq/                  # Frequently asked questions

Writing Guidelines

  • Clear and Concise: Write in simple, clear language
  • Step-by-Step: Break complex processes into steps
  • Include Examples: Provide working code examples
  • Test Instructions: Verify that all instructions work
  • Keep Updated: Ensure documentation matches current code

Documentation Style

# Page Title

Brief introduction explaining what this page covers and why it's useful.

## Section Heading

Descriptive text explaining the concept or feature.

### Subsection

More detailed information with examples:

```bash
# Command examples with comments
nself init my-project
cd my-project
nself up
```

> **Note**: Important information that users should be aware of.

> **Warning**: Critical information about potential issues or breaking changes.

## Code Examples

Provide complete, working examples:

```typescript
// Complete example with imports
import { ConfigManager } from '@/lib/config';

const config = new ConfigManager();
await config.load('.env.local');
```

## Next Steps

Link to related documentation:

- [Configuration Guide](/docs/configuration)
- [Production Setup](/docs/production)
- [Troubleshooting](/docs/troubleshooting)

Community Contributions

Helping in Discussions

  • Answer Questions: Share your knowledge and experience
  • Share Examples: Provide working examples for common use cases
  • Be Patient and Kind: Remember everyone is learning
  • Point to Resources: Direct users to relevant documentation

Creating Content

  • Blog Posts: Write about your experience using nself
  • Tutorials: Create step-by-step guides for specific use cases
  • Videos: Record screencasts showing nself in action
  • Examples: Build and share example applications

Release Process

Versioning

nself uses semantic versioning (SemVer):

  • MAJOR: Breaking changes
  • MINOR: New features, backward compatible
  • PATCH: Bug fixes, backward compatible

Release Schedule

  • Major Releases: Every 6-12 months
  • Minor Releases: Monthly or when significant features are ready
  • Patch Releases: As needed for critical bug fixes
  • Security Releases: Immediately for security issues

Code of Conduct

Our Standards

We are committed to providing a welcoming and inclusive environment for everyone:

Positive behaviors:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Unacceptable behaviors:

  • Harassment, trolling, or inflammatory comments
  • Personal attacks or insults
  • Publishing private information without permission
  • Spam or off-topic content
  • Any conduct that would be inappropriate in a professional setting

Enforcement

Violations of the code of conduct should be reported to conduct@nself.org. All reports will be handled confidentially and fairly.

Recognition

Contributor Recognition

  • Contributors Page: All contributors are listed on the project website
  • Release Notes: Significant contributions are highlighted in release notes
  • Social Media: Contributors are thanked on social media channels
  • Swag: Active contributors may receive nself merchandise

Maintainer Path

Regular contributors who demonstrate expertise and commitment may be invited to become maintainers with additional responsibilities:

  • Review and merge pull requests
  • Triage issues and manage the project backlog
  • Guide project direction and technical decisions
  • Mentor new contributors

Resources for Contributors

Development Resources

  • Architecture Overview: Understanding nself's architecture
  • API Documentation: Internal API documentation for developers
  • Testing Guide: How to write and run tests
  • Debugging Guide: Debugging tips and tools

Communication Channels

  • GitHub Discussions: General questions and feature discussions
  • GitHub Issues: Bug reports and tracked feature requests
  • Pull Requests: Code review and discussion
  • Maintainer Chat: Private channel for maintainers

Frequently Asked Questions

How do I get started contributing?

Look for issues labeled "good first issue" in the GitHub repository. These are specifically chosen to be approachable for new contributors.

Do I need to be an expert to contribute?

Not at all! Contributions at all skill levels are welcome. Even fixing typos or improving documentation is valuable.

How long does it take for PRs to be reviewed?

We aim to review PRs within 1-2 weeks, but it may take longer for complex changes. Maintainers are volunteers with limited time.

Can I work on multiple issues at once?

It's best to focus on one issue at a time, especially when starting out. This helps ensure quality and prevents conflicts.

What if my PR is rejected?

Don't take it personally! Reviewers will provide feedback on why changes are needed. Most PRs require some iteration before being merged.

Thank You!

Every Contribution Matters

Whether you fix a typo, answer a question, or implement a major feature, your contributions make nself better for everyone. Thank you for being part of our community!

Next Steps

Ready to contribute? Here's how to get started:

  1. Choose Your Contribution Type: Code, documentation, or community support
  2. Set Up Development Environment: Follow the setup instructions above
  3. Find Your First Issue: Look for "good first issue" labels
  4. Join the Community: Participate in GitHub Discussions
  5. Start Small: Begin with small contributions and work your way up

We're excited to have you as part of the nself community. Every contribution, no matter how small, helps make nself better for developers everywhere.