Koa middleware to manage maintenance.

Usage no npm install needed!

<script type="module">
  import sigfoxKoaMaintenance from 'https://cdn.skypack.dev/@sigfox/koa-maintenance';



Koa middleware to manage maintenance mode.

When use it?

You can use this module if you need to manage the maintenance mode of your Koa app.


Switch on or off at startup the maintenance mode of your Koa app, if on it will send a 503 status to all incoming requests, if off it will go through the maintenance middleware without modifications of the incoming request. The HTTP status code and the body's response can be customised via the options parameter.


npm install @sigfox/koa-maintenance


  • isOn (Boolean) (default: "false"): The flag to indicate if the maintenance is on or off, default is off.
  • options (Object) (default: "{ status: 503, message: "We are currently down for maintenance." }"): The options to customise status code and body's response.
const Koa = require('koa');
const maintenance = require('@sigfox/koa-maintenance');

const app = new Koa();
  maintenance(process.env.MAINTENANCE === 'true', {
    status: 503,
    message: 'Something amazing is coming, bear with us'

const server = app.listen();


npm test


This project is licensed under the MIT License - see the LICENSE file for details.