chapar

command module
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Chapar - Native API Testing Tool

Chapar is a fast, native API client for REST, gRPC, GraphQL and WebSocket, with a built-in proxy for inspecting the traffic of other apps. It is written in Go and draws its UI with Yoga, a GPU-rendered (WebGPU) UI toolkit, so it starts quickly, stays light, and runs the same on macOS, Linux and Windows without a browser engine. Your requests, environments and cookies are plain files on your machine: no account, no cloud sync, nothing sent anywhere you did not ask for.

MQTT is next on the list.

What Chapar means?

Chapar was the institution of the royal mounted couriers in ancient Persia. The messengers, called Chapar, alternated in stations a day's ride apart along the Royal Road. The riders were exclusively in the service of the Great King and the network allowed for messages to be transported from Susa to Sardis (2699 km) in nine days; the journey took ninety days on foot.

Herodus described the Chapar as follows:

There is nothing in the world that travels faster than these Persian couriers. Neither snow, nor rain, nor heat, nor darkness of night prevents these couriers from completing their designated stages with utmost speed.

Herodotus, about 440 BC

Screenshots

The screenshots use the Tokyo Night theme and the free Chapar mock server (mocks.chapar.rest), which you can use to try every feature below.

REST request and response JSON request body gRPC request GraphQL request WebSocket request and message log Proxy capturing HTTPS traffic Proxy certificate setup Python post-request script Request timeline A test case run A failed test case step Environments Cookie jar Workspaces Settings Command palette

Features

Protocols
  • REST / HTTP: every method, query and path params, JSON, XML, text, form-data, URL-encoded and binary bodies, with syntax highlighting and formatting.
  • gRPC: server reflection or proto files, unary and server-streaming methods, metadata and trailers, TLS and client certificates, and a sample message for any method.
  • GraphQL: queries and variables, with the response data and errors split out.
  • WebSocket: connect, send text, JSON or binary messages and save them to resend, and watch everything that arrives in a filterable log. Subprotocols, pings, compression, headers and auth like HTTP requests.
Proxy
  • Capture traffic from apps, browsers and phones through a built-in HTTP(S) proxy, and see each request and response side by side.
  • Filter by app or domain, by protocol and content type, or search; pin what you care about and skip domains you don't want decrypted.
  • Open in Chapar turns a captured request into a request you can edit and send. Copy as cURL and Export HAR take traffic elsewhere.
  • Easy certificate setup: Chapar makes its own certificate authority, trusts it in one click on macOS, and checks every step. Phones get the certificate and instructions from http://chapar.mitm.
  • Chapar never changes your system's proxy settings, and the proxy only runs while you have it started.
Workflow
  • Workspaces keep separate collections, requests and environments; switch between them from the title bar.
  • Collections share headers, auth and notes with every request inside them.
  • Environments hold variables you use as {{name}} anywhere in a request. Values you mark secret are encrypted with a key kept in the OS keychain, and stored on your machine only: the environment file names a secret but leaves its value out, so a workspace can be shared (in git, say) without its secrets.
  • Cookie jar per environment: cookies from responses are stored and sent back automatically, and you can view, edit, add or clear them.
  • Auth: Basic, Bearer token and API key, set per request or inherited from the collection.
  • Pre and post-request actions: run another request first, extract values from the response body, headers or cookies into the environment, or write Python scripts with tests and logs.
  • Test cases send your requests in order, check their responses (status, headers, JSON paths, timing and more) and pass values from one step to the next, with setup, teardown and retries. Run them in the app, or in CI with chapar-cli.
  • Timeline of every request: DNS, connect, TLS, time to first byte, scripts.
  • Code generation for cURL, Python, Go, JavaScript (fetch, axios), Java and Kotlin (OkHttp), Ruby and .NET.
  • Import Postman collections, OpenAPI specs and proto files.
  • Command palette (⌘K / Ctrl+K) to open any request, collection or environment and run any command.
Editor and app
  • Code editors with language-server completion and diagnostics (Python out of the box; JSON, XML, Go, JavaScript and more in Settings).
  • Themes, including Tokyo Night, Catppuccin, Dracula, Nord, Gruvbox, One, Solarized and GitHub.
  • Side-by-side or stacked request/response layout, a console panel and a notification history.
  • Everything is stored as YAML files, so a workspace can live in git.
Roadmap
  • MQTT support.
  • Tunneling to servers and Kubernetes clusters as pre-request actions.
Getting Started

To Get started with Chapar, you can download the latest release from the releases page. There you can find the latest release for your operating system.

Install on macOS

On macOS, you can install Chapar via Homebrew, download the latest release, or install from Apple's App Store.

Homebrew (recommended)

brew tap chapar-rest/chapar
brew install --cask chapar

To upgrade to the latest version:

brew upgrade --cask chapar

App Store

Download on the App Store

Note that the App Store version is running in a sandbox environment and if you are already using the downloaded or custom build version, you need to copy your data to the sandbox environment. you can do it by running the following command:
cp -r $HOME/.config/chapar $HOME/Library/Containers/rest.chapar.app/Data/.config

or make a symlink to the sandbox environment:

ln -s $HOME/.config/chapar $HOME/Library/Containers/rest.chapar.app/Data/.config
Install From AUR

On Arch-based distros, you can install Chapar from the AUR using your favorite AUR helper:

yay -S chapar-bin

Please note that AUR package is maintained by a community contributor. (@Monirzadeh ) may not be up to date with the latest release.

Command-line runner (chapar-cli)

chapar-cli runs test cases without the app, for CI or any machine without a screen. It is a single static binary for Linux, macOS and Windows.

# Linux and macOS
curl -fsSL https://github.com/chapar-rest/chapar/releases/latest/download/install-cli.sh | sh

# or with Homebrew
brew install chapar-rest/chapar/chapar-cli

On Windows, download chapar-cli-windows-*.zip from the releases page. Pin a version with sh -s -- -v v0.8.0, or pick the install directory with -b DIR.

Run a workspace committed to your repo, or a test case exported from the app (Export, in the test case's title row):

chapar-cli test --workspace path/to/workspace --env staging --report junit=results.xml
chapar-cli test smoke.chapar-test.yaml --os-env API_ --var base=https://staging.example.com

In GitHub Actions:

- name: Install chapar-cli
  run: curl -fsSL https://github.com/chapar-rest/chapar/releases/latest/download/install-cli.sh | sh -s -- -b "$HOME/.local/bin"
- name: Run API tests
  run: chapar-cli test --workspace api-tests --env ci --report junit=results.xml
  env:
    API_TOKEN: ${{ secrets.API_TOKEN }}

chapar-cli test -h lists every flag. It exits with 0 when all cases pass, 1 when one does not, and 2 for bad flags or files.

Install From Source

To install Chapar from source, clone the repository install the dependencies, and run the application using the following commands:

git clone https://github.com/chapar-rest/chapar.git
cd chapar
go build -o chapar .
go build -o chapar-cli ./cmd/chapar-cli   # the command-line runner

To build the same packages the releases ship (DMG, tar.xz, zip), install the Yoga CLI with make install_deps (the version go.mod uses); yoga.toml holds the packaging config:

yoga package -os darwin -arch arm64 -version v0.7.0   # dist/darwin/*.dmg
yoga package -os linux -version v0.7.0                # dist/linux/*.tar.xz
yoga package -os windows -version v0.7.0              # dist/windows/*.zip

Dependencies are vendored. Update them with make vendor, not go mod vendor: the script also copies the tree-sitter C sources that go mod vendor leaves out.

Dependencies

Chapar is built with Yoga, which renders through GLFW and WebGPU, so building needs CGO and a C compiler:

  • macOS: Xcode Command Line Tools (xcode-select --install).
  • Linux (Debian/Ubuntu): sudo apt install gcc libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libgl1-mesa-dev.
  • Windows: a MinGW-w64 GCC on PATH (for example from MSYS2).

Tests run headless with go test -tags nogpu ./..., which needs no window system.

Contributing

Contributions are welcome! If you have ideas, feedback, or wish to contribute, please open an issue or submit a pull request.

Support the Project

You can support the development of Chapar by starring the repository, sharing it with your friends, and contributing to the project. Also you can support the project by donating to the project's wallet.

Supporters

JetBrains generously granted me a year of their open-source support licenses to work on this project.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
build
updatesign command
Command updatesign makes and uses the key that signs release assets, so Chapar's in-app updater can tell a real release from a tampered one.
Command updatesign makes and uses the key that signs release assets, so Chapar's in-app updater can tell a real release from a tampered one.
cmd
chapar-cli command
Command chapar-cli runs Chapar test cases from the command line, without the app: in CI, or anywhere a window cannot open.
Command chapar-cli runs Chapar test cases from the command line, without the app: in CI, or anywhere a window cannot open.
internal
cookies
Package cookies keeps per-environment cookie jars that follow RFC 6265 matching rules and can be listed and edited, unlike net/http/cookiejar.
Package cookies keeps per-environment cookie jars that follow RFC 6265 matching rules and can be listed and edited, unlike net/http/cookiejar.
egress/websocket
Package websocket opens WebSocket connections for WebSocket requests.
Package websocket opens WebSocket connections for WebSocket requests.
gitx
Package gitx runs the system git binary for a workspace.
Package gitx runs the system git binary for a workspace.
secret
Package secret encrypts environment values that the user marked as secret, so they never reach disk in plain text.
Package secret encrypts environment values that the user marked as secret, so they never reach disk in plain text.
testcli
Package testcli is the `chapar-cli test` command: it runs a workspace's test cases without the UI, for CI.
Package testcli is the `chapar-cli test` command: it runs a workspace's test cases without the UI, for CI.
testrun
Package testrun runs test cases and checks their responses.
Package testrun runs test cases and checks their responses.
update
Package update finds out whether a newer Chapar release is out, and downloads, verifies and installs it where the platform allows.
Package update finds out whether a newer Chapar release is out, and downloads, verifies and installs it where the platform allows.
yamlmerge
Package yamlmerge merges three versions of a workspace YAML file field by field, the way git merges lines.
Package yamlmerge merges three versions of a workspace YAML file field by field, the way git merges lines.
ui
container/testcase
Package testcase is the editor of a test case: its steps, variables and settings, as a form or as YAML, with the results of its last run.
Package testcase is the editor of a test case: its steps, variables and settings, as a form or as YAML, with the results of its last run.
container/websocket
Package websocket is the editor for WebSocket requests: a connection the user opens, sends messages on, and watches.
Package websocket is the editor for WebSocket requests: a connection the user opens, sends messages on, and watches.
cookieui
Package cookieui is the dialog for viewing and editing environment cookie jars.
Package cookieui is the dialog for viewing and editing environment cookie jars.
langsrv
Package langsrv decides which language servers Chapar runs, and when.
Package langsrv decides which language servers Chapar runs, and when.
scriptsrv
Package scriptsrv owns the scripting executor that runs pre/post-request scripts: it starts, stops and restarts it, and reports its state.
Package scriptsrv owns the scripting executor that runs pre/post-request scripts: it starts, stops and restarts it, and reports its state.
secretui
Package secretui holds the dialogs that set up, unlock and show the key that encrypts secret environment values.
Package secretui holds the dialogs that set up, unlock and show the key that encrypts secret environment values.
vars
Package vars offers the template variables an input can complete, and paints the placeholders that name them.
Package vars offers the template variables an input can complete, and paints the placeholders that name them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL