Skip to content

tgranz/SparkAlerts

Repository files navigation

SparkAlerts

SparkAlerts is a simple, secure API frontend to easily access the National Weather Wire Service Open Interface (NWWS-OI) via XMPP.

Built for and used in Spark Radar.

SparkAlerts is still in BETA and should not be used in production yet.

If this guide contains errors or needs refinement please open an issue.


Why SparkAlerts?

  • Simple. SparkAlerts requires little setup and integrates right in with your current environment.
  • Stable. SparkAlerts is actively maintained and supported by the community.
  • Lightweight. SparkAlerts runs on few files dependencies.
  • Secure. SparkAlerts was built with security in mind, using CORS and API keys by default.
  • FOSS. SparkAlerts is free to use for everyone and open source. If you would like to support SparkAlerts, you can donate here.

Run

You will need an NWWS-OI account, which can be requested here. To learn more about the NWWS, see here.

  • Setup .env file.

  • Install the necessary packages with npm install.

  • Run the server with node index.js.


Environment Setup

To securely store your XMPP credentials, you must create a .env file in the working directory of the code. If you don't have a NWWS-OI username and password, request one here.

Fill out your .env file in the same directory as index.js and fill out the values XMPP_USERNAME and XMPP_PASSWORD.

XMPP_USERNAME=XXXX.XXXX
XMPP_PASSWORD=XXXXXXXX

Configuration File

To set your settings, add the following template code to a config.json in the working directory of the code.

{
	"expressPort": 8433,
	"allowNoOrigin": false,
	"domainWhitelist": [
		"https://sparkradar.app",
		"http://localhost:5173"
	],
	"apiKeys": {
		"YOUR_API_KEY": {
			"name": "Development API Key",
			"rateLimit": 100,
			"whitelist": [],
			"lastUsed": null,
			"active": true
		}
	},
	"rateLimit": {
		"windowMs": 900,
		"defaultMax": 30
	},
	"nwwsoi": {
		"resource": "SparkAlerts NWWS Ingest Client",
		"maxReconnectAttempts": 10,
		"initialReconnectDelay": 2000
	},
	"allowNoGeometry": false,
	"allowedAlerts": [
		"Tornado Warning",
		"Severe Thunderstorm Warning"
	]
}

About

Simple NWWS Open Interface API. (WIP)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors