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

openframe-apiserver

v0.4.2

Published

The Openframe API Server.

Downloads

12

Readme

Openframe API

The Openframe API server.

Note: This repo is under active development. The API is likely to change.

Design Notes

This version of the API Server is built on loopback. The idea is to work towards a data model which supports the basic goals of Openframe, guided by a handful of pilot use cases.

At present, the API provides a basic RESTful interface to the data model. It represents the API Server (REST) in the diagram below. The Global Event Bus lives in a separate repository, Openframe-PubSubServer.

alt tag

The block diagram above represents a proposed architecture for the Openframe platform. It will continue to evolve as development on the project progresses.

Running an Openframe API Server

This package provides a cli which can be used to start up a server. Install the package with npm, and run openframe-apiserver to start it.

$ sudo npm install -g openframe-apiserver

# start the server...
$ openframe-apiserver

For DEBUG output, set the DEBUG env var:

# output ALL debug (includes a lot due to loopback)
$ DEBUG=* openframe-apiserver

# output openframe-specific debug
$ DEBUG=openframe:* openframe-apiserver

If you're not running an instance of the pubsub server separately, you can start up an instance of that concurrently by passing the -p parameter.

# start the API server and PubSub server
$ openframe-apiserver -p

Various configuration options can be set using a .env file using the -f flag. An example .env file might specify the port on which to expose the API server, configure the datasource, and specify a host and port on which the API server can expect to find the pubsub server. Take a look at the .env.example file in the project root.

# in .env file...
PORT=1234

# indicate how the API server should connect to the pubsub server
PS_HOST='pubsub.openframe.io'
PS_PORT=2345

Local Development

The codebase was largely written following the loopback docs' recommendations and examples. By default the API server will use an in-memory data store and will generate some dummy data (a few users, a few artworks). To run locally, clone the repo, install the npm dependencies, and run npm start.

# (you'll probably fork the repo, and clone your fork)
$ git clone https://github.com/OpenframeProject/Openframe-APIServer.git
$ cd Openframe-APIServer
$ npm install
$ npm start

This repo includes the pubsub server as a dependency. Running npm start will spin up an instance of the pubsub server on port 8889. If you want to start only the API, run npm run start-api. Likewise, if you want to run only the pubsub server, run npm run start-pubsub.

REST API Docs

Loopback provides auto-generated documentation (via swagger) based on the data model definitions. After starting up the server locally, visit localhost:8888/explorer/ to view the docs and test out the API.

License

The code in this project is licensed under the GNU AGPLv3, a copyleft license that promotes server-based software freedom. For me info, see the description here, or take a look at the LICENSE included in the repo.