This is a development version of the utility. Please post questions in the Github issues.
Declarative cli-based api management utility with strong IaC support.
Main features:
-
api resources and access patterns declared in HCL, the config langauge of Terraform, supporting strong standard CI/CD and devops patterns without compromise or requiring external vendor tooling
-
more complex and powerful environments and modules- leverage many of the features and IaC patterns of terraform- set global scope variables, access module variables in the environment, differentiate environment and secret variables.
-
access patterns to endpoints can be defined and socialized- define not just the call, but also different parameters, request bodies, authorization tokens.
-
automatically access and store data from api responses- socialize and reduce friction managing api tokens, crsf_tokens, headers during development ("set it and forget it").
-
list, search, evaluate, invoke endpoints via cli dropdown
-
persist output of calls to external data store, with the ability to customzie the sink
-
run assertions against api outputs for e2e testing locally and in CI/CD
-
install cargo, the Rust building toolchain (see https://doc.rust-lang.org/cargo/getting-started/installation.html)
-
build the utility on your machine
cargo build --release --bin drop-rs
See "examples" folder for working version of the main features, including defining environments, modules, api calls, and 'runs' (parameterized api calls).
After installing-
cargo run --bin mock
server url port: 57888
environment "base" {
base_url = "http://localhost:57888"
}
Secrets for an environment must have a default.
./target/release/drop-rs secret set csrf_token null
./target/release/drop-rs secret set secret_auth_token null
The following command will list all the api calls ("hits") defined in the 'example' module and give you a dropdown selector to evaluate one in the default environment.
./target/release/drop-rs give example
giving example in environment base
calls in module: example
? Select drop
> example.post.signup
example.post.login
example.get.user
example.get.user_with_input
example.run.login_user_2
[↑↓ to move, enter to select, type to filter]
select example.post.signup
giving example in environment base
calls in module: example
> Select drop example.post.signup
post "signup" {
base_url = "http://localhost:57888"
path = "/signup"
body = {
"user_name" = "example_user_name_1"
"password" = "example_password"
}
after = [
{
"type" = "set_secret"
"input" = response.headers.csrf_token
"key" = "csrf_token"
"env" = "base"
"overwrite" = true
}
]
inputs = {
"user_name" = "example_user_name_1"
}
assert = {
response.headers.csrf_token = assert.exist
}
outputs = [
response.headers.csrf_token
]
}
./target/release/drop-rs hit example
hitting example in environment base
calls in module: example
? Select drop
> example.post.signup
example.post.login
example.get.user
example.get.user_with_input
example.run.login_user_2
[↑↓ to move, enter to select, type to filter]
> Select drop example.post.signup
calling http://localhost:57888/signup
example.post.signup assertions
+-----------------------------+-------+---------+
| response.headers.csrf_token | exist | Success |
+-----------------------------+-------+---------+
"example.post.signup" result: 200
output "response.headers.csrf_token"
"secret_csrf_token"
secret csrf_token in environment base set successfully.
The mock signup call will:
- assert the response from the mock server
- store the csrf_token response header in your local secret store as "csrf_token."
./target/release/drop-rs secret get
Secrets for env: base
Secret { key: "secret_auth_token", value: "null", _env: "base" }
Secret { key: "csrf_token", value: "secret_csrf_token", _env: "base" }
See the example files for a more detailed walkthrough and documentation of the current features.
As your project scales, and you start to manage dozens of microservices and hundreds of endpoints, many issues arise with Postman:
- difficulty and friction versioning and socializing api definitions on teams
- difficulty searching modules for specific calls
- inability to define and socialize access patterns
- lack of variable scope between environments and modules
- fiction managing data interfaces between calls
This project was inspired by Bruno, a popular new api management tool that is config based and open source.
What we love about Bruno:
- True IaC/devop workflow to reduce friction in socializing endpoints during development process
- open source
- strong dx via VsCode extensions
- strong cli support alongside ui
Some differences:
- Rust vs. JS/npm ecosystem- drop is compiled for portability
- Rather than a custom DSL, we use hcl, the fully featured, mature configuration language of terraform with very strong Rust support. Users familiar with terraform can start coding immediately.
- Variable scope- hcl allows us to define and access complex variable contexts between modules and environments.
- hcl functions- hcl supports ergonomic string manipulation and formatting directly in the code
- 'run' blocks- drop supports encapsulating access patterns
- drop does not and will never have a ui
- portability- compiled, requires no external dependencies to use locally or in CI/CD
- reliability- modern type and null safety
- memory safe concurrency
- strong embedded Python support