Git Product home page Git Product logo

airqmon-api's Introduction

Airqmon API

GraphQL API and worker service for the Airqmon app.

Data providers and data stores

The API currently only supports Airly as a data provider but can be easily extended by adding more data sources. The Airly data provider servers as an example implementation of the Apollo RESTDataSource, while the MongoDB data store as an example of the IDataStore interface.

Build

Install the dependencies by running yarn and then run yarn run build to compile TypeScript.

Deploy

The easiest way to deploy and run the Airqmon server components is to use a PaS provider like Railway, Render, Heroku or any other PaaS that supports Node.js buildpack for deployment.

If you want a self-hosted solution, check Dokku. To simplify the setup, you can use the DigitalOcean 1-Click App with Dokku.

MongoDB

Whatever you choose, you will also need a MongoDB database to cache the sensor stations and measurements.

Render allows running MongoDB as a private service, Railway to add a MongoDB service, MongoDB Atlas integrates easily with Heroku applications, and Dokku has an excellent plugin for managing a self-hosted MongoDB database.

Cron Job Monitoring

The Agenda worker can make an HTTP request each time a task completes. You can use a service like Healthchecks.io to monitor whether the stations-sync tasks succeeded.

Settings

The API server and tasks worker use Convict for loading and managing configuration. See the common/config.ts for schema and default options.

Create a production.json file in the config directory and provide at least the API key and MongoDB connection string.

{
  "apiKeys": {
    "airly": {
      "key": "YOUR_AIRLY_API_KEY",
      "rateLimitDay": 1000,
      "rateLimitMinute": 50
    }
  },
  "mongodb": "MONGODB_CONNECTION_URI"
}

Alternatively, you can use the environment variables to configure some of the settings.

airqmon-api's People

Contributors

jsynowiec avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.