Contributing to Blazor .NET Template

Thank you for your interest in contributing to the Blazor .NET Template! This document provides guidelines and instructions for contributing.

Code of Conduct

This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please be respectful and constructive in all interactions.

How to Contribute

Reporting Bugs

If you find a bug, please create an issue on GitHub with:

Suggesting Enhancements

Enhancement suggestions are welcome! Please create an issue with:

Pull Requests

  1. Fork and Clone
    git clone https://github.com/YOUR-USERNAME/blazor-net-template.git
    cd blazor-net-template
    
  2. Create a Branch
    git checkout -b feature/your-feature-name
    
  3. Set up Git Hooks (Recommended)
    ./.githooks/install.sh
    

    This installs a pre-commit hook that automatically formats code before commits.

  4. Make Your Changes
    • Follow the existing code style
    • Add tests for new functionality
    • Update documentation as needed
    • Ensure all tests pass
  5. Test Your Changes
    dotnet test
    dotnet format --verify-no-changes
    
  6. Commit Your Changes
    git add .
    git commit -m "Add feature: description of your feature"
    

    Note: If you installed the pre-commit hook, code will be automatically formatted before commit.

  7. Push and Create PR
    git push origin feature/your-feature-name
    

    Then create a Pull Request on GitHub.

Development Guidelines

Setting Up Development Environment

The project includes helpful setup scripts for installing dependencies:

# Install all dependencies at once
./scripts/setup.sh

# Or install individually:
./scripts/install-dotnet10.sh    # .NET 10 SDK
./scripts/install-sqlite3.sh     # SQLite3
./scripts/install-mosquitto.sh   # MQTT broker
./scripts/install-docker.sh      # Docker and Docker Compose

Git Hooks

The project includes a pre-commit hook that automatically formats code:

# Install the git hooks
./.githooks/install.sh

After installation:

Docker Development

For development with Docker:

# Linux/macOS
./docker-dev.sh start    # Start containers
./docker-dev.sh logs     # View logs
./docker-dev.sh stop     # Stop containers

# Windows (PowerShell)
.\docker-dev.ps1 start
.\docker-dev.ps1 logs
.\docker-dev.ps1 stop

Code Style

Testing

Commit Messages

Example:

Add MQTT reconnection logic

- Implement exponential backoff for reconnection
- Add configuration for retry attempts
- Update tests to cover reconnection scenarios

Fixes #123

Documentation

Project Structure

blazor-net-template/
├── src/
│   └── BlazorNetApp.Api/          # Main application
├── tests/
│   ├── BlazorNetApp.Tests/        # Unit tests
│   └── BlazorNetApp.IntegrationTests/  # Integration tests
├── scripts/                        # Setup and install scripts
├── deployment/                     # Deployment files
├── .githooks/                      # Git hooks
├── .github/workflows/              # CI/CD workflows
├── .vscode/                        # VS Code configuration
├── Dockerfile                      # Docker image build
├── docker-compose.yml              # Docker Compose setup
├── docker-dev.sh/.ps1              # Docker dev scripts
└── rename-app.sh/Rename-App.ps1    # Rename scripts

Getting Help

Recognition

Contributors will be acknowledged in release notes and the project README.

Thank you for contributing! 🎉