Skip to content
atarashi
Documentation menu

mw/helmet

Sensible default security headers (CSP, HSTS, frame options) for Express, Fastify or Hono.

Provides: middleware:security-headers

Requires: http

Dependencies

  • helmet@^8.1.0 (when has('http/express'))
  • @fastify/helmet@^13.0.2 (when has('http/fastify'))

What it contributes to other files

FileSlotLine
src/app.ts|jsimportsimport helmet from 'helmet';
src/app.ts|jsmiddlewareapp.use(helmet());
src/app.ts|jsimportsimport fastifyHelmet from '@fastify/helmet';
src/app.ts|jsmiddlewareawait app.register(fastifyHelmet);
src/app.ts|jsimportsimport { secureHeaders } from 'hono/secure-headers';
src/app.ts|jsmiddlewareapp.use('*', secureHeaders());

Use it

atarashi new my-app --add mw/helmet
atarashi add mw/helmet

Version 1.0.0. Format reference: Authoring blueprints.

Part of the atarashi documentation, written and maintained by Gautam Suthar.