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

@artbycity/node

v2.0.7

Published

Art By City Node

Downloads

10

Readme

Art By City Node

Description

This project is a server that intercepts and redirects requests to Arweave Gateways, tracks views of accessed content, and provides additional HTTP API endpoints to support the Art By City Protocol.

A unique view is a SHA256 hash of:

  • address Arweave address of this Art By City Node
  • ip of requesting host
  • txid of requested transaction
  • date of access

An Art By City Node exposes a few endpoints, explained below. These endpoints allow for requesting the current view count of a txid, a daily view count report, and a daily trending report ordered by descending view counts. These view counts will be used in the future to reward creators based on the engagement of their creative content.

Requirements

  • node v16.13.2
  • postgres >= v9.5

Dev Requirements

Install

$ npm i --save @artbycity/node

Environment Variables

  • Postgres Config
    • DB_HOST
    • DB_PORT
    • DB_USER
    • DB_PASS
    • DB_NAME Database name to use

Run Programmatically

import ArtByCityNode from '@artbycity/node'

const abc = new ArtByCityNode('<Arweave Address of this Node>')
await abc.start()

Or with NuxtJS/NextJS/etc Server Middleware

import ArtByCityNode from '@artbycity/node'

const abc = new ArtByCityNode('<Arweave Address of this Node>')
  .app
  .callback()

export default abc

Rest API

  • GET /:txid Retrieve content from Arweave via Meson Network by txid

    • Status 302
    • Redirect to content on Meson Network
  • GET /views/:txid Fetch view count for a given txid

    • Status 200
    • Body 999
  • GET /views/report/:date

    • Fetch daily report for a given date (format: M-D-YYYY e.g. 5-31-2022)
    • Status 200
    • Body
      {
        "date": "5-31-2022",
        "views": [
          {
            "nodeAddress": "EGy6I7YCKqEH8aA7IOA2HEjqeOsHqu9W4c67SFdVnmo",
            "txid": "MffAQBIB8vdKQ955CzmGObRzOMaP2_xRDUA3DqXTkt4",
            "hash": "0db4e729b1eddba1594e2bb32951393f625521ec8887cc949fba415a8d432571",
            "type": "image/png"
          },
          {
            "nodeAddress": "EGy6I7YCKqEH8aA7IOA2HEjqeOsHqu9W4c67SFdVnmo",
            "txid": "f-vKmV_9UuHgUINocW8G8YK7-jKQoUwFaI3nIOiNfc0",
            "hash": "474c65cbeedb65cd12bf7a8c7dc16cac04d8edb47176b91a2e02811afe92c200",
            "type": "image/jpeg"
          },
          {
            "nodeAddress": "EGy6I7YCKqEH8aA7IOA2HEjqeOsHqu9W4c67SFdVnmo",
            "txid": "dAzlR42uYVMkBtf9fD1KfZCc1D-cosidfvCnMVcmq3Q",
            "hash": "50cf432f83eafd9facd07ea2a968bbdd4c341310d3f4617fd7f9ae022ea18e7d",
            "type": "application/json"
          }
        ]
      }
  • GET /views/trending/:date

    • Fetch trending list ranked by view count for a given date (format: M-D-YYYY e.g. 5-31-2022)
    • Status 200
    • Body
      {
        "date": "5-31-2022",
        "rankings": [
          {
            "txid": "f-vKmV_9UuHgUINocW8G8YK7-jKQoUwFaI3nIOiNfc0",
            "type": "image/jpeg",
            "views": 8
          },
          {
            "txid": "dAzlR42uYVMkBtf9fD1KfZCc1D-cosidfvCnMVcmq3Q",
            "type": "application/json",
            "views": 8
          },
          {
            "txid": "MffAQBIB8vdKQ955CzmGObRzOMaP2_xRDUA3DqXTkt4",
            "type": "image/png",
            "views": 1
          }
        ]
      }
  • GET /stats/summary

    • Fetch summary of dapp stats
    • Body
      {
        "users":"38",
        "dappUsers":"37",
        "artists":"29",
        "publications":"139",
        "transactions":"27415",
        "dappTransactions":"405",
        "likesCount":"72",
        "likesTotal":"26400000000",
        "tipsCount":"11",
        "tipsTotal":"312800000000",
        "networkFees":"124845331418"
      }