aurganize-backend/.github/CONTRIBUTING.md

5.3 KiB

Contributing to Aurganize V6.2

Thank you for contributing to Aurganize! This document provides guidelines and instructions for contributing to the project.

📋 Table of Contents

🤝 Code of Conduct

  • Be respectful and inclusive
  • Provide constructive feedback
  • Accept constructive criticism gracefully
  • Focus on what is best for the project

🚀 Getting Started

  1. Fork the repository
  2. Clone your fork:
   git clone https://github.com/YOUR_USERNAME/aurganize-v62.git
   cd aurganize-v62
  1. Add upstream remote:
   git remote add upstream https://github.com/yourorg/aurganize-v62.git
  1. Setup development environment: Follow README.md

🔄 Development Workflow

1. Sync with Upstream

git checkout develop
git fetch upstream
git merge upstream/develop
git push origin develop

2. Create Feature Branch

# Branch from develop
git checkout develop
git checkout -b feature/your-feature-name

Branch naming conventions:

  • feature/ - New features
  • bugfix/ - Bug fixes
  • hotfix/ - Urgent production fixes
  • refactor/ - Code refactoring
  • docs/ - Documentation changes
  • test/ - Adding/improving tests

3. Make Changes

  • Write code following our coding standards
  • Write/update tests
  • Update documentation if needed
  • Test locally before committing

4. Commit Changes

git add .
git commit -m "feat: add user authentication"

See commit message guidelines below.

5. Push to Your Fork

git push origin feature/your-feature-name

6. Create Pull Request

  • Go to GitHub repository
  • Click "New Pull Request"
  • Select your feature branch
  • Fill out PR template completely
  • Request review from team members

📝 Coding Standards

Go (Backend)

Style Guide:

  • Follow Effective Go
  • Use gofmt for formatting
  • Use golangci-lint for linting

File Organization:

package handlers

// Imports grouped and sorted
import (
	"context"
	"fmt"

	"github.com/labstack/echo/v4"

	"github.com/yourorg/aurganize-v62/backend/internal/models"
)

// Constants first
const (
	DefaultTimeout = 30 * time.Second
)

// Types next
type AuthHandler struct {
	service *services.AuthService
}

// Constructor
func NewAuthHandler(service *services.AuthService) *AuthHandler {
	return &AuthHandler{service: service}
}

// Methods
func (h *AuthHandler) Login(c echo.Context) error {
	// Implementation
}

Naming Conventions:

  • Packages: lowercase, single word (e.g., handlers)
  • Files: lowercase, underscore-separated (e.g., auth_handler.go)
  • Functions: PascalCase for exported, camelCase for private
  • Variables: camelCase
  • Constants: PascalCase or SCREAMING_SNAKE_CASE for globals

Error Handling:

// Always check errors
result, err := someFunction()
if err != nil {
	return fmt.Errorf("failed to do something: %w", err)
}

// Use %w to wrap errors (enables errors.Is and errors.As)

Comments:

// Package-level comment
// package handlers provides HTTP request handlers for the API.
package handlers

// Exported functions must have doc comments
// Login handles user authentication requests.
// It validates credentials and returns a JWT token.
func Login(c echo.Context) error {
	// Implementation comments for complex logic
	// ...
}

TypeScript (Frontend)

Style Guide:

File Organization:

// Imports
import type { User } from '$lib/types';
import { authStore } from '$lib/stores/auth';

// Types/Interfaces
interface LoginForm {
	email: string;
	password: string;
}

// Constants
const MAX_LOGIN_ATTEMPTS = 5;

// Functions
export async function login(form: LoginForm): Promise<User> {
	// Implementation
}

Naming Conventions:

  • Files: kebab-case (e.g., auth-service.ts)
  • Components: PascalCase (e.g., LoginForm.svelte)
  • Functions: camelCase
  • Constants: SCREAMING_SNAKE_CASE
  • Types/Interfaces: PascalCase

Svelte Components:

<script lang="ts">
	// Props
	export let userId: string;
	export let showDetails = false;
	
	// Reactive declarations
	$: fullName = `${firstName} ${lastName}`;
	
	// Functions
	function handleClick() {
		// ...
	}
</script>

<div>
	<!-- Template -->
</div>

<style>
	/* Scoped styles */
</style>

SQL (Database)

Style:

  • Keywords in UPPERCASE
  • Table/column names in lowercase with underscores
  • Indent for readability
-- Good
SELECT 
    u.id,
    u.email,
    t.name AS tenant_name
FROM users u
INNER JOIN tenants t ON u.tenant_id = t.id
WHERE u.is_active = TRUE
ORDER BY u.created_at DESC;

-- Bad
select u.id, u.email, t.name from users u join tenants t on u.tenant_id=t.id where u.is_active=true;

💬 Commit Message Guidelines

We follow Conventional Commits.

Format