Favicon of express

express

A fast, unopinionated Node.js web framework for building HTTP servers, APIs, and web applications with routing, middleware, and templating support.

Express is a fast, unopinionated, minimalist web framework for Node.js. It provides the routing, middleware, and HTTP helper layer that most Node.js web servers and APIs are built on, without dictating how you structure your app, which ORM you use, or which template engine you render with. It's aimed at Node.js developers building anything from a small public API to a full server-rendered web application, who want a thin, well-understood layer over Node's HTTP module rather than a heavier, more opinionated framework.

Key features

  • Full routing system: maps HTTP methods and paths to handler functions, forming the core of how an Express application organizes its endpoints.
  • High-performance focus: built with a specific focus on being fast and lightweight rather than feature-heavy.
  • HTTP helpers: built-in helpers for common HTTP tasks like redirection and caching.
  • Template engine support: a view system that supports 14 or more template engines through @ladjs/consolidate, without forcing you into any one of them.
  • Content negotiation: built-in support for responding differently based on what the client requests.
  • Application generator: the express-generator executable scaffolds a new application structure quickly from the command line.
  • Extensive middleware ecosystem: a large ecosystem of official and community middleware for things like body parsing, sessions, and authentication, since Express itself stays intentionally small.
  • High test coverage: the framework itself carries super-high test coverage, which matters given how much of the Node.js ecosystem is built directly on top of it.
  • Documented governance: project direction is overseen by a named Technical Committee and a Triager group under a published governance document, rather than being an informally maintained side project.

Ideal use cases

Express fits building HTTP APIs, single-page application backends, traditional server-rendered websites, and hybrid apps that mix both, especially when you want control over your stack rather than a framework that bundles in an ORM, a specific project structure, or a particular auth system by default. Its unopinionated design also makes it a common building block underneath higher-level frameworks and generators, rather than a rigid endpoint in itself.

It's less suited to teams that specifically want a batteries-included framework with conventions baked in for things like database access, file structure, or authentication out of the box. Because Express deliberately avoids forcing an ORM or template engine choice, teams that want less decision-making up front may find a more opinionated framework built on top of Express (or an alternative like NestJS) a better starting point than raw Express itself.

Anyone upgrading an existing app should read the dedicated migration guide before moving to the current major version, since routing and middleware behavior have changed enough between versions to affect existing code. Security issues should be reported through the project's documented security policy rather than as a public issue, and general development and usage questions have a dedicated space in GitHub Discussions separate from the issue tracker.

Installation

Express requires Node.js 18 or higher. If starting a new project, create a package.json first:

npm init

Then install Express:

npm install express

A minimal server looks like this:

import express from 'express'

const app = express()

app.get('/', (req, res) => {
  res.send('Hello World')
})

app.listen(3000, () => {
  console.log('Server is running on http://localhost:3000')
})

To scaffold a new application quickly instead of starting from scratch, install the generator (matching Express's major version) and run it:

npm install -g express-generator@4
express /tmp/foo && cd /tmp/foo
npm install
npm start

To run the included examples, clone the repository directly and run individual example files:

git clone https://github.com/expressjs/express.git --depth 1 && cd express
npm install
node examples/content-negotiation

Running the framework's own test suite requires installing dependencies first, then running npm test.

Categories:

Frequently asked questions

Share:

Stars
69.3K
Forks
24.1K
Last commit
3 days ago
Repository age
17 years
License
MIT
Self-hosted
No
Activity score
90/100
View Repository
Built with:

Similar to express

Favicon

 

  
  
Favicon

 

  
  
Favicon