Getting Started

Install glyde and make your first HTTP request in under a minute.

Installation

$ npm install glyde

glyde has zero dependencies. It works anywhere native fetch is available: browsers, Node.js 18+, Bun, Deno, and Cloudflare Workers.

Basic Usage

The plane() factory creates an independent HTTP client instance with its own config and interceptors.

import plane from "glyde"

// Create an instance with base config
const api = plane({
  baseURL: "https://api.example.com/v1",
  timeout: 5000,
  headers: { "X-App": "myapp" },
})

// GET request with typed response
const { data, status } = await api.get<User[]>("/users")

// POST with body
const { data: newUser } = await api.post<User>("/users", {
  name: "Yash",
  email: "yash@example.com",
})

// Query params
await api.get("/search", { params: { q: "glyde", page: 1 } })

Response Shape

Every request returns a typed response object:

// Every method returns Promise<GlydeResponse<T>>
interface GlydeResponse<T> {
  data: T                          // parsed response body
  status: number                   // HTTP status code
  statusText: string               // status text
  headers: Record<string, string>  // response headers
  config: RequestConfig            // the config that was sent
}

Key Concepts

Instances are independent

Each plane() call creates a new client with its own config and interceptors. No shared global state.

Methods are bound

You can destructure methods without losing context:const { get, post } = plane()

Headers merge automatically

Instance defaults → per-request headers. Later values override earlier ones.

GET/HEAD never send body

Even if you pass data, it won't be sent on GET or HEAD requests.