explaingit

vercel/micro

Analysis updated 2026-05-18

10,613TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

Micro is a tiny Node.js library for building HTTP services with a single exported function, using async/await for clean, high-performance request handling inside containers.

Mindmap

mindmap
  root((micro))
    What it does
      Single-function server
      Async await support
      Opt-in JSON parsing
    Setup
      npm install micro
      Export one function
      npm start
    Helpers
      buffer and text
      json parsing
      send with status
    Error Handling
      Auto 500 on throw
      Custom statusCode
    Use Cases
      Container services
      Microservice APIs
      Lightweight endpoints
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a lightweight HTTP API endpoint that handles JSON requests inside a Docker container.

USE CASE 2

Create a single-purpose microservice that reads POST body data and returns a computed result.

USE CASE 3

Add a standalone HTTP service to an existing Node.js project without pulling in a full web framework.

USE CASE 4

Write integration tests for HTTP handlers by spinning up a real server in a test file and sending real requests.

What is it built with?

TypeScriptNode.js

How does it compare?

vercel/micromaplibre/maplibre-gl-jschathub-dev/chathub
Stars10,61310,61110,609
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

Micro is a small library from Vercel that makes it easy to build HTTP services in Node.js using the modern async/await style. It strips away most of the ceremony usually involved in setting up a server, letting you export a single function that receives a request and returns a response. The entire library is about 260 lines of code and stays deliberately lightweight, with JSON parsing opt-in rather than automatic, so performance stays high even under load. Getting started takes only a few steps. Install it with npm, write a file that exports a function, add a start script to your package.json, and run npm start. Your service listens on port 3000 by default. Micro includes helper functions for reading the incoming request body as raw bytes, plain text, or JSON, and for sending responses with specific HTTP status codes. Error handling works through standard JavaScript throwing. If your code throws an unhandled error, Micro automatically sends a 500 response back to the caller. If the error object has a statusCode property, Micro uses that number as the HTTP status code instead, so building rate-limiting or validation logic is a matter of throwing an error with the right code rather than writing custom response logic for each failure. The library is designed specifically for services running inside containers such as Docker, not for serverless platforms. The README notes explicitly that if you are deploying to Vercel's own hosting, Micro is not needed, because the platform already provides equivalents to its utility functions. For development, a separate companion package called micro-dev adds live reloading and other convenience features suited to that environment. Micro has no middleware system. If you need to share logic across handlers, the approach is to compose plain functions. A community collection called awesome-micro lists third-party modules that extend it. Testing is also straightforward: you start a real HTTP server in your test file, send a request, and inspect the response, all within a few lines of code.

Copy-paste prompts

Prompt 1
I'm using vercel/micro. Write a handler that reads a JSON body from a POST request, validates it has a 'name' field, and returns a greeting or throws a 400 error if the field is missing.
Prompt 2
Show me how to compose two vercel/micro handlers so that an auth check runs before my main handler, without using middleware.
Prompt 3
Write a vercel/micro service that proxies a request to an external API and streams the response back to the caller.
Prompt 4
Using vercel/micro, create a rate-limiting wrapper that throws a 429 error after more than 10 requests per minute from the same IP.

Frequently asked questions

What is micro?

Micro is a tiny Node.js library for building HTTP services with a single exported function, using async/await for clean, high-performance request handling inside containers.

What language is micro written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js.

How hard is micro to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is micro for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.