OpenRewrite

The open-source tool for automated code search, transformation, and modernization across the languages and frameworks you already rely on.

 Automated refactoring for real-world codebases

Artistic representation of OpenRewrite software using programmatic recipes to perform automated refactoring on source codeArtistic representation of OpenRewrite software using programmatic recipes to perform automated refactoring on source code

What is OpenRewrite?

OpenRewrite is an Apache-licensed open-source project that makes automated code transformation precise and repeatable. At its core is the Lossless Semantic Tree (LST), a compiler accurate representation of your code that enables recipes to search, analyze, and change code safely without breaking what it touches.

OpenRewrite is maintained by Moderne and contributed to by thousands of developers worldwide.

Recipes: The building blocks of automated change

Recipes are deterministic programs that navigate the LST to find and transform code. They range from simple fixes like renaming a method or updating a dependency, to complex multi-step migrations like upgrading from Spring Boot 2 to 3. Recipes are composable, testable, and community-maintained.

  • 5,000+ recipes available — covering Java, Python, YAML, Terraform, Kubernetes, and more
  • Composable — chain recipes together to build complex migration pipelines
  • Testable — every recipe ships with tests you can run and extend

OpenRewrite supports the languages and tools you already use

Go deeper into OpenRewrite

Understand the LST

The Lossless Semantic Tree is what makes OpenRewrite transformations safe and precise. Learn how it models your code and why it matters for accurate, repeatable changes.

Run your first recipe

Get recipes running in your existing build setup. Learn how to configure the OpenRewrite plugin, select recipes to run, and review changes before committing them.

Write your first recipe

Learn how to build a custom OpenRewrite recipe from scratch. Walk through the visitor pattern, write your transformation logic, and add tests to verify your changes.

Scale with the Moderne Platform

Ready to run recipes across hundreds of repositories at once? Take OpenRewrite to enterprise scale with multi-repo execution, PR management, and progress tracking.

Quotes pulled in from below hidden CMS block. This placeholder will only appear on the backend/editor. The final result is only visible on the live site.
This is some text inside of a div block.
For any framework or Java library creator, it [OpenRewrite] is a great way of creating an upgrade path for your framework, and also for forcing you to create an upgradable implementation as well.
Sergio Del Amoz
Micronaut Development Lead Engineer

Connect with the OpenRewrite community: