Run code at boot and shutdown

An extension is something that rises and falls with the process: it opens a connection, starts a timer, registers what other classes will ask for, and undoes it all on the way down. Put it in a frond's extensions/ directory, beside the code it serves:

// fronds/blog/extensions/audit.ts
export default {
  name: 'audit',
  async up(app) { … },
  async down(app) { … },
};

A file there is recognized by its shape — a module stating up, down or state — and it travels with its frond: when the frond moves to another process, the extension rises there. That is why no config key spreads it to every process: what must be in every process is a frond every process holds, which an extension's own fronds brings.

How up and down run, and what refuses: The boot, step by step.

Built with Fougere and Nuxt, hosted on GitHub Pages.