# Contributing Guide

Thank you for considering contributing to GoodGo Microservices Platform!

## Development Workflow

### Branch Strategy

We follow Git Flow:

- `main` - Production-ready code
- `develop` - Integration branch for features
- `feature/*` - New features
- `bugfix/*` - Bug fixes
- `hotfix/*` - Critical production fixes

### Commit Convention

We use [Conventional Commits](https://www.conventionalcommits.org/):

```bash
feat: add login endpoint
fix: resolve token expiration issue
docs: update API documentation
refactor: restructure auth module
test: add unit tests for auth service
chore: update dependencies
ci: add GitHub Actions workflow
perf: optimize database queries
```

### Pull Request Process

1. Create feature branch from `develop`
2. Implement changes with tests
3. Run linter and tests locally
4. Push and create PR
5. CI/CD will auto-run checks
6. Code review required
7. Merge into `develop` (auto-deploy to staging)
8. QA testing on staging
9. Merge into `main` (manual deploy to production)

### Code Standards

- **TypeScript**: Strict mode enabled
- **Linting**: ESLint with shared config
- **Formatting**: Prettier
- **Testing**: Minimum 80% coverage
- **Documentation**: JSDoc for public APIs

### Running Tests

```bash
# All tests
pnpm test

# Specific package
pnpm --filter @goodgo/iam-service test

# With coverage
pnpm --filter @goodgo/iam-service test:coverage
```

### Code Review Checklist

- [ ] Code follows style guidelines
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No console.logs or debug code
- [ ] Environment variables documented
- [ ] Breaking changes documented

## Adding a New Service

1. Copy `services/_template` to `services/new-service`
2. Update package.json name and dependencies
3. Implement service logic
4. Add tests
5. Update documentation
6. Create CI/CD workflow

## Adding a New Package

1. Create package in `packages/new-package`
2. Add to workspace
3. Export from index.ts
4. Add tests
5. Document usage

## Questions?

Feel free to open an issue or contact the maintainer:

- **Maintainer**: VelikHo
- **Email**: hongochai10@icloud.com
- **GitHub**: [@hongochai10](https://github.com/hongochai10)
