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

defra-create-prototype

v0.8.1

Published

Create a Defra-themed GOV.UK Prototype Kit prototype.

Readme

Create a Defra prototype

Creates a GOV.UK Prototype Kit prototype themed with Defra Frontend.

npx defra-create-prototype

It asks what you are prototyping and whether the service will be on a service.gov.uk address, then tells you where it put the folder and what to run — npm run dev.

Prototypes go in ~/Defra prototypes, so they are in one place and --update can find them later. Pass --here to use the current directory instead, or a name to skip the first question:

npx defra-create-prototype my-service

Work in progress. Defra Frontend has not been approved by any Defra design authority and is not for use in live services.

What it does

It does not reimplement the kit. It runs the real govuk-prototype-kit create, then adds the three things a Defra prototype needs:

  1. GOV.UK Frontend 6 at the project root. The kit pins 5.x for itself but resolves plugins from the project root, so the root version is the one that gets compiled. Defra Frontend is a v6 token layer and cannot work on v5.
  2. Defra Frontend, which is itself a kit plugin. It also sets the service name in app/config.json, and picks the header, footer and typeface from your answer about the address — a licence boundary rather than a style choice, since GDS Transport and the Royal Arms footer are licensed for service.gov.uk only.
  3. Two sass imports, in the files the kit reserves for exactly this. The kit imports user settings before plugins and user application after — the only ordering in which a token layer works.

It also points the prototype's layout at the Defra header and footer, writes a README into the folder, and puts the prototype into git.

Checking a published prototype is protected

npx defra-create-prototype --check https://my-service.up.railway.app

Asks your published prototype whether it wants a password, and says plainly whether it does.

Worth doing every time, because the failure is silent. The Prototype Kit only asks for a password when NODE_ENV is production — set PASSWORD on its own and it is ignored completely, so the prototype publishes, looks right, and is open to anyone with the address. Nothing about the deploy tells you. A new prototype gets a .env.example naming both variables, which hosting services like Railway offer to import during setup.

Finding your prototypes

npx defra-create-prototype --dashboard

Writes and opens a page listing every prototype in ~/Defra prototypes — its service name, its versions, the command to start it, and, where a prototype has versions, which pages differ between them. Useful before a comparison session: knowing that three of fifteen pages changed tells you where to spend the time.

Prototypes made before the shared folder existed are usually somewhere else:

npx defra-create-prototype --dashboard --dir ~/Documents/GitHub

That reads the folder you name and writes the page into ~/Defra prototypes, so scanning somewhere does not leave a file in it.

It also lists each prototype's snapshots with how many of their pages have changed since one was taken.

The difference check ignores the link prefixes --variants and --snapshot add, so "differs" means a real content change. Without that every copied page would be reported as changed, which looks like an answer and is not one.

Comparing two versions in research

To show a participant how something works today and how it might work, from inside your prototype:

npx defra-create-prototype --variants

Your pages move into app/views/current, a copy becomes app/views/future, and links inside them are prefixed so each version stays in its own journey.

localhost:3000/current/    how it works today
localhost:3000/future/     how it might work
localhost:3000             a page linking to both

One prototype rather than two, deliberately: both versions share the layout, the styles and the components, so fixing a typo in the header fixes it in both, and one npm run dev serves both. Two folders would mean two servers, two terminal windows and every shared change made twice.

Each prototype also gets its own port, recorded in app/config.json, so two different prototypes can run at the same time without clashing. Nothing to remember — npm run dev reads it. Prototypes made before this still use the kit's default of 3000; --update gives them one.

It needs a clean git tree, because it moves your pages and rewrites links inside them — if it gets something wrong, git checkout . puts it back.

Keeping an earlier round

npx defra-create-prototype --snapshot "round 1"

Freezes your pages as they are now, so the next round can change them:

localhost:3000/snapshots/round-1/   as it is today
localhost:3000/snapshots            every snapshot, with dates

Your live pages are not touched — a snapshot is only ever added. Pass --note "before the new task list" to record why you took it.

This is the other versioning case, and not the same as --variants. Variants are two states you are both editing and both showing. A snapshot is a copy nobody edits: a round of research is over, the pages are about to be rebuilt, and round two always asks what the thing participants actually saw looked like.

The alternative today is a folder called backup copy — or defra form tool working backup 4:2:25 — with nothing recording when it was taken or what it was for, and no way to look at it without stopping the prototype that is running. A snapshot is served by the same prototype, so there is no second install, no second port and no second terminal, and snapshots.json records the date, your note and the versions it was built against. --dashboard lists them with how many of their pages have changed since.

What is frozen, and what is not

Your pages and the journey through them are frozen. The layout, your stylesheets and app/routes.js are shared with the live prototype on purpose: a fix to the header reaches every snapshot rather than leaving them all on an old one, and a copied layout would resolve the plugin at its installed version anyway, so freezing it would gain almost nothing.

The trade is worth knowing. A snapshot shows old content in today's design, and a journey that depends on a route you later change may stop working.

Checking accessibility

From inside your prototype:

npx defra-create-prototype --audit

Runs axe-core over every page your prototype serves and groups what it finds by issue, so one bad pattern repeated across twelve pages reads as one thing to change rather than twelve findings. It writes a report you can send on, and starts the prototype itself if it is not already running.

Two things it does that npx pa11y <url> does not:

  • It knows your pages. The kit maps app/views to routes, so the list comes off disk. A prototype has no sitemap and no reliable links between every page, so crawling misses whole journeys.
  • It will not pass a page that did not render. A check-answers page with no session data behind it can return 500, and an auditor pointed at that URL cheerfully audits the kit's error page and reports no problems. Every page is asked for its status first, and anything that is not a page is listed as not checked rather than counted as a pass.

The checker is fetched by npx the first time you audit, and drives the Chrome already on your machine — Edge works too. Nothing is added to your prototype and no browser is downloaded. If Chrome is somewhere unusual, name it:

PUPPETEER_EXECUTABLE_PATH="/path/to/chrome" npx defra-create-prototype --audit

It checks against WCAG 2.1 AA, which leaves out axe's own "best practice" rules — heading order among them. That is on purpose: some of those fire on the kit's own templates, and findings you cannot act on are the quickest way to learn to ignore a report.

What it does not tell you

An automated check reads the markup, and that is a minority of accessibility. It cannot tell you whether the page makes sense read aloud, whether the reading order matches the visual order, whether an error message explains how to fix the error, or whether the journey can be completed by keyboard. Those need a person.

So the output is a list of things to fix, not a score. A prototype with no errors here has not been accessibility tested, and nothing in the report should be quoted as a pass.

Working with an assistant

A prototype made with this command is set up for VS Code already. Open the folder there and GitHub Copilot can see what the design system contains, make pages, run the prototype, check it for accessibility and freeze a round of research.

There is nothing to configure. Creating a prototype writes .vscode/mcp.json, and --update adds it to one made earlier. If you already have other MCP servers configured, they are kept.

What it adds is knowing which code is the right code. An assistant that does not know this design system will reach for govukFooter on a service that may not legally use it, or try to change a GOV.UK component by creating a file at govuk/components/<name>/template.njk — which does nothing at all, with no error, because GOV.UK macros include their template by relative path.

It will not host your prototype, and it will not tell you a prototype is accessible. See defra-mcp.

The GitHub Copilot CLI uses a different configuration file and is not set up by this.

Updating a prototype

From inside the prototype:

npx defra-create-prototype --update

This reports the version before and after, and names any workarounds in the prototype that the package now handles itself. Prototypes created before this package was published carried a vendored copy under the old @defra scope; update moves those across and removes it.

Licence

Open Government Licence v3.0.