/akita-cli

The Akita CLI helps you make sense of API traffic. Passively watch API traffic with apidump. Model API behavior with apispec. Compare API behavior with apidiff.

Primary LanguageGoApache License 2.0Apache-2.0

Catch breaking changes faster

Akita builds models of your APIs to help you:

  • Catch breaking changes on every pull request, including added/removed endpoints, added/removed fields, modified types, modified data types
  • Check compliance with intended behavior
  • Auto-generate up-to-date API specs

In addition to recording traffic, Akita provides:

  • Path generalization for endpoints
  • Type and data format inference (docs)
  • Diffing across generated and uploaded API specs (docs)
  • Integrations with CI (docs) and source control (GitHub; GitLab)
  • Integrations with web frameworks to watch integration tests (docs)

See the full Akita docs here. Watch the first 5 minutes of this video for a demo.

Sign up for our private beta here.

About this repo | Running this repo | Plugins | Getting involved | Related links

About this repo

This is the open-source repository for the community version of our CLI, containing the code for:

  • apidump for listening to API traffic and generating HAR files
  • apispec for generating API specs from HAR files
  • apidiff for diffing API specs

The CLI is intended for use with the Akita SaaS tool: for instance, apispec communicates with the Akita backend to generate API specs. Note that this community version of the CLI does not include functionality for type and data format inference. This functionality is available only in the akita binary we distribute.

Running this repo

How to build

Running the following commands will generate the akita-cli binary:

  1. Install Go 1.15 or above.
  2. Install libpcap
    • For Homebrew on mac: brew install libpcap
    • For Ubuntu/Debian: apt-get install libpcap-dev
  3. make

How to test

  1. Install gomock: go get github.com/golang/mock/mockgen
  2. make test

How to use

If it's your first use, start by logging into Akita:

> ./bin/akita login
API Key ID: apk_0000000000000000000000
API Key Secret: ******************************
Login successful!
API keys stored in ${HOME}/.akita/credentials.yaml

You're now ready to run the Akita learn command to generate an API spec by watching traffic:

./bin/akita learn --service {service name} \
    --interface {network interface} \
    --port {port}

You should now see output that looks like this:

[INFO] Running learn mode on interface lo0
[INFO] Preview the learned API spec at https://app.akita.software/service/svc_4UxRRNmhL8R2MAqrmCmCvn/spec-preview/lrn_40lxi9tlHnfdiRsBzXYbBY
[INFO] Send SIGINT (Ctrl-C) to stop...

For more information, see the docs: QuickStart: Server APIs; apidump; apispec; learn; apidiff.

Getting involved

  • Please file bugs as issue to this repository.
  • We welcome contributions! If you want to make changes or build your own extensions to the CLI on top of the Akita IR, please see our CONTRIBUTING doc.
  • We're always happy to answer any questions about the CLI, or about how you can contribute. Email us at opensource [at] akitasoftware [dot] com and/or request to join our Slack!

Related links

Using the Akita beta:

The Akita philosophy: