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

stellar-integration

v1.4.12

Published

GamesLabs Stellar integration module

Readme

GamesLabs Stellar Integration Framework

Quick start

You need to have a config.json configuration file in your project root folder. Here is the default configuration:

{
	"rabbitmq": "amqp://localhost"
}

Instantiating stellar

const stellar = require('stellar-integration')

// listen to port 1234
const PORT = 1234

// code

stellar.listen(PORT)

Importing DSL elements

const redirect = stellar.redirect
const parallel = stellar.parallel
const rpc = stellar.rpc
const push = stellar.push
const peek = stellar.peek
const pop = stellar.pop
const pipeline = stellar.pipeline

Creating a router

let router1 = stellar.router()
let router2 = stellar.router('/prefix')

Declaring a route

Simple body writer:

router.get('/hello')
			.then(function(req, res) {
				res.body = "Hello world"
				this.next(res) // Continue the pipeline
			})
// Available router methods: get,post,put,delete,when

Stack

You can push and peek/pop requests through the pipeline

router.get('/hello')
			.then(function(req, res) {
				res.body = "Hello world"
				this.next(res) // Continue the pipeline
			})
			.then(push())
			.then(function(req, res) {
				res.body = 'RANDOM'
				this.next(res)
			})
			.then(pop()) // body is now "Hello World"

Redirecting

router.get('/google')
			.then(redirect('https://google.com'))
// GET request to post
router.when('/get-to-post/:id', 'GET')
			.then(redirect('https://requestb.in/1glh67p1', function(req) {
				req.method = 'POST'
				req.body = {
					id: req.params.id,
					filter: req.query.filter || 'default'
				}
			}))

Processing parallel requests

// error if one parallel endpoint fails
router.get('/parallel')
			.then(
				parallel()
					.with(redirect(ENDPOINT_1))
					.with(redirect(ENDPOINT_2), {default: {hello: "ko"}})// default return value
					.with(redirect(ENDPOINT_3), {default: {hello: "ko"}, timeout: 1}) // default value and timeout (ms)
					.aggregate(function(results, res) {
						res.body = [{aggregate: results.map((r) => r.body)}]
						this.next(res)
					})
			)
// do not break the pipeline if an error occurs
router.get('/parallel')
			.then(
				parallel()
					.with(redirect(ENDPOINT_1))
					.with(redirect(ENDPOINT_2), {default: {hello: "ko"}})// default return value
					.with(redirect(ENDPOINT_3), {default: {hello: "ko"}, timeout: 1}) // default value and timeout (ms)
					.aggregate(function(results, res) {
						res.body = [{aggregate: results.map((r) => r.body)}]
						this.next(res)
					}, {exitOnError: false})
			)

Resilient Remote Procedure Calls

router.post('/rpc')
	.then(rpc("users.createUser"))

// Example with get request
router.get('/rpc')
			// Transform request, create our user
			.then(function(req, res) {
				res.body = {
					name: req.query.name || "toto"
				}
				this.next(res)
			})
			// rpc to (users).createUser({name: 'toto'})
			.then(rpc("users.createUser"))

// with timeout (in ms)
router.get('/rpc-timeout')
			// Transform request, create our user
			.then(function(req, res) {
				res.body = {
					name: req.query.name || "toto"
				}
				this.next(res)
			})
			// rpc to (users).createUser({name: 'toto'})
			.then(rpc("users.createUser", {timeout: 100}))

Here is an example of the users service handling the rpc calls:

let events = require('stellar-integration').events
let listen = events.listen('users', 100) // Handle at max 100 rpc calls at once

listen('createUser', (user, callback) => {
	let user = {name: user.name, id: Math.random().toString()}
	callback(user)
})

Events

router.post('/event')
	.then(event("users.notify"))

// Example with get request
router.get('/event')
			// Transform request, create our user
			.then(function(req, res) {
				res.body = {
					name: req.query.name || "toto"
				}
				this.next(res)
			})
			// rpc to (users).createUser({name: 'toto'})
			.then(event("users.notify"))

Here is an example of the users service handling the event calls:

let events = require('stellar-integration').events
let listen = events.listen('users', 100) // Handle at max 100 events at once

listen('notify', (user, callback) => {
	console.log('Notifying user', user)
	callback() // so the event queue knows we are done processing the event
})

Pipelines

You can use the pipeline dsl to create pipelines:

let myPipeline = pipeline()
		.then(function(req,res) {
			res.body = 'Hello'
			this.next(res)
		})
		.then(function(req,res) {
			res.body = req.body + ' World'
			this.next(res)
		})
		.build()

router.get('/hey')
			.then(myPipeline)

Split

You can use the clause and split dsl to create splits:

let clause = stellar.clause

let myPipeline = pineline()
		.then(function(req,res) {
			res.body = 'Hello'
			this.next(res)
		})
		.split([
			clause(function(req) {return req.body == 'Hello'}, function(req, res) {
				res.body += ' world'
				this.next(res)
			}),
			clause(function(req) {return req.body != 'Hello'}, function(req, res) {
				res.body = 'This should not happen...'
				this.stop(res)
			})
		])
		.build()

router.get('/split')
			.then(myPipeline)

Plugins

WIP Available plugins:

  • authentication
  • authorization
  • circuit breaker