Skip to content

http-status-lite

A small, type-safe library of standards-backed HTTP status codes for Node.js and browsers.

Role
Library design and package engineering
Scope
Typed APIs, compatibility, and package distribution
Status
Published npm package

Problem

Developers need status-code names, categories, and lifecycle metadata. Without a library they fall back on memorized numeric checks or hand-written lists that go stale, and many alternatives bring a heavier dependency than the task needs.

Constraints

  1. C1

    The IANA registry changes over time.

  2. C2

    Obsolete, temporary, and unused codes must remain distinguishable.

  3. C3

    Typing and ESM and CommonJS compatibility must not depend on live network access.

Architecture

A committed snapshot of the IANA registry generates the typed library. Constants, predicates, and metadata are exposed as separately importable entry points, and a workspace-linked interactive reference plus automated registry and release workflows keep the snapshot and package in step.

01

Core library

A committed IANA-derived registry generates the typed lookups, parsers, and status-class predicates.

02

Package builds

Constants, predicates, and metadata ship as independently importable entry points alongside the complete main API.

03

Documentation app

An interactive status reference consumes the local library, and automated workflows maintain the registry and handle releases.

Decisions

D1

Commit the registry snapshot

Builds read a reviewed file instead of fetching the registry at runtime, which makes them deterministic. The trade-off is periodic maintenance when the registry changes.

D2

Preserve lifecycle metadata

Flattening every number to "valid" would hide whether a code is permanent, temporary, obsolete, or unused, which is information callers can need.

D3

Expose separate entry points

Focused imports let consumers pull in only what they use, while the main entry point still offers the complete API.

Contribution

  • Built the typed registry, lookups, parsers, and status-class predicates.
  • Modeled permanent, temporary, obsolete, and unused entries.
  • Added generator drift checks and package publishing gates.
  • Implemented an interactive status reference that consumes the local library.

Outcomes

  • Consumers can retrieve name, category, and lifecycle metadata for status codes.
  • Consumers can classify codes into success, client error, and server error categories.
  • Consumers can parse and validate status codes.
  • Builds rely on a reviewable standards snapshot without runtime network access.

Product screenshot

http-status-lite documentation home page with a large 'HTTP/1.1 200 OK' headline and an install panel
The reference site presents status codes as typed data backed by a committed registry snapshot.

Verified stack

  • TypeScript
  • Node.js
  • ESM
  • CommonJS
  • tsup
  • TanStack Start
  • React
  • Tailwind CSS
  • Vite
  • Netlify
  • GitHub Actions
  • CI/CD
  • System Design

Working through something similar?

Share your challenge, scope, and timeline to start a focused conversation.