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

astro-build-id

v1.0.0

Published

Deterministic build identifier output for Astro sites

Readme

astro-build-id

Deterministic build identification for Astro sites

astro-build-id is a tiny, static-first Astro integration that writes a single build identifier file at build time.

It exists to answer one simple operational question:

Which build is currently deployed?

No databases.
No runtime code.
No guessing.


Why this exists

With static sites and CDNs, it is often hard to tell:

  • whether a deploy actually updated
  • if a cache purge worked
  • which environment is live
  • whether two environments are running the same build

People end up:

  • redeploying “just in case”
  • adding random comments to HTML
  • guessing from timestamps

astro-build-id solves this cleanly with one file.


What it does (v1)

On astro build, the plugin writes a file (by default):

/build-id.txt

Containing a single immutable value, for example:

2026-01-08T19:42:11.341Z

This file is:

  • Static
  • Cache-safe
  • Public-safe
  • Deterministic per build
  • Easy to inspect with curl

What it does NOT do

This plugin deliberately does not:

  • Run at runtime
  • Use databases
  • Read git state
  • Guess CI providers
  • Inject HTML
  • Depend on adapters
  • Expose secrets

It reflects build identity only, nothing else.


Installation

npm install astro-build-id

Basic usage

Add the integration to your astro.config.mjs:

import { defineConfig } from "astro/config";
import astroBuildId from "astro-build-id";

export default defineConfig({
  integrations: [
    astroBuildId()
  ]
});

After build:

dist/build-id.txt

Build ID formats

By default, the build ID is an ISO timestamp.

You can change the format:

astroBuildId({
  format: "unix"
})

Supported formats:

| Format | Example | |------|--------| | iso (default) | 2026-01-08T19:42:11.341Z | | unix | 1736365331 | | short | k0x9f2ab |


Custom filename

astroBuildId({
  filename: "health.txt"
})

Result:

/health.txt

CI / CD integration (recommended)

The most common and powerful usage is to pass a value from CI.

Example (GitHub Actions)

- name: Build
  run: |
    echo "BUILD_ID=${GITHUB_RUN_ID}" >> $GITHUB_ENV
    npm run build
astroBuildId({
  value: process.env.BUILD_ID
})

If value is provided:

  • it is written verbatim
  • it overrides any format
  • whitespace is trimmed safely

This keeps the plugin stateless and explicit.


CDN & caching behaviour

Because the output is static:

  • The file can be cached aggressively
  • It works behind any CDN
  • It works on Cloudflare, Netlify, Vercel, S3, etc.

Example check:

curl https://example.com/build-id.txt

Failure behaviour

If the file cannot be written:

  • A warning is logged
  • The build continues
  • The site is not broken

This plugin must never break a deployment.


Roadmap

Planned for v2 (not in v1):

  • Optional JSON output
  • Multiple IDs (build + deploy)
  • Integration with astro-build-info

v1 intentionally stays minimal.


License

MIT


Author

Built and maintained by Velohost
https://velohost.co.uk/

Project homepage:
https://velohost.co.uk/plugins/astro-build-id/