Skip to content

content-types-lite

Tiny, type-safe HTTP media type constants and utilities for parsing, formatting, matching, and validation.

Tiny, type-safe HTTP media type constants and utilities for parsing, formatting, matching, and validation.

What it is

A small, type-safe TypeScript library of HTTP media type constants and helpers for parsing, formatting, matching, and validating Content-Type values.

The problem

Applications keep reimplementing Content-Type parsing and negotiation, and each version handles edge cases slightly differently. The usual alternative is importing a larger dependency tree for what is a focused HTTP-header task.

What it delivers

  • Consumers can parse and serialize Content-Type values.
  • Consumers can validate and compare media types.
  • The package works from both ESM and CommonJS.
  • Developers can test behavior interactively in the documentation app.

Limits to know

  • Quoted parameters and malformed header values must parse predictably.
  • The package output must work for both ESM and CommonJS consumers.
  • The public API must stay small and type-safe with no runtime dependencies.

Status and role

  • Status: Published npm package
  • My role: Library design and package engineering
  • Scope: Typed APIs, compatibility, and package distribution

Project stack

  • TypeScript
  • ESM
  • CommonJS
  • tsup
  • TanStack Start
  • React
  • Tailwind CSS
  • Vite
  • Vitest
  • Netlify
  • GitHub Actions
  • CI/CD

Need help with this project? Get project support

Working through something similar?

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

Discuss a project