Contributing

Contributing

Contributions to the Open Ethereum Indexer project are welcome! This guide will help you understand how to contribute to the project effectively.

Getting Started

Setting Up the Development Environment

  1. Fork the repository on GitHub
  2. Clone your fork to your local machine:
git clone https://github.com/yourusername/open-ethereum-indexer-new.git
cd open-ethereum-indexer-new
  1. Install dependencies:
pnpm install
  1. Build the project:
pnpm build
  1. Run the tests:
pnpm test

Project Structure

The project is organized as a monorepo with the following structure:

open-ethereum-indexer-new/
├── packages/
│   └── indexer/            # Core indexer package
├── examples/               # Example applications
│   ├── basic-example/
│   ├── block-notifier/
│   └── ...
├── docs/                   # Documentation site
└── tests/                  # Integration tests

How to Contribute

Reporting Bugs

If you find a bug, please report it by creating an issue on GitHub. When reporting bugs, please include:

  1. A clear and descriptive title
  2. Steps to reproduce the bug
  3. Expected behavior
  4. Actual behavior
  5. Environment information (OS, Node.js version, etc.)

Suggesting Enhancements

We love hearing about new ideas! To suggest an enhancement:

  1. Create an issue on GitHub with the label "enhancement"
  2. Clearly describe the feature/enhancement
  3. Explain why this would be valuable to the project
  4. If possible, outline how it might be implemented

Pull Requests

We follow a standard GitHub flow for contributions:

  1. Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bugfix-name
  1. Make your changes, following the code style and guidelines
  2. Write tests for your changes
  3. Run the tests to ensure everything passes:
pnpm test
  1. Commit your changes with a descriptive commit message using Conventional Commits (opens in a new tab):
git commit -m "feat: add new feature X"
# or
git commit -m "fix: resolve issue with Y"
  1. Push your branch to your fork:
git push origin feature/your-feature-name
  1. Create a pull request against the main branch of the main repository

Code Style and Guidelines

  • We use TypeScript for type safety
  • Follow the existing code style (enforced by ESLint and Prettier)
  • Write clear, commented code
  • Maintain backward compatibility where possible
  • Write unit tests for new features and bug fixes

Development Workflow

Development Mode

To develop the core packages and documentation with automatic rebuilding on changes:

pnpm dev

This command will start watchers for all core packages and documentation that will rebuild whenever files change.

To run an example application in development mode:

cd examples/basic-example
pnpm start:dev

For the most efficient workflow when working on both core packages and examples:

  1. In one terminal, run pnpm dev to watch and rebuild core packages
  2. If you make changes to core packages, restart your example application to pick up those changes

Running Tests

Run all tests:

pnpm test

Run specific tests:

pnpm test -- -t "feature name"

Building Documentation

To build and run the documentation locally:

cd docs
pnpm install
pnpm dev

The documentation will be available at http://localhost:3410 (opens in a new tab).

Creating New Examples

We encourage contributors to create new examples! To add a new example:

  1. Create a new directory in examples/:
mkdir examples/my-new-example
  1. Set up the basic structure (use an existing example as a template)
  2. Add a README.md explaining the purpose and usage of the example
  3. Add documentation in docs/pages/examples/ for your example

Documentation

When adding new features, please also update the relevant documentation:

  1. Add or update the appropriate page in docs/pages/
  2. If it's a major feature, consider adding an example demonstrating its use

Getting Help

If you need help with your contribution:

  1. Check the documentation
  2. Open a discussion on GitHub

License

By contributing to the Open Ethereum Indexer, you agree that your contributions will be licensed under the project's MIT License.