serve-handler

The config-driven static file request handler powering Vercel's serve CLI

Library
npm
v6.1.7
618stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
56/100Fair
Development Activity16
Maintenance44
Community76
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture72
Code Quality74
Innovation65
Learning Curve78

serve-handler is a plain (request, response, config) => Promise function that implements Vercel’s static-file-serving behavior — clean URLs, redirects, rewrites, directory listings, and MIME handling — decoupled from any specific HTTP server or CLI. It is the routing engine underneath Vercel’s popular serve command-line tool, but is published independently so any Node.js HTTP server (raw http, Express, micro) can reuse the exact same static-serving logic Vercel deployments use.

Because it accepts the same now.json/vercel.json-style configuration object used by Vercel deployments (routes, redirects, headers, cleanUrls, trailingSlash), it lets developers preview or self-host static sites with production-equivalent routing behavior instead of a generic static file server.

What You Get

  • A single exported handler function usable with Node’s raw http, Express, or micro
  • Support for Vercel-style config (cleanUrls, redirects, rewrites, headers, trailingSlash)
  • Automatic MIME type detection and correct content-type headers
  • Directory listing pages when no index file is present
  • Etag/last-modified based caching headers for static assets

Common Use Cases

  • Powering the serve CLI’s local static-file preview server
  • Embedding production-equivalent Vercel routing/redirect behavior into a custom Node.js server for local testing
  • Serving a static site build (e.g. dist/ or build/) with clean URLs during a CI smoke test
  • Building custom static-hosting tools that need Vercel-compatible config parsing without depending on the full CLI

Under The Hood

Architecture: The entire implementation lives in a single src/index.js (~775 lines) that parses the passed configuration object, resolves the requested path against the filesystem (with glob-based route matching in a companion glob-slash.js), and dispatches to either a static file stream, a directory listing page (rendered via directory.js using dot templates), or an error page (error.js); everything is expressed as pure functions taking (request, response, config), with no framework or server assumptions baked in. Tech Stack: Plain Node.js/JavaScript with dot for the directory-listing view template, tested via jest integration tests and linted with Vercel’s internal @zeit/eslint-config-node. Code Quality: test/integration.test.js spins up a real server via test-listen and exercises routing, redirects, and headers end-to-end rather than unit-testing internals in isolation; the project has been stable for years with infrequent but deliberate maintenance releases. API Design: The API is deliberately minimal — one function, one config object — so it drops into any existing Node.js HTTP stack (raw http.createServer, Express middleware, micro) without requiring adoption of a specific framework.

Used by 6 apps in this directory

TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
TypeScript
45%
Other

Convex Backend

Developer Tools · Databases

12,394

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
88
Repo Health
82
Technical
70
Dependency
Built with
TypeScript45%
Rust43%
Updated today
JavaScript
63%
Other

GDevelop

Developer Tools · Game Development · Design Tools

25,761

No-code, open-source game engine for building 2D, 3D and multiplayer games — publish to iOS, Android, Steam and the web.

View details
93
Repo Health
82
Technical
64
Dependency
Built with
JavaScript63%
C++24%
TypeScript12%
Updated yesterday
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

27,294

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
88
Repo Health
73
Technical
66
Dependency
Built with
TypeScript99%
Updated today
TypeScript
99%
Other

NocoBase

No Code Platforms · Low Code Platforms

23,696

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
65
Dependency
Built with
TypeScript99%
Updated today
Python
76%
AGPL 3.0

Skyvern

AI Agents · Automation

22,785

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
71
Dependency
Built with
Python76%
TypeScript22%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search