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

@hermes/server

v0.1.0

Published

Hermes is a real-time data framework for MongoDB + React. It uses native MongoDB change streams and WebSockets to ensure that the state of your React app reflects the content of your database in real-time.

Downloads

2

Readme

@hermes/server

Hermes is a real-time data framework for MongoDB + React. It uses native MongoDB change streams and WebSockets to ensure that the state of your React app reflects the content of your database in real-time.

Hermes comes in 2 parts:

  • @hermes/server: creates MongoDB change stream listeners and handles subscriptions from React.
  • @hermes/react: provides a useHermes hook to access real-time data.

Server

Install with yarn add @hermes/server or npm install @hermes/server.

In your code, initialise the server with valid options:

import hermes from "@hermes/server";

hermes({
  // Port to serve on (default 9000)
  port: 1234,

  // SRV of your MongoDB instance
  srv: "mongodb+srv://...",

  // Name of your desired database
  db: "my_db",

  // Mongo collection whitelist (see below)
  whitelist: {
    users: [
      "username",
      "name.firstName",
      "name.lastName",
    ]
  }
});

Whitelist

When initialising your server, you need to explicitly whitelist the collections and fields from documents in those collections before they are accessible from the client.

This is to prevent leaking sensitive information from your database by mistake or by manipulation from the client.

You can think of it like a MongoDB projection: only fields included here will be present in returned documents. If a collection is not included in the whitelist, no documents from that collection will be accessible.

Only dot notation is supported, nested fields are not.