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

@appwrite.io/cdn-for-astro

v1.0.0

Published

Route caching for Astro sites hosted on Appwrite

Readme

Appwrite CDN for Astro

NPM Version Build Status License Discord

Official Appwrite CDN cache adapter for Astro 🚀

This package brings route caching to Astro sites hosted on Appwrite. Cache hits are served by the Appwrite CDN, so the site's function is never invoked for them.

Appwrite

Installation

npm install @appwrite.io/cdn-for-astro

Appwrite Sites runs Astro through @astrojs/node, which stays the adapter. This package supplies the cache provider next to it:

// astro.config.mjs
import { cacheAppwrite } from '@appwrite.io/cdn-for-astro';
import node from '@astrojs/node';
import { defineConfig } from 'astro/config';

export default defineConfig({
  adapter: node({ mode: 'standalone' }),
  cache: {
    provider: cacheAppwrite(),
  },
  routeRules: {
    '/blog/[...path]': { maxAge: 300, swr: 60 },
  },
});

Astro.cache.set(), routeRules and cache.invalidate() then behave as documented. Cache directives are sent as Appwrite-CDN-Cache-Control and cache tags as Appwrite-CDN-Cache-Key; the Appwrite edge rewrites both into whatever the CDN in front of the domain speaks, and cache.invalidate() purges by cache key or by path through the Appwrite API.

For cache.invalidate() to be allowed to purge, the site's dynamic API key needs the proxy.invalidations.write scope (Appwrite console → your site → Settings → Scopes). Caching itself works without it.

A runnable site covering all of this lives in examples/basic.

Requirements

  • Astro ^7.0.0
  • Node.js >=22.12.0, which is what Astro 7 itself requires

Options

Every option is optional; the defaults suit a site deployed on Appwrite Sites.

| Option | Default | Description | | ----------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | domain | the domain of the request being served | Domain(s) purged by cache.invalidate(). A purge only clears the domain it names, so a site on several domains has to list them. | | endpoint | APPWRITE_FUNCTION_API_ENDPOINT, then APPWRITE_SITE_API_ENDPOINT | Appwrite API endpoint. Required, so pass it when neither variable is set. | | projectId | APPWRITE_FUNCTION_PROJECT_ID, then APPWRITE_SITE_PROJECT_ID | Appwrite project ID. | | apiKey | the x-appwrite-key request header, then APPWRITE_API_KEY | Key used to invalidate. Prefer the default: a value set here is baked into the build output. | | noStore | true | Send no-store for responses that declare no cache intent, so the CDN's default TTL cannot cache a route that never asked for it. |

Exports

import { cacheAppwrite, AppwriteCacheError } from '@appwrite.io/cdn-for-astro';
import { cacheAppwrite } from '@appwrite.io/cdn-for-astro/cache'; // same thing

AppwriteCacheError is what cache.invalidate() throws when it cannot work out which domain, endpoint, project or key to purge with. Catch it to tell a misconfiguration apart from a failed API call:

try {
  await cache.invalidate({ tags: ['products'] });
} catch (error) {
  if (error instanceof AppwriteCacheError) {
    // Nothing was sent: the provider could not resolve what to purge.
  }
  throw error;
}

Good to know

  • Cache keys are normalized. The edge splits Appwrite-CDN-Cache-Key on whitespace and re-joins the keys with commas for the CDN's Cache-Tag, so a tag containing whitespace, a comma or a non-ASCII character is percent-encoded — identically on the response and on the purge. A tag longer than 128 characters once encoded cannot be named by a purge, so it is dropped with a warning; the response is still cached.
  • A purge is one API call per reference per domain, and invalidations are rate limited to 60 per minute.
  • A path purge clears the exact path, not copies cached under the same path with a query string. Tag those and purge by tag instead.
  • To purge a whole domain, call createInvalidation({ domain, type: 'all' }) directly — Astro's invalidate() has no equivalent.
  • Caching is a no-op in astro dev. Astro disables it in dev, so inspect headers against a build.

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for the development setup, and SECURITY.md for reporting a vulnerability.

Support

License

MIT — see LICENSE.