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

amphora

v8.4.2-dev.9.0

Published

An API mixin for Express that saves, publishes and composes data with the key-value store of your choice.

Downloads

1,023

Readme

Introduction

illustration of an amphora

"A new way to organize, edit, and deliver the web, one component at a time."

CircleCI Coverage Status

Powering New York Magazine, Vulture, The Cut, Grub Street.
Created by New York Media.

Table of Contents

Introduction

Amphora is a mixin for Express that:

  • Composes components into renderable pages
  • Uses any key-value store of your choice (e.g., Mongo, Redis, LevelDB, etc.)
  • Provides an API for managing instances of components, uris, and pages

Components are reusable, configurable, self-contained bits of the web.

Amphora is a core part of New York Media's Clay project, an open-source content management system.

It follows semver and is stable as of v1.0.0.

Installation

npm install --save amphora

Usage

Clay separates concerns into two main areas: components and sites. Create two new directories in your project:

/components  (where your custom components live)
/sites       (for site-specific settings, routes, and assets)

In your project's main server file (e.g. app.js), instantiate a new Amphora instance.

var amphora = require('amphora'),
  port = process.env.PORT || 3000;

return amphora()
  .then(function (server) {
    server.listen(port);
  });

For additional configuration, you may pass in an Express app / router. You can also override the default templating engine(s) with your own.

var app = require('express')(),
  amphora = require('amphora'),
  amphoraHtml = require('amphora-html'),
  port = process.env.PORT || 3000,
  env;

// add project-specific settings to your app
app.set('strict routing', true);
app.set('trust proxy', 1);

// add custom settings to your templating engine
env.addGlobal('projectName', process.env.PROJECT_NAME);

return amphora({
  app: app,
  renderers: {
    default: 'html',
    html: amphoraHtml
  }
}).then(function (server) {
  server.listen(port);
});

How to create a component

Components in Clay have the following structure:

/component-name     unique name of your component
    template.handlebars   your template
    schema.yml            describes how the component's data is edited

All of these files are optional.

How to create a template

The template you create is dependent on whichever renderer you'd like to use. The Clay Core team supports an HTML renderer using Handlebars template, but the choice is yours. Either request a renderer or build one on your own!

How to create a schema

Kiln uses a component's schema.yml to determine how it is edited. Visit the Kiln wiki for examples of how to write schema files for your components.

Contribution

Fork the project and submit a PR on a branch that is not named master. We use linting tools and unit tests, which are built constantly using continuous integration. If you find a bug, it would be appreciated if you could also submit a branch with a failing unit test to show your case.

Advanced Topics