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

goiot

v1.1.13

Published

Swagger API

Downloads

2

Readme

Caafs - playground for building IoT solutions with Microsoft Azure

Donate

Copyright 2018 [Ivan Emilov]

C.a.a.f.s (Care and Alarms facility systems) is cloud based IoT platform/playground that enables building demos, prototypes, showcases or rapidly customizing of different use cases. With C.a.a.f.s, you are able to:

  • Provision and control devices/objects.
  • Get simple statistic about devices/objects.
  • Set filter to collect only delta data form devices/objects
  • Consume live sensor data.
  • Set Rules and trigger alarms.
  • Send Notifcations based on the rules.
  • Manage users.

More details about the application features can be found here.

Applicable for almost every industry but rather suitable and ready to use for the following real life use cases:

  • Control facility systems based on threshold monitoring of sensor values
  • Trend analysis based on automation triggers
  • Notification of temperature irregularities for food services, technical equipment or pharmacy products (like vaccines)
  • Notification of humidity irregularities in the plant industry

This web application is also apprpriate for everyone who loves Node.js, is interested in learning Internet of Things and wants to get familiar with Microsoft Azure. Additionally there is a complete free DeviceClient application developed for this platform.

Please feel free to extend and make suggestions how to improve the application. If you find any bugs, do not hesitate to submit the issues

Note: Currently not recommended for production without doing penetration and load tests. Additional facts:

  1. based on PaaS services -> low maintenance costs
  2. easy to configure and administrate without touching the code -> step by step description
  3. scalable -> on demand
  4. extendible -> extent for commercial use for everyone who is familiar with Node.js
  5. open -> every feature has its API based on Express framework: you are free to develop your own UI or mobile app
  6. secure -> uses token based authorization

Table of contents

Architecture Overview

Preview

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. Before starting, the following azure resources should be deployed and configured:

Prerequisites

  • Azure subscription: https://azure.microsoft.com/en-us/free/
  • Azure Table/Blob Storage
  • Azure IoT HuB
  • Cosmos DB with Mongo DB API projections
  • SendGrid Account
  • Azure WebAPI with App Service plan

Deploy and Configure

Step by step description to deploy and configure the required resources

  1. Create Resource Group
  2. Create and Configure Storage Account
  3. Create and Configure Azure IoT Hub
  4. Create and Configure Azure Cosmos DB
  5. Create and Configure Azure Sendgrid
  6. Create and Configure Azure API App

Run the application locally

  1. Install Node.js on your local machine.
  2. Clone the repository on your local machine
git clone https://github.com/iemilov/caafs-platform.git
  1. Install the required node modules:
npm install
  1. Change the configuration parameters in config.js

Copy the whole content from config.js and store it separtely as backup. You will need it in this state for the final cloud deployment. But in order to start the application locally you should replace everywhere the "process.env" part with the real parameters created in the configuratioon steps. For example:

REAPLACE config.connectionString = process.env['endpointIoTHuB'] WITH config.connectionString = connection string from Step 9

  1. Start the application:
npm start

If you have done everything correct, you should be able to access the API description on swagger UI on:

localhost:3000/docs
  1. Test the application:

After the initial deployment an admin username "[email protected]" is automatic created. In order to use the exposed APIs you will need to get a token first. Make a post request to http://localhost:8001/api/login. You are free to use any tool for testing RESTful APIs. If you want it to test it on the browser go to http://localhost:3000/docs/#!/Users/loginPost an put the following body in the authentication text box: use the initialAdminPassword created in step 13

{
  "username": "[email protected]",
  "password": "intial password"
}

In the response body you should get an answer:

{
        "token": "jwt token" //This token will expire in 24 hours
}

The token expiration time can be changed in auth.js at the bottom of the file:

{
   exp: Math.floor(Date.now() / 1000) + (60 * 60 * 24)
}

From now you can start using the other APIs by using the Authorization paramter in the Header for every request (see example below):

{
        Authorization: Bearer <token you got from the Authentication request>
}

Run the application on Azure

  1. Bring the config.js in the initial state with all "process.env" parameters

  2. Deploy the code to the local git using the credentials created in Step 14 from the configuration steps (see example below)

git remote add apiapp <Git clone URL from Step 14>
git push apiapp master:master

The first deployment can take several minutes. Once the deployment is finished you should be able to see your API app under the following url:

http(s)://NAMEOFYOURAPIAPP.azurewebsites.net/docs
  1. Login through the http://NAMEOFYOURAPIAPP.azurewebsites.net/api/login with the initial username:[email protected] and the initialAdminPassword created in step 13

  2. Get the token and start using the other APIs as in Run the application locally

Note: If you test the APIs on the Browser with the Swagger UI please be sure that you load the main url only with http:// and not https://. When using other tools like postman you can use https://

Running the tests

Currently no automated tests are implemented! It is on the project roadmap.

Usage

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

If you like my work, please consider supporting me for maintaining and developing this application.

Authors

License

This project is licensed under the ISC License - see the LICENSE.md file for details