Quick start
This takes about five minutes. You’ll run an old client that breaks against a new service, then fix it with two AfterPatch rules, without changing either side.
1. Get the program
Download the archive for your system from the download page and put aftermarket somewhere on your PATH. Check it works:
aftermarket version
The example below also needs a copy of the code repository and Go 1.24 or newer, because the example service and client are small Go programs:
git clone https://github.com/aftermarket-dev/aftermarket
cd aftermarket
2. Start the new service
go run ./examples/legacy-customer/service -listen 127.0.0.1:9000
It only knows the new API, GET /api/v2/customers/{id}, and it nests the customer under "customer" with renamed fields.
3. Watch the old client fail
In a second terminal:
go run ./examples/legacy-customer/client -base http://127.0.0.1:9000
The old client asks for /api/v1/customer?id=7 and gets a 404. Even if the path were right, the JSON would be in the wrong shape.
4. Put AfterPatch in between
aftermarket patch run --config examples/legacy-customer/rules.yaml \
--upstream http://127.0.0.1:9000 --listen 127.0.0.1:8080
Then point the old client at AfterPatch:
go run ./examples/legacy-customer/client -base http://127.0.0.1:8080
This time it prints old client got customer 7: Ada Lovelace. In the AfterPatch terminal, the audit log shows one line per change: the path rewrite on the way in, and the four JSON changes on the way out.
5. Read the rules
rules.yaml has two rules. The first sends /api/v1/customer?id=7 to /api/v2/customers/7. The second flattens the answer back into the shape the old client expects: customer.id becomes customer_id, customer.full_name becomes name, and so on.
6. Try it safely on your own traffic
Write your own rules, then check them:
aftermarket patch check --config my-rules.yaml
Run the proxy with --dry-run first. Traffic passes through unchanged, and the audit log shows what each rule would have changed. When the log looks right, drop the flag.
To lock a repair in, save a request and the answer you expect in a fixture file and run aftermarket patch test. It exits with an error if anything changes, so it fits in CI. The reference has the full rule and fixture format.