Skip to content

AkuaTech/eineage-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eineage Server

Small Node.js server for MQTT telemetry.

What it does

  • listens to broker.hivemq.com on dhruv/meter/#
  • stores telemetry in PostgreSQL through Prisma
  • exposes GET /api/v1/logs
  • exposes GET /api/v1/trends

Run it

  1. Install deps
npm install
  1. Set up .env
DATABASE_URL=postgresql://user:pass@host:5432/eineage
PORT=3000
MQTT_HOST=broker.hivemq.com
MQTT_PORT=1883
MQTT_TOPIC="xyz/meter/#"
  1. Run Prisma
npm run prisma:generate
npm run prisma:migrate
  1. Start the server
npm run dev

Quick checks

curl "http://localhost:3000/api/v1/logs?model=esp32&type=energy_demand"
curl "http://localhost:3000/api/v1/trends?model=esp32&range=1d&type=elec_measurements"

Files

Releases

No releases published

Packages

 
 
 

Contributors