Skip to main content

Running Zafron locally

Zafron can be run locally on your computer or on a server. This is useful if you want to test Zafron or if you want to run Zafron on your own server.

Requirements

  • NodeJS
  • MongoDB
  • Redis
  • npm

Getting Started

The quickest way to get started is to use docker-compose. This will start the server and the database. You will need to provide the MQTT credentials in the docker-compose.yml file.

git clone https://github.com/asanchezdelc/zafron
cd zafron
docker-compose up -d

Navigate to `http://localhost:3000``

Build from source

git clone https://github.com/asanchezdelc/zafron
cd zafron
npm install

Run the frontend

npm run start

Run the backend

PORT=8080 node app.js

or

npm run server

Test

Use mosquitto_pub or MQTT.fx to test/send data to the broker with the proper credentials.

mosquitto_pub -h localhost -t v1/{username}/things/{serial}/data/json -m "[{\"channel\":0,\"value\":1,\"type\":\"temp\", \"unit\":\"f\"}]]"