Skip to content

Latest commit

 

History

History
156 lines (114 loc) · 3.72 KB

File metadata and controls

156 lines (114 loc) · 3.72 KB

Contributing to Streaming Backend

Thank you for your interest in contributing to Streaming Backend! We welcome contributions from the community.

Code of Conduct

This project follows a code of conduct to ensure a welcoming environment for all contributors. Please read our Code of Conduct before participating.

How to Contribute

Reporting Bugs

If you find a bug, please create an issue using the Bug Report template. Include:

  • A clear title and description
  • Steps to reproduce
  • Expected vs. actual behavior
  • Environment details (Go version, OS, etc.)
  • Screenshots if applicable

Suggesting Features

Feature requests are welcome! Use the Feature Request template and include:

  • A clear description of the feature
  • Why it would be useful
  • Any implementation ideas

Contributing Code

  1. Fork the repository on GitHub
  2. Clone your fork locally
  3. Create a feature branch from main:
    git checkout -b feature/your-feature-name
  4. Make your changes following our coding standards
  5. Add tests for new functionality
  6. Run tests to ensure everything works:
    go test ./...
  7. Commit your changes with clear, descriptive messages
  8. Push to your fork and create a Pull Request

Development Setup

Prerequisites

  • Go 1.22 or later
  • Git

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/streaming-backend.git
    cd streaming-backend
  2. Install dependencies:

    go mod tidy
  3. Copy environment file:

    cp .env.example .env
    # Edit .env with your TMDB API key for testing
  4. Run the server:

    go run cmd/server/main.go

Testing

  • Run unit tests: go test ./...
  • Run with race detection: go test -race ./...
  • Run with coverage: go test -cover ./...

Linting

We use golangci-lint for code quality. Run it locally:

golangci-lint run

Coding Standards

Go Code

  • Follow standard Go formatting (go fmt)
  • Use gofmt or goimports for imports
  • Write clear, concise comments for exported functions/types
  • Use meaningful variable and function names
  • Handle errors appropriately
  • Write tests for new functionality

Commit Messages

Use clear, descriptive commit messages:

feat: add rate limiting middleware
fix: handle empty TMDB responses
docs: update API documentation

Pull Requests

  • Use a clear title and description
  • Reference any related issues
  • Ensure CI checks pass
  • Keep PRs focused on a single feature/fix
  • Update documentation if needed

Project Structure

streaming-backend/
├── cmd/server/          # Application entry point
├── internal/
│   ├── cache/           # Caching logic
│   ├── handlers/        # HTTP handlers
│   ├── metrics/         # Metrics collection
│   └── middleware/      # HTTP middleware
├── public/              # Static assets
├── .github/             # GitHub templates and workflows
├── Dockerfile           # Container build
└── docs/                # Documentation

Testing Guidelines

  • Write unit tests for all new functions
  • Aim for good test coverage
  • Use table-driven tests where appropriate
  • Test error conditions
  • Mock external dependencies when possible

Documentation

  • Update README.md for significant changes
  • Add comments to exported functions
  • Update API documentation in code

Getting Help

  • Check existing issues and documentation first
  • Join our discussions for questions
  • Contact maintainers for sensitive matters

Thank you for contributing to Streaming Backend! 🎉