Getting Started
t-req parses, interpolates, and executes .http files in JavaScript. It works as a library, a CLI, and a TUI with built-in observability.
Install
Section titled “Install”npm install -g @t-req/appOr with other package managers:
bun add -g @t-req/apppnpm add -g @t-req/appCreate a project
Section titled “Create a project”Scaffold a new workspace:
treq init my-apicd my-apiThis creates a directory with:
treq.jsonc— project configuration (variables, profiles, defaults)requests/— a folder for your.httpfiles- A sample
.httpfile to get started
Open the TUI
Section titled “Open the TUI”Launch the terminal UI to browse and run requests interactively:
treq openThe TUI lets you:
- Browse
.httpfiles in your workspace - Execute requests and inspect responses
- Switch between profiles
- Run tests and scripts with observer mode
Run a request from the CLI
Section titled “Run a request from the CLI”Execute a single .http file directly:
treq run requests/hello.httpSelect a specific request by name or index:
treq run requests/api.http --name get-userstreq run requests/api.http --index 0Use a profile:
treq run requests/api.http --profile stagingWeb UI
Section titled “Web UI”Add --web to open the browser-based UI instead of the terminal UI:
treq open --webUse as a library
Section titled “Use as a library”t-req’s core is a JavaScript library. Install it in any project:
npm install @t-req/coreimport { createClient } from '@t-req/core';
const client = createClient({ variables: { baseUrl: 'https://api.example.com' },});
const response = await client.run('./requests/get-users.http');const data = await response.json();
await client.close();This is the foundation of the BYO test runner pattern — use any test framework to make assertions on responses from .http files.
Next steps
Section titled “Next steps”- BYO Test Runner — integrate with Vitest, Jest, Bun test, or pytest
- Observer Mode — get request observability in the TUI for free
- Configuration Reference — profiles, variables, resolvers
- CLI Reference — all commands and options