Development Workflow
Getting Started
Clone and install dependencies
Clone the repository and install dependencies using Yarn:
While it’s possible to use
npm, the project tooling is built around yarn, so you’ll have an easier time using Yarn for development.Bootstrap the project
Run the bootstrap command to set up all packages and build the whisper.cpp submodule:This command:
- Installs dependencies for all packages
- Builds the whisper.cpp native library
- Sets up the example app
Development Tips
JavaScript/TypeScript changes
JavaScript/TypeScript changes
Any changes to JavaScript or TypeScript code will be reflected in the example app without a rebuild. Just reload the app:
- iOS: Cmd+R in simulator
- Android: Double-tap R or Cmd+M > Reload
Native code changes
Native code changes
If you modify native code (Objective-C, Swift, Java, Kotlin, C++), you’ll need to rebuild:
Testing performance
Testing performance
Always test transcription performance in Release mode:Debug builds are significantly slower and don’t represent actual performance.
Editing Native Code
iOS: Objective-C and Swift
iOS: Objective-C and Swift
Open the example app workspace in Xcode:Find the library source files at:
- Pods > Development Pods > whisper-rn
Android: Java and Kotlin
Android: Java and Kotlin
Open the example Android project in Android Studio:Find the library source files at:
- Android > whisper.rn (in project view)
C++ core files
C++ core files
C++ files are located in the
cpp/ directory:cpp/rn-whisper.cpp/h- Main whisper integrationcpp/rn-audioutils.cpp/h- Audio utilitiescpp/jsi/- JSI bindings for ArrayBuffer support
Code Quality
Linting and Type Checking
Before committing, ensure your code passes all checks:Pre-commit hooks will automatically verify that linting and tests pass before allowing a commit.
Commit Message Convention
We follow the Conventional Commits specification: Format:-
feat:- New features -
fix:- Bug fixes -
refactor:- Code refactoring -
docs:- Documentation changes -
test:- Adding or updating tests -
chore:- Tooling and configuration changes
Testing
Unit Tests
Run the test suite:Test Coverage
Generate coverage report:Using Mock in Your Tests
whisper.rn provides a Jest mock for testing:Available Scripts
Thepackage.json includes these development scripts:
| Script | Description |
|---|---|
yarn bootstrap | Setup project by installing all dependencies |
yarn build | Build TypeScript library |
yarn typecheck | Type-check files with TypeScript |
yarn lint | Lint files with ESLint |
yarn lint --fix | Fix linting errors automatically |
yarn test | Run unit tests with Jest |
yarn docgen | Generate API documentation |
yarn example start | Start Metro server for example app |
yarn example android | Run example app on Android |
yarn example ios | Run example app on iOS |
yarn example pods | Install iOS pods for example app |
yarn release | Publish new version (maintainers only) |
Submitting Pull Requests
First time contributing to open source? Learn from this free series: How to Contribute to an Open Source Project on GitHub
Before Submitting
Create a focused PR
Prefer small pull requests focused on one change. This makes review easier and faster.
- One bug fix per PR
- One feature per PR
- Related changes can be grouped together
Test thoroughly
- Test on both iOS and Android if applicable
- Test in Release mode for performance changes
- Add unit tests for new functionality
- Test with the example app
PR Guidelines
For API or implementation changes
For API or implementation changes
Discuss with maintainers first by opening an issue before starting work.This ensures:
- Your approach aligns with project goals
- No duplicate work is being done
- Design can be discussed before implementation
Follow the PR template
Follow the PR template
When opening a pull request, fill out the template completely:
- What: Describe what the PR does
- Why: Explain why this change is needed
- How: Describe your implementation approach
- Testing: Explain how you tested the changes
- Screenshots: Include for UI changes
- Checklist: Complete all items
Keep PRs up to date
Keep PRs up to date
If the main branch changes during review:Resolve any conflicts and push:
Review Process
- Automated checks run on every PR (CI, linting, tests)
- Maintainer review - A maintainer will review your code
- Requested changes - Address any feedback
- Approval - Once approved, a maintainer will merge
Be patient during review. Maintainers are volunteers and may take time to respond.
Publishing (Maintainers Only)
To publish a new version:- Bump version based on semver
- Create git tags
- Generate changelog
- Publish to npm
- Create GitHub release
Project Structure
Understanding the codebase:Getting Help
If you need help contributing:- Check existing issues - Your question might already be answered
- Ask in discussions - Use GitHub Discussions for questions
- Join the community - Connect with other contributors
- Read the docs - Check documentation for guidance
Code of Conduct
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to:- Be respectful and inclusive
- Accept constructive criticism
- Focus on what’s best for the community
- Show empathy towards others