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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gplatform/settings

v1.2.2

Published

gPlatform Production Settings

Downloads

60

Readme

gPlatform Production Settings

Settings - Principles

  • Easy to use in Development
  • Easy to update in Production

YouTube Tutorial

Features

  • Node.JS Configuration
  • Command line interface to create settings folder
  • Command line interface to build .env for docker deploy
  • Atomic Object Merging / Partial Updates
  • Environment Variables
  • Command Line Arguments
  • Config Validation

How can I use this?

# Recommended app folder structure
- package.json         # NodeJS package
- src                  # Source code
  - app.js             # app entry point
  - settings           # settings module
    - index.js         # module config
    - settings.json    # default values
    - schema.js        # validation schema
# Install gplatform module
$ yarn add @gplatform/settings
# In ./src | Creates ./settings folder
$ npx @gplatform/settings --init MY_APP_PREFIX
# In ./src | Create .env file for production docker
$ npx @gplatform/settings --env > production.env

Usage | Variants

# Run with defaults
$ node src/app.js
# Run with defaults updating service.port
$ node src/app.js --service-port 9000
# Run with defaults updating service
$ node src/app.js --service-port 9000 --service-host 10.0.0.10
# Run with defaults updating service.host
$ MY_APP_PREFIX_service_host="prod.mywebsite.com" \
    node src/app.js
# Run without defaults updating all from env variable
$ MY_APP_PREFIX='{"service":{"host":"local","port":"27017"}' \
    node src/app.js

Manual - How can I use this?

$ yarn add @gplatform/settings
// add ./settings/index.js
const { load } = require('@gplatform/settings')
const defaults = require('./settings.json')
const schema = require('./schema.js')
const appName = 'MY_APP_PREFIX'

module.exports = load({
  defaults,
  schema, // Joi Schema - Optional
  commandLineInterface: true, // Experimental
  app: process.env[appName],
  variables: process.env,
  regex: new RegExp('^' + appName + '_')
})
// add ./settings/settings.json
{
  "name": "Gary Ascuy Anturiano",
  "service": {
    "host": "localhost",
    "port": "27017"
  },
  "mongo": {
    "uri": "mongodb://localhost:27017/prod"
  }
}
// add ./settings/schema.js
const joi = require('joi')

module.exports = {
  name: joi.string().min(3).max(30).required(),
  service: {
    host: joi.string().required(),
    port: joi.number().integer().min(0).max(65535)
  },
  mongo: {
    uri: joi.string().required()
  }
}
// add ./app.js
const express = require('express')
const { get } = require('./settings')
const { log } = console
const app = express()

const name = get('name')
const mongoUri = get('mongo.uri')
const {host, port} = get('service')

app.get('/', (req, res) => res.send(name))
app.listen(port, host, () => {
  log(`Server Created, Ready to listen at ${host}:${port}`)
})
# Run application at port 8000
$ node app.js --service-port 8000

Development - Contribution

To update the code you can run tests in watch mode

$ yarn test -w

After complete you can create a build using

$ yarn build

Example

  • In repo at example/main.js you can find a example
$ git clone https://github.com/ziosd/settings.git
$ cd settings
# Basic execution
$ yarn start
# Basic execution
$ yarn start
# Using args as cli
$ yarn start --service-port 5600 --service-host localhost
# Using env variables
$ MY_APP_PREFIX_service_port=8000 \
    MY_APP_PREFIX_service_port=gplatform.me \
    yarn start

Coming soon

  • Docker config generation
  • More examples
  • Better video tutorial

License

MIT