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
- Fork the repository on GitHub
- Clone your fork to your local machine:
git clone https://github.com/yourusername/open-ethereum-indexer-new.git
cd open-ethereum-indexer-new
- Install dependencies:
pnpm install
- Build the project:
pnpm build
- 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:
- A clear and descriptive title
- Steps to reproduce the bug
- Expected behavior
- Actual behavior
- Environment information (OS, Node.js version, etc.)
Suggesting Enhancements
We love hearing about new ideas! To suggest an enhancement:
- Create an issue on GitHub with the label "enhancement"
- Clearly describe the feature/enhancement
- Explain why this would be valuable to the project
- If possible, outline how it might be implemented
Pull Requests
We follow a standard GitHub flow for contributions:
- Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bugfix-name
- Make your changes, following the code style and guidelines
- Write tests for your changes
- Run the tests to ensure everything passes:
pnpm test
- 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"
- Push your branch to your fork:
git push origin feature/your-feature-name
- 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:
- In one terminal, run
pnpm dev
to watch and rebuild core packages - 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:
- Create a new directory in
examples/
:
mkdir examples/my-new-example
- Set up the basic structure (use an existing example as a template)
- Add a README.md explaining the purpose and usage of the example
- Add documentation in
docs/pages/examples/
for your example
Documentation
When adding new features, please also update the relevant documentation:
- Add or update the appropriate page in
docs/pages/
- If it's a major feature, consider adding an example demonstrating its use
Getting Help
If you need help with your contribution:
- Check the documentation
- 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.