Skip to content

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.

Terminal window
npm install -g @t-req/app

Or with other package managers:

Terminal window
bun add -g @t-req/app
pnpm add -g @t-req/app

Scaffold a new workspace:

Terminal window
treq init my-api
cd my-api

This creates a directory with:

  • treq.jsonc — project configuration (variables, profiles, defaults)
  • requests/ — a folder for your .http files
  • A sample .http file to get started

Launch the terminal UI to browse and run requests interactively:

Terminal window
treq open

The TUI lets you:

  • Browse .http files in your workspace
  • Execute requests and inspect responses
  • Switch between profiles
  • Run tests and scripts with observer mode

Execute a single .http file directly:

Terminal window
treq run requests/hello.http

Select a specific request by name or index:

Terminal window
treq run requests/api.http --name get-users
treq run requests/api.http --index 0

Use a profile:

Terminal window
treq run requests/api.http --profile staging

Add --web to open the browser-based UI instead of the terminal UI:

Terminal window
treq open --web

t-req’s core is a JavaScript library. Install it in any project:

Terminal window
npm install @t-req/core
import { 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.