npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

casa-dev-overlay

v0.2.5

Published

A local-dev overlay for GOV.UK CASA apps. Visualises the journey graph, inspects the JourneyContext, jumps to any waypoint, and auto-fills with reusable presets (compatible with spiderplan personas).

Downloads

73

Readme

casa-dev-overlay

A local-dev overlay for GOV.UK CASA apps.

It mounts a small panel into the corner of every page during local development that lets you:

  • Visualise the journey graph – see every waypoint in your Plan, with the current waypoint highlighted and the live traversed path coloured in.
  • Jump to any waypoint – click a node and go straight there.
  • Inspect (and edit) the JourneyContext – data, validation errors, identity, ephemeral contexts, and a one-click "destroy session".
  • Apply auto-fill presets – drop a YAML file into ./.casa-presets/ and apply it with one click. The file format is intentionally compatible with spiderplan personas, so you can reuse your existing E2E fixtures.
  • See the field model for the current page – every field() definition, its validators, conditions and processors.
  • See the hook timeline – every journey.* stage that ran for the current request, with timings.
  • Save & restore session snapshots – capture the JourneyContext to disk, restore it later. Time-travel debugging for free.

The plugin is a strict no-op when NODE_ENV === "production", and refuses to serve any of its routes from a non-loopback host as a belt-and-braces guard.

Tested against @dwp/[email protected]. Express 4 only (CASA 9 ships Express 4).

Install

npm install -D casa-dev-overlay js-yaml

@dwp/govuk-casa and express are declared as peer dependencies – it uses whatever versions your CASA app already has.

Wire it up

import { configure } from "@dwp/govuk-casa";
import casaDevOverlay from "casa-dev-overlay";

const { mount /* ...rest */ } = configure({
  // ...your normal CASA config
  plugins: [
    casaDevOverlay({
      presetsDir: "./.casa-presets",
      snapshotsDir: "./.casa-dev-overlay/snapshots",
    }),
    // ...your other plugins
  ],
});

That's it. Start your app, open it in the browser, and you'll see a blue CASA badge in the top-right corner.

Presets

A preset is a YAML file describing the data to seed into the JourneyContext, plus an optional waypoint to land on after applying.

# .casa-presets/partner.yaml
target: check-your-answers
data:
  personal-details:
    title: MR
    firstName: Alice
    lastName: Example
  live-with-partner:
    havePartner: "yes"
  your-partners-name:
    fullName: Bob Example

Click Apply in the Presets tab and the overlay will:

  1. Write each data.<waypoint> block into journeyContext.setDataForPage(waypoint, …).
  2. Clear any prior validation errors for those waypoints.
  3. Persist via JourneyContext.putContext(req.session, ctx) so CASA's own change events fire.
  4. Redirect you to target (or the optional target you pass on the click).

This format is identical to spiderplan personas, so you can point presetsDir at your existing tests/e2e/personas/ directory if you want.

Snapshots

The Snapshots tab calls journeyContext.toObject() and writes the JSON to snapshotsDir. Loading a snapshot rehydrates it via configureFromObject. Useful for:

  • Capturing the exact state of a bug repro and attaching it to an issue.
  • Rolling back a session after destructive testing.
  • Sharing a starting state across teammates.

Configuration

casaDevOverlay({
  enabled?: boolean;          // default: NODE_ENV !== "production"
  presetsDir?: string;        // default: "./.casa-presets"
  snapshotsDir?: string;      // default: "./.casa-dev-overlay/snapshots"
  allowNonLoopback?: boolean; // default: false
});

What it touches in your CASA app

| Surface | What casa-dev-overlay does | | -------------------- | ------------------------------------------------------------------------------------------------------------------ | | staticRouter | Adds GET /__casa/overlay.js and GET /__casa/overlay.css | | ancillaryRouter | Adds /__casa/api/* JSON endpoints and an HTML response interceptor that injects the overlay tag before </body> | | journeyRouter | Same response interceptor (so the overlay appears on every waypoint page) | | hooks | Registers a tiny global hook for every journey.* stage to capture per-stage timings | | helmetConfigurator | Wraps yours (if any) to allow 'self' in script-src and connect-src so the overlay can load |

It does not modify your pages, plan, fields, validators, or templates.

Safety

Three independent guards keep this out of production:

  1. The plugin returns no-op configure/bootstrap when NODE_ENV === "production" (or enabled: false).
  2. Every API and asset route is wrapped in a loopback-host check; non-loopback requests get 404.
  3. A red \u26a0 not on localhost banner appears in the overlay footer if it ever loads against a non-localhost host.

How it works

                  Service developer's CASA app
╭─────────────────────────────────────────────────────────────╮
│  configure({                                                │
│    plugins: [casaDevOverlay({ presetsDir: "./.casa-presets" })│
│  })                                                         │
╰────┬────────────────────────────────────────────────────────╯
     │ plugin.configure() captures pages + plan, registers
     │   per-stage hooks, widens helmet CSP
     ▼
╭──────────────────────────╮       ╭───────────────────────╮
│ ancillaryRouter          │       │ staticRouter          │
│  /__casa/api/state       │◀─────▶│  /__casa/overlay.js   │
│  /__casa/api/jump        │       │  /__casa/overlay.css  │
│  /__casa/api/preset/*    │       ╰───────────────────────╯
│  /__casa/api/snapshot/*  │                  │
│  /__casa/api/context/*   │                  ▼
╰──────────┬───────────────╯       ╭──────────────────────╮
           │ wraps res.send to     │ Shadow-DOM overlay   │
           ▼   inject <script>     │  • Journey graph     │
   responses on ancillary +        │  • Context inspector │
   journey routes                  │  • Field inspector   │
                                   │  • Hook timeline     │
                                   │  • Preset picker     │
                                   │  • Snapshot manager  │
                                   ╰──────────────────────╯

Roadmap

  • Per-edge route-condition evaluation (show which condition picked the next waypoint and why).
  • Server-Sent Events stream so the overlay updates without a refresh.
  • Record-mode: capture a real session as a YAML preset.
  • Generate a spiderplan persona from the current JourneyContext.

Licence

MIT