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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gitlab-json-db

v1.0.31

Published

use a gitlab repository as read/write json-database in the browser (using pipelines)

Downloads

62

Readme

gitlab repository as a read/write json-database for the browser (using pipeline triggers)

Usage

  1. Initialize
$ npm install gitlab-json-db -g
$ mkdir mysite
$ cd mysite
$ git init
$ gdb init
created .gitlab-ci.yml + bin-files + gldb.js

Now us it like this:

		<script src="https://YOURORG.gitlab.io/YOURPROJECT/gldb.js"></script>
		<script>
				var db = gldb({
						trigger: "YOUR_GITLAB_PIPELINE_TRIGGER_URL",
						token: "YOUR_TOKEN",
						url: "https://YOURORG.gitlab.io/YOURPROJECT"
				})
				db.fruits = db.collection("fruits") 
				db.fruits.post({"apple":2}, alert, console.error)
		</script>
  1. Viola, we have our necessary files:
$ ls
bin/config.sh
bin/put
bin/post
bin/delete
gldb.js
.gitlab-ci.yml

Now edit bin/config.sh to define collection-to-repositories mappings (for example fruits points to [email protected]:MYORG/fruits.git)

  1. Lets upload them:
$ git add .
$ git commit -m "1st commit"
$ git push origin master

Trigger & Deploy key

  1. Almost there. Now create a trigger in gitlab, to use the snippet mentioned in the pipeline output above
  1. Now on the database-repository(s) configure a new deploy key, and copy/paste the private value of the keyfile (not .pub) into the (gldb inited) repository:
  1. Also create an environment 'SSH_PRIVATE_KEY'-variable, and copy/paste the private value of the keyfile in there

Now the (gldb inited) has read/write access to your database repositorie(s). Check the pipeline output to verify this.

Done! Please check the previous steps in case things don't work. If things went fine: check the pipelines-log. A pipeline started to create a gitlab page (so gldb.js is accessible for the browser)

Reference

NOTE: all calls return a status (a pipeline is triggered), therefore it's not to be used for realtime output, but rather aftermath.

| function call | comment | |-|-| | db.mycollection.post({"foo":"bar"}, cb, cb_err) | will create item in /mycollection.json | | db.mycollection.put({"id":"kjkj334$", "foo":"bar"}, cb, cb_err) | will update item in /mycollection.json | | db.mycollection.delete({"id":"kjkj334$""}, cb, cb_err) | will delete item in /mycollection.json |

NOTE: reading data is optional: you can expose your jsonfiles to the web by deploying database-repositories (A & B) as gitlab pages.

Why

  • microstack experiment
  • sometimes slow inserts/updates/deletions are good enough.

Pros/cons

  • pro: free, reliable hosting
  • con: writes are slow (so use your browsermemory as database e.g.)