Skip to content

zanmato/broquest

Repository files navigation

Broquest

A modern, native desktop API client built with GPUI and gpui-component, offering fast performance and a clean interface for API development and testing.

broquest

Features

  • Native Performance - Built with Rust and GPUI for fast native performance
  • File-based Storage - Collections and configurations stored in human-readable TOML files
  • Environment Management - Support for multiple environments with variables and secrets
  • JavaScript Scripting - Pre-request and post-response scripting using QuickJS
  • Modern UI - Clean, responsive interface with theme support
  • Local-first - All your data stays on your machine with no cloud dependencies
  • Cross-platform - Available for Linux, macOS and Windows

macOS

IMPORTANT: After downloading you have to run xattr -r -d com.apple.quarantine Broquest.app in the folder of the app since the app isn't notarized.

Scripting

Broquest supports JavaScript scripting for pre-request and post-response hooks using QuickJS with LLRT modules that provide Node.js-compatible APIs.

Available Objects

req Object (Pre-request scripts)

The req object contains the current request data that can be modified before sending:

// Request method (GET, POST, etc.)
req.method;

// Request URL
req.url;

// Request body
req.body;

// Headers object (read/write)
req.headers["Content-Type"] = "application/json";
req.headers.Authorization = "Bearer token";

// Query parameters object (read/write)
req.query.page = "1";
req.query.limit = "10";

res Object (Post-response scripts)

The res object contains the response data:

// Response status code (200, 404, etc.)
res.status;

// Response status text ("OK", "Not Found", etc.)
res.statusText;

// Response body (string, or object if JSON)
res.body;

// Response headers object (read-only)
res.headers["content-type"];
res.headers["server"];

// Response latency in milliseconds
res.latency;

// Response size in bytes
res.size;

bro Object

The bro object provides utility functions for environment variable management:

// Set environment variable
bro.setEnvVar("API_KEY", "your-api-key-here");

// Get environment variable (returns undefined if not found)
bro.getEnvVar("API_KEY");

Global Functions

Base64 Encoding/Decoding
// Encode to base64
const encoded = btoa("hello world");

// Decode from base64
const decoded = atob("aGVsbG8gd29ybGQ=");
Crypto Operations
// Generate UUID v4
const id = crypto.randomUUID();

// Create hash
const hash = crypto.createHash("sha256").update("data").digest("hex");
URL Operations
// Parse URLs
const url = new URL("https://api.example.com/users/123?active=true");

// URL search parameters
const params = new URLSearchParams("?name=John&age=30");
params.append("city", "NYC");
params.get("name");

Script Examples

Basic Authentication

// Pre-request script for Basic Auth
req.headers.Authorization =
  "Basic " +
  btoa(`${bro.getEnvVar("merchantid")}:${bro.getEnvVar("password")}`);

Dynamic Headers

// Pre-request script to set timestamp and signature
const timestamp = Date.now();
const payload = req.method + req.url + req.body + timestamp;

// Simple hash example (use crypto.createHash for real hashing)
const signature = crypto.createHash("sha256").update(payload).digest("hex");

req.headers["X-Timestamp"] = timestamp.toString();
req.headers["X-Signature"] = signature;

License

Apache-2.0

About

API client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages