# Contributing Guide

Thank you for your interest in contributing to CDEIS Minerals!

## Code Standards

### JavaScript
- Use ES6+ syntax
- Use meaningful variable and function names
- Add JSDoc comments to functions
- Keep functions small and focused
- Maintain consistent indentation (2 spaces)

### Example Function Documentation

```javascript
/**
 * Processes user registration data
 * @param {Object} userData - User information
 * @param {string} userData.email - User email address
 * @param {string} userData.password - User password (will be hashed)
 * @returns {Object} Created user object (without password hash)
 * @throws {Error} If email already exists or data is invalid
 */
function createUser(userData) {
  // Implementation
}
```

## Security Practices

- Never commit credentials or sensitive data
- Always use environment variables for configuration
- Validate and sanitize user input
- Use parameterized queries to prevent SQL injection
- Hash passwords with appropriate algorithms
- Keep dependencies updated

## Development Workflow

1. Create a feature branch:
   ```bash
   git checkout -b feature/your-feature-name
   ```

2. Make your changes and test thoroughly

3. Commit with clear messages:
   ```bash
   git commit -m "feat: add user email verification"
   git commit -m "fix: resolve session timeout issue"
   git commit -m "docs: update API documentation"
   ```

4. Push and create a pull request

## Commit Message Format

Follow conventional commits:

- `feat:` - New feature
- `fix:` - Bug fix
- `docs:` - Documentation only
- `style:` - Code style changes (formatting, etc.)
- `refactor:` - Code refactoring
- `test:` - Adding or updating tests
- `chore:` - Maintenance tasks

Example:
```
feat: add password strength validation

- Implement regex-based password validation
- Add requirements in UI and API
- Update documentation
```

## Testing

Before submitting:
1. Test all modified functionality manually
2. Verify no console errors in browser dev tools
3. Test on multiple browsers if applicable
4. Test with both valid and invalid data

## Code Review

All contributions require code review. Reviewers will check for:

- Code quality and standards
- Security implications
- Performance impact
- Documentation completeness
- Test coverage

## Reporting Issues

When reporting bugs, please include:

1. Clear description of the issue
2. Steps to reproduce
3. Expected vs actual behavior
4. Environment details (OS, browser, etc.)
5. Screenshots if applicable
6. Server logs if relevant

## Questions?

Feel free to open an issue to discuss improvements or ask questions!

## License

By contributing, you agree that your contributions will be licensed under the same license as the project (Proprietary - CDEIS Lab).
