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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fasterfront/cms

v0.0.53

Published

Type-safe Remix `loader` for pages built in Faster Front's CMS.

Downloads

54

Readme

Faster Front CMS

Type-safe Remix loader for pages built in Faster Front's CMS.

Installation

pnpm add @fasterfront/cms

Usage

For generating the types according to the latest version of your DB:

pnpm ff

You can also add this directly to your dev script on package.json eg:

{
  "scripts": {
    "dev": "ff && remix dev"
  }
}

Let's suppose you have a /team route on your Remix application that looks like this:

{
  "en-US": {
    "meta": {
      "title": "Team",
      "description": "Learn more about Faster Front team!"
    },
    "team": {
      "type": "list",
      "value": {
        "entity": "member",
        "fields": ["id", "fullName", "avatar", "bio"],
        "sortOrder": {
          "property": "fullName",
          "direction": "asc"
        }
      }
    }
  }
}

The member entity looks like this:

type Member = {
  // CMS: Primary key (could be used for creating a /team/:id route)
  id: string
  // CMS Type: Text
  fullName: string
  // CMS Type: Image
  avatar: {
    alt: string
    src: string
    srcSet: string
    sizes: string
  }
  // CMS Type: RichText
  bio: string
}

On routes/_layout/team/index.tsx, you can just use usePageData for getting the data (fully typed!):

import { usePageData } from '@fasterfront/cms'
import Image from '@fasterfront/image'

export { pageMeta as meta } from '@fasterfront/cms'
export { pageLoader as loader } from '@fasterfront/cms/loaders.server'

type Path = '/team'

export default function Team() {
  const { meta, team } = usePageData<Path>()

  return (
    <section>
      <h1>{meta.title}</h1>
      <p>{meta.description}</p>
      <ul>
        {team.map((member) => (
          <li key={member.id}>
            <div>
              <Image data={member.avatar} />
              <span>{member.fullName}</span>
            </div>
            <div dangerouslySetInnerHTML={{ __html: member.bio }} />
          </li>
        ))}
      </ul>
    </section>
  )
}

That's it! Simple and fun!