Contributing Guidelines
This guide covers how to contribute to the HostingCo system, including development setup, coding standards, and the contribution process.
Welcome!
Thank you for your interest in contributing to HostingCo! This document provides guidelines and standards for contributing to the project.
Getting Started
Prerequisites
Node.js 18+ and npm 8+
PostgreSQL 15+
Redis 7+
Git
Basic knowledge of TypeScript, React, and Node.js
PostgreSQL 15+
Redis 7+
Git
Basic knowledge of TypeScript, React, and Node.js
First-Time Setup
1. Fork the Repository
# Fork the repository on GitHub
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/hostingco-system.git
cd hostingco-system
2. Set Up Development Environment
# Install dependencies
npm run install:all
# Set up environment
cp .env.example .env
# Start development servers
npm run dev
3. Configure Git Hooks
# Install pre-commit hooks
npm run setup:hooks
# Verify hooks are installed
npm run check:hooks
Development Workflow
Branch Strategy
main: Production-ready code
develop: Integration branch for features
feature/*: Feature branches
bugfix/*: Bug fix branches
hotfix/*: Critical fixes for production
develop: Integration branch for features
feature/*: Feature branches
bugfix/*: Bug fix branches
hotfix/*: Critical fixes for production
Creating a Feature Branch
# Create feature branch
git checkout -b feature/your-feature-name
# Make your changes
# Commit your work
git commit -m "feat: add your feature description"
# Push to your fork
git push origin feature/your-feature-name
Pull Request Process
- Create a pull request from your feature branch to
develop - Ensure all tests pass
- Request code review from team members
- Address feedback and make necessary changes
- Merge after approval
📝 Coding Standards
Code Style
TypeScript: Use TypeScript for all new code
ESLint: Follow ESLint configuration
Prettier: Use Prettier for code formatting
Conventional Commits: Follow conventional commit message format
ESLint: Follow ESLint configuration
Prettier: Use Prettier for code formatting
Conventional Commits: Follow conventional commit message format
File Naming
# Components
ComponentName.tsx # PascalCase for React components
componentName.test.tsx # Test files with .test suffix
componentName.styles.css # Styles with .styles suffix
# Utilities
utilityName.ts # camelCase for utility functions
utilityName.test.ts # Test files
# Types
types.ts # Type definitions
interfaces.ts # Interface definitions
Code Organization
// Import order
import React from 'react'; // React imports
import { useState, useEffect } from 'react'; // React hooks
import { Button } from './components'; // Local components
import { api } from '../services'; // Services
import { User } from '../types'; // Types
// Component definition
export const ComponentName: React.FC = () => {
// Hooks
const [state, setState] = useState<Type>(initialValue);
// Effects
useEffect(() => {
// Effect logic
}, [dependencies]);
// Event handlers
const handleClick = () => {
// Handler logic
};
// Render
return (
<div>
{/* JSX content */}
</div>
);
};
Testing Guidelines
Test Types
Unit Tests: Test individual functions and components
Integration Tests: Test component interactions
E2E Tests: Test complete user flows
Performance Tests: Test application performance
Integration Tests: Test component interactions
E2E Tests: Test complete user flows
Performance Tests: Test application performance
Writing Tests
// Component test example
import { render, screen, fireEvent } from '@testing-library/react';
import { Button } from './Button';
describe('Button Component', () => {
it('renders correctly', () => {
render(<Button>Click me</Button>);
expect(screen.getByText('Click me')).toBeInTheDocument();
});
it('handles click events', () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick}>Click me</Button>);
fireEvent.click(screen.getByText('Click me'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
});
Test Coverage
Target Coverage: 80% minimum
Critical Paths: 100% coverage required
Branch Coverage: All branches tested
Edge Cases: Error conditions tested
Critical Paths: 100% coverage required
Branch Coverage: All branches tested
Edge Cases: Error conditions tested
Documentation
Code Documentation
/**
* User service for managing user accounts
* @example
* // Create a new user
* const user = await userService.create({
* email: 'user@example.com',
* name: 'John Doe'
* });
*/
export class UserService {
/**
* Creates a new user account
* @param userData - User data to create account
* @returns Promise that resolves to created user
* @throws {ValidationError} When user data is invalid
*/
async create(userData: CreateUserDto): Promise<User> {
// Implementation
}
}
API Documentation
/**
* @api {post} /api/users Create User
* @apiName CreateUser
* @apiGroup Users
* @apiDescription Creates a new user account
* @apiParam {Object} userData User data
* @apiParam {String} userData.email User email
* @apiParam {String} userData.name User name
* @apiSuccess {Object} user Created user object
* @apiError {400} ValidationError Invalid user data
*/
🔀 Pull Request Guidelines
PR Requirements
Clear Description: Explain what and why
Testing: All tests must pass
Documentation: Update relevant docs
Breaking Changes: Clearly document any breaking changes
Testing: All tests must pass
Documentation: Update relevant docs
Breaking Changes: Clearly document any breaking changes
PR Template
## Description
Brief description of the changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] All tests pass
- [ ] New tests added
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or clearly documented)
Community Guidelines
Code of Conduct
Be Respectful: Treat everyone with respect
Be Inclusive: Welcome contributors of all backgrounds
Be Constructive: Provide helpful feedback
Be Professional: Maintain professional communication
Be Inclusive: Welcome contributors of all backgrounds
Be Constructive: Provide helpful feedback
Be Professional: Maintain professional communication
Getting Help
- Join our Discord server for real-time help
- Create an issue for bugs or questions
- Check existing documentation first
- Search for similar issues before creating new ones