In detail
Named after the strangler fig tree that grows around a host tree until it replaces it entirely, the Strangler Fig Pattern is a proven strategy for modernizing legacy systems without the risk of a 'big bang' rewrite. Instead of replacing the entire system at once, you gradually build new functionality in a modern system while routing traffic through a facade. Over time, more and more requests are handled by the new system until the legacy system can be safely decommissioned. This minimizes risk, allows incremental delivery of value, and keeps the existing system running throughout the migration.
How it works
- 1
Facade Introduction
A routing layer (API gateway, reverse proxy) is placed in front of the legacy system to intercept all requests.
- 2
Feature Extraction
Individual features or routes are reimplemented in the new system, one at a time.
- 3
Traffic Routing
The facade routes requests for migrated features to the new system; everything else goes to legacy.
- 4
Legacy Decommission
Once all features are migrated, the legacy system is turned off and the facade simplified or removed.
Where it is used
- Monolith to Microservices
- Gradually extracting services from a monolithic application into independently deployable microservices.
- Framework Migration
- Moving from an older framework (e.g., AngularJS) to a modern one (e.g., React) page by page.
- Database Migration
- Transitioning from a legacy database to a modern one by routing reads/writes through a data access layer.