Problem
Rewriting a legacy API in one go is risky and delays value. Clients depend on its URLs and behaviour, so a big-bang cutover can break integrations with no easy rollback.
Also known as: api-strangler, incremental-api-migration
Replace a legacy API gradually by routing endpoints one at a time to a new implementation behind a stable facade.
Rewriting a legacy API in one go is risky and delays value. Clients depend on its URLs and behaviour, so a big-bang cutover can break integrations with no easy rollback.
Named after the fig that grows around a host tree, the strangler fig pattern grows a new API around an old one until the old one can be removed. Applied to APIs, the routing layer decides per endpoint which implementation answers.
A facade sits in front of both systems. Initially every route goes to legacy. Each migrated endpoint flips a rule.
client -> facade
/v1/orders/* -> new-orders-service (migrated)
/v1/invoices/* -> legacy-api (not yet)
/v1/customers/* -> 10% new, 90% legacy (canary)
A typical sequence: pick a low-risk, well-bounded endpoint; build it in the new system; run both and diff responses in shadow mode; route a small percentage; raise to 100 percent; remove the legacy code. Data ownership must be settled per slice, using either synchronisation, change data capture, or having the new service become the system of record.
Medium - parallel runtime
High - long migration and dual maintenance
Medium - routing and data sync
Migration stalls and the legacy system lives forever
Divergent behaviour between old and new endpoints
Shared database writes cause conflicting data