@hapi/hapi
Hapi (originally Happy.js) is a rich framework for building applications and services on Node.js, created by Eran Hammer at Walmart Labs. Unlike Express's minim…
Installation
npm install @hapi/hapi
yarn add @hapi/hapi
pnpm add @hapi/hapi
Import
import Hapi from '@hapi/hapi';
Quick Example
const server = Hapi.server({ port: 3000 });
server.route({
method: 'GET',
path: '/',
handler: () => 'Hello World',
});
await server.start();About @hapi/hapi
Hapi (originally Happy.js) is a rich framework for building applications and services on Node.js, created by Eran Hammer at Walmart Labs. Unlike Express's minimalist approach, Hapi provides a comprehensive built-in feature set including input validation using Joi schemas, authentication with multiple strategies, caching with catbox, cookie management, and detailed request lifecycle hooks. Hapi's configuration-centric philosophy means most features are enabled through declarative route configuration rather than imperative middleware chains. The framework excels in enterprise environments where strict input validation, detailed logging, and robust error handling are essential. Hapi's plugin system allows teams to organize applications into isolated, composable modules with their own routes, handlers, and dependencies. The framework handles request validation, payload parsing, and authentication declaratively at the route level, reducing boilerplate and potential security oversights. Hapi's ecosystem includes official packages for templating (vision), static files (inert), and API documentation (lout), providing a batteries-included experience for teams that prefer convention over configuration.
Quick Facts
| Package | @hapi/hapi |
| Category | Framework |
| Weekly Downloads | 400K+ |
| License | BSD-3-Clause |
| Install | npm install @hapi/hapi |
Related Packages
Express is the most widely used web application framework for Node.js, providing a minimal and flexi…
Fastify is a high-performance web framework for Node.js designed to be the fastest HTTP framework av…
Koa is a lightweight web framework for Node.js created by the same team behind Express. It was desig…
Joi is the most powerful schema description language and data validator for JavaScript, originally c…
NestJS is a progressive Node.js framework for building efficient, reliable, and scalable server-side…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.