---
title: "proxymock CLI overview | Speedscale Docs"
description: "Learn the proxymock CLI workflow for recording traffic, mocking dependencies, and replaying tests, with links to installation, quickstart, and command reference."
canonical: "https://docs.speedscale.com/proxymock/how-it-works/cli/"
---

[Documentation index](https://docs.speedscale.com/proxymock/llms.txt) | [Markdown](https://docs.speedscale.com/proxymock/how-it-works/cli/index.md) | [Canonical page](https://docs.speedscale.com/proxymock/how-it-works/cli/)

# proxymock CLI overview

<a id="overview"></a>

## Overview

`proxymock` records traffic, mocks dependencies, and replays tests. Start with the local workflow below, then use the same CLI for [Kubernetes](https://docs.speedscale.com/proxymock/guides/cluster/), [BYOC traffic](https://docs.speedscale.com/byoc/use-traffic/), or [cloud replays](https://docs.speedscale.com/proxymock/guides/replay-paths/).

If you are choosing between proxymock and speedctl, see [Command-line tools: proxymock and speedctl](https://docs.speedscale.com/getting-started/command-line-tools/).

For complete getting started instructions, see [proxymock CLI quickstart](https://docs.speedscale.com/proxymock/getting-started/quickstart/quickstart-cli/). To learn how it works, see [Architecture](https://docs.speedscale.com/proxymock/how-it-works/architecture/). For the full command list, flags, subcommands, and examples, see [proxymock CLI reference](https://docs.speedscale.com/reference/proxymock-cli-reference/).

`proxymock` can record, mock, and replay locally for free, and it also works with Speedscale Enterprise to record from remote systems such as Kubernetes clusters and integrate into CI/CD workflows.

<a id="recommended-workflow"></a>

## Recommended workflow

Most users will want to:

1.  Use `proxymock record` to start recording.
2.  Start the app with the appropriate proxy environment variables set, or let `proxymock` wrap the app directly.
3.  Exercise the app so it calls remote systems.
4.  Inspect the traffic you recorded with `proxymock web`.
5.  Run `proxymock mock` to serve mock responses.
6.  Exercise the app again against the mock server, or replay captured traffic with `proxymock replay`.

<a id="core-commands"></a>

## Core commands

*   `proxymock record` captures inbound and outbound traffic as RRPair files.
*   `proxymock mock` serves mock responses for outbound traffic.
*   `proxymock replay` sends recorded test traffic back to your app.
*   `proxymock web` opens a local web UI for exploring recorded traffic.

<a id="how-it-works"></a>

## How it works

`proxymock` records and mocks traffic by running smart proxies that store and forward requests and responses.

*   `record` creates an inbound proxy in front of your app and an outbound proxy behind it.
*   `mock` creates the outbound proxy used to match requests and return mock responses.
*   `replay` acts as the client and sends captured requests back to your app.

<a id="proxy-behavior-and-caveats"></a>

## Proxy behavior and caveats

When a proxy connection arrives, the requested destination or host is checked against the mocked endpoints contained in the loaded mock data. If the destination is known, the request is routed to the appropriate responder. If it is not known, the request bypasses the responder and goes directly to the intended endpoint.

You will see this behavior in proxymock output as:

*   `MATCH` - the request matched a known mock endpoint
*   `PASSTHROUGH` - the request bypassed the responder and went to the real endpoint

Choosing between HTTP and SOCKS proxying is application-specific. For mocks that contain only HTTP or HTTPS traffic, use the HTTP proxy:

```bash
export http_proxy=http://localhost:4140
export https_proxy=http://localhost:4140
export grpc_proxy=http://$(hostname):4140
```

To capture database traffic, use the SOCKS proxy:

```bash
export all_proxy=socks5h://localhost:4140
```

If proxy environment variables are not enough for your client, use `--map` and point your app at the mapped local port instead.

See [Language Reference](https://docs.speedscale.com/proxymock/getting-started/language-reference/) for language-specific examples.

<a id="testing-mock-responses-with-curl"></a>

## Testing mock responses with curl

When testing mock responses with `curl`, use `-k` / `--insecure` to trust the responder certificate and `-x` / `--proxy` to send the request to the responder without changing the request hostname.

```bash
curl -k -x http://localhost:4140 https://example.com/path/to/resource
```

You can also send `curl` requests directly to the provider endpoints that `proxymock mock` starts and skip the proxy flag entirely. Use the ports printed when `proxymock mock` starts to find those endpoints.

<a id="full-cli-reference"></a>

## Full CLI reference

For the full command reference, see [proxymock CLI reference](https://docs.speedscale.com/reference/proxymock-cli-reference/).
