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

@studio-fes/layer-craft

v0.1.0

Published

Nuxt layer for Craft CMS integration with GraphQL and advanced caching capabilities. Extends `@studio-fes/layer-base`.

Readme

@studio-fes/layer-craft

Nuxt layer for Craft CMS integration with GraphQL and advanced caching capabilities. Extends @studio-fes/layer-base.

Features

🔌 GraphQL Integration

  • nuxt-graphql-middleware: Full-featured GraphQL client
  • Automatic Query Imports: Auto-import .gql files from queries/ directories
  • Type-Safe: Full TypeScript support with generated types
  • Schema Download: Automatic GraphQL schema download in development

⚡ Caching

  • nuxt-multi-cache: Multi-level caching system
  • Smart Cache Tags: Automatic cache tag generation
  • Server-side Caching: Optimize performance with intelligent caching

🎨 Craft-Specific Features

  • CraftImage Component: Optimized image handling for Craft assets
  • SEO Composables: Easy SEO management with useCraftSEO
  • Entry Composables: Simplified entry fetching with useCraftEntry
  • Preview Mode: Built-in Craft preview token support

Installation

npm install @studio-fes/layer-craft

This will automatically include @studio-fes/layer-base and its features.

Usage

Extend this layer in your nuxt.config.ts:

export default defineNuxtConfig({
  extends: ['@studio-fes/layer-craft'],
  
  graphqlMiddleware: {
    graphqlEndpoint: 'https://your-craft-site.com/api',
    downloadSchema: true,
  }
})

Environment Variables

NUXT_GRAPHQL_MIDDLEWARE_GRAPHQL_ENDPOINT=https://your-craft-site.com/api
NUXT_CACHE_ENABLED=true

Components

<CraftImage>

Optimized image component for Craft CMS assets with transforms.

<template>
  <CraftImage 
    :image="entry.image" 
    :transform="{ width: 800, height: 600 }" 
    alt="Image description"
  />
</template>

Composables

useCraftEntry()

Fetch Craft entries with caching and error handling.

const { data: entry, error } = await useCraftEntry({
  slug: route.params.slug,
  section: 'pages'
})

useCraftSEO()

Generate SEO metadata from Craft entry data.

const { title, description, image } = useCraftSEO(entry)

useHead({
  title: title,
  meta: [
    { name: 'description', content: description }
  ]
})

GraphQL Queries

Place your .gql files in the queries/ directory:

# queries/Entry.gql
query Entry($slug: [String]) {
  entry(slug: $slug) {
    id
    title
    ... on pages_page_Entry {
      content
      seoTitle
      seoDescription
    }
  }
}

Use them in your components:

const { data } = await useAsyncQuery(Entry, {
  slug: route.params.slug
})

Server Utils

createCacheTags()

Generate cache tags for multi-cache integration:

import { createCacheTags } from '#cache-utils'

const tags = createCacheTags('entry', entryId)

Preview Mode

The layer includes automatic support for Craft's preview tokens. Preview requests are handled automatically through the preview plugin.

Configuration

The layer extends the base configuration with:

{
  modules: [
    'nuxt-graphql-middleware',
    'nuxt-multi-cache'
  ],
  graphqlMiddleware: {
    serverApiPrefix: '/gql',
    clientCache: {
      enabled: true
    },
    autoImportPatterns: ['./queries/**/*.gql']
  }
}

Development

# Install dependencies
pnpm install

# Develop with playground
pnpm dev

# Download GraphQL schema
# Set graphqlEndpoint in nuxt.config.ts, then run:
pnpm dev

# Build
pnpm build

# Lint
pnpm lint

Example Usage

See the craft example for a complete implementation.

Extending

You can further customize this layer:

export default defineNuxtConfig({
  extends: ['@studio-fes/layer-craft'],
  
  graphqlMiddleware: {
    graphqlEndpoint: process.env.NUXT_GRAPHQL_MIDDLEWARE_GRAPHQL_ENDPOINT,
    downloadSchema: 'dev-only',
    clientCache: {
      enabled: true,
      maxAge: 1000 * 60 * 5 // 5 minutes
    }
  },
  
  runtimeConfig: {
    multiCacheEnabled: true
  }
})

License

MIT