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

cranlike

v0.17.17

Published

High-performance R package server

Downloads

1,716

Readme

CRANLIKE

High-performance R package server

Description

cranlike is a package server providing a simple API for storing R packages and hosting cran-like repositories.

Packages are stored in the repository of a particular user or organization, and the server automatically generates the required repository index files from the database. This allows R users to install packages from a particular author or organization using only the repo parameter in install.packages().

The implementation is designed to be fast and extensible, with the potential expose additional filters or services, and scale up to large repositories.

SYNOPSIS

The /api endpoint exposes a simple REST api to store R packages. Here <type> must be one of src, win or mac.

GET,POST,DELETE
  /api/<user>/<package>/<version>/<type>

The /repos endpoint exposes the CRAN-like directory structure and package index files for a given user. The R user can simply set the repos parameter in install.packages() or available.packages():

GET
  /repos/<user>/src/contrib
  /repos/<user>/bin/windows/contrib
  /repos/<user>/bin/macosx/contrib/

For example the R user would use:

available.packages("http://myserver.com/repos/jeroen")
install.packages("curl", repos = "http://myserver.com/repos/jeroen")

Running the server

The easiest way to start your a server is to clone the this and run docker compose:

docker-compose up

Alternatively if you locally have mongodb and nodejs installed you can use:

./run-local.sh

Debugging the database

All data is stored in two mongodb collections:

  • The packages collection in cranlike stores description fields for each package, including an MD5sum field that has a unique hash of the file.
  • The gridfs files collection stores the package blobs, where the primary _id is the md5 of the file.

We don't store raw files on disk. To read raw data from the db in R you can use mongolite package:

library(mongolite)
packages <- mongolite::mongo(db = 'cranlike', collection = 'packages',
  url = "mongodb://root:example@localhost")
packages$find()

To inspect the table with the files:

bucket <- mongolite::gridfs(db = 'cranlike', prefix = 'files',
  url = "mongodb://root:example@localhost")
bucket$find()