HTTP requests that glyde
A lightweight, TypeScript-first HTTP client built on native fetch. Zero dependencies. Typed errors. Async interceptors. 1.73 KB gzipped.
import plane from "glyde"
const api = plane({ baseURL: "https://api.example.com" })
// Typed responses, zero config
const { data } = await api.get<User[]>("/users")
// Interceptors for auth, logging, anything
api.interceptors.request.use((config) => ({
...config,
headers: { ...config.headers, Authorization: `Bearer ${token}` },
}))1.73 KB
Gzipped
0
Dependencies
41
Tests passing
100%
TypeScript
Why developers choose glyde
Built for the modern stack. No legacy XHR, no bloated abstractions, no supply chain risk.
Zero Dependencies
No transitive vulnerabilities. No supply chain attacks. Just your code and native fetch.
TypeScript-First
Full generic inference on every request. Typed errors you can catch precisely. No any types.
Async Interceptors
Request and response pipelines with full async/await support. Add auth, logging, transforms.
Typed Error Hierarchy
HttpError, TimeoutError, NetworkError — catch by type with type guards, not string matching.
Tiny & Fast
5.25 KB minified, 1.73 KB gzipped. Ships ESM + CJS. Tree-shakeable. No bundler magic needed.
Universal Runtime
Works in browsers, Node.js 18+, Bun, Deno, Cloudflare Workers — anywhere fetch exists.
First-class Next.js support
glyde was designed with Next.js App Router in mind — Server Components, Route Handlers, middleware token refresh. But it works just as well with Express, Nuxt, SvelteKit, or plain Node.js.
Server-side (tower)
// lib/api/server.ts — "tower" (server-side)
import plane from "glyde"
import { cookies } from "next/headers"
export async function tower() {
const api = plane({ baseURL: process.env.API_BASE_URL })
const cookieStore = await cookies()
api.interceptors.request.use((config) => {
const token = cookieStore.get("access_token")?.value
if (token) {
config.headers = { ...config.headers, Authorization: `Bearer ${token}` }
}
return config
})
return api
}Client-side (passenger)
// lib/api/client.ts — "passenger" (browser)
"use client"
import plane from "glyde"
export const passenger = plane({ baseURL: "/api/proxy" })
passenger.interceptors.response.use(
(response) => response,
(error) => {
if (error?.status === 401) window.location.href = "/login"
throw error
}
)Works everywhere fetch exists — not just Next.js
The numbers speak
vs axios
97% smaller
1.73 KB vs 53 KB gzipped
Dependencies
0
axios has 2
TypeScript
100%
Written in TS, not bolted on
Ready to glyde?
Start making HTTP requests the modern way. One install, zero config.