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

@eleven-am/golem-render

v0.1.0

Published

Nest-native SPA hosting and route metadata rendering for Golem applications

Readme

@eleven-am/golem-render

Nest-native hosting for a compiled single-page application, with optional per-route Open Graph and Twitter metadata. It serves the frontend shell without taking over backend routes and lets ordinary Nest controllers resolve link-preview metadata.

Install

npm install @eleven-am/golem-render

The package currently targets Nest's Express adapter.

Host a frontend

import { Module } from '@nestjs/common';
import { GolemRenderModule } from '@eleven-am/golem-render';

@Module({
  imports: [
    GolemRenderModule.forRoot({
      client: 'dist-web/client',
    }),
  ],
})
export class AppModule {}

client can use any bundle layout; it only needs to contain index.html. The module:

  • serves existing static files without directory indexes, redirects, or dotfiles;
  • gives content-hashed assets a one-year immutable cache and other files no-cache;
  • serves the shell for deep browser routes and HEAD requests;
  • returns real 404s for missing assets, non-HTML requests, and non-GET requests;
  • leaves /api and /graphql to backend handlers by default;
  • fails at startup with the resolved absolute path when the bundle is missing.

Change the reserved prefixes or index filename explicitly when necessary:

GolemRenderModule.forRoot({
  client: 'frontend/output',
  index: 'shell.html',
  reserved: ['/api', '/graphql', '/health'],
})

Default metadata

GolemRenderModule.forRoot({
  client: 'dist-web/client',
  defaults: {
    title: 'Readable',
    description: 'Save anything. Read it later. Listen anywhere.',
    image: '/og-default.png',
  },
})

The index file is read and parsed once at startup but is never modified. Each shell response is rendered in memory and sent with Cache-Control: no-cache. Relative URLs pass through unchanged. Set baseUrl only when they should be expanded to absolute URLs.

Route metadata

@RenderRoute is a real Nest GET route. Put it on a method in an ordinary controller and use Nest's own parameter decorators, pipes, guards, interceptors, filters, and request-scoped dependencies.

import { Controller, Headers, Param } from '@nestjs/common';
import { GolemRenderModule, RenderRoute } from '@eleven-am/golem-render';

@Controller()
export class ArticleRenderController {
  constructor(private readonly prisma: PrismaService) {}

  @RenderRoute('/article/:id')
  async article(
    @Param('id') id: string,
    @Headers('user-agent') userAgent: string,
  ) {
    const article = await this.prisma.article.findUnique({
      where: { id },
      select: { title: true, excerpt: true, image: true, wideImage: true },
    });
    if (!article) return null;
    return {
      title: article.title,
      description: article.excerpt,
      image: /Twitterbot/i.test(userAgent ?? '') ? article.wideImage : article.image,
    };
  }
}

The application owns the query and its disclosure policy. Metadata routes do not add caller authorization or Golem policy scoping. This makes anonymous link unfurling possible; return only information that is safe for anyone holding the URL.

Returning null or undefined, or throwing, renders the configured defaults. Errors are logged and never turn the shell into a 500 response. The SPA shell renders without authentication and handles its own application authentication after boot.

Multiple URL patterns can share one method:

@RenderRoute('/m=:name')
@RenderRoute('/movie/:name')
movie(@Param('name') name: string) {
  return { title: name };
}

Nest owns route ordering. Declare wildcard routes last, as with any other Nest controller.

Custom metadata

return {
  title: article.title,
  description: article.excerpt,
  image: article.image,
  meta: {
    'og:type': 'article',
    'article:published_time': article.publishedAt.toISOString(),
    'twitter:card': 'summary',
    'og:description': null,
  },
};

meta is merged over the shorthand-generated tags. A null value deletes a tag. All names and values are HTML-escaped before interpolation. URL values are never derived from the request Host header.

License

GPL-3.0