{"id":28483582,"url":"https://github.com/xhunter74/powermonitor.api","last_synced_at":"2026-04-11T18:03:37.396Z","repository":{"id":294513921,"uuid":"987202435","full_name":"XHunter74/PowerMonitor.API","owner":"XHunter74","description":"PowerMonitor API is a backend service for monitoring, collecting, and analyzing power consumption and availability data.","archived":false,"fork":false,"pushed_at":"2025-06-03T07:56:05.000Z","size":1428,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T22:02:02.260Z","etag":null,"topics":["api","mocha","nestjs","nodejs","passport","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XHunter74.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-20T18:16:45.000Z","updated_at":"2025-06-03T07:56:05.000Z","dependencies_parsed_at":"2025-05-20T20:51:11.903Z","dependency_job_id":null,"html_url":"https://github.com/XHunter74/PowerMonitor.API","commit_stats":null,"previous_names":["xhunter74/powermonitor.api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/XHunter74/PowerMonitor.API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XHunter74%2FPowerMonitor.API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XHunter74%2FPowerMonitor.API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XHunter74%2FPowerMonitor.API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XHunter74%2FPowerMonitor.API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XHunter74","download_url":"https://codeload.github.com/XHunter74/PowerMonitor.API/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XHunter74%2FPowerMonitor.API/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262239116,"owners_count":23280262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","mocha","nestjs","nodejs","passport","unit-testing"],"created_at":"2025-06-07T22:00:36.807Z","updated_at":"2026-04-11T18:03:37.389Z","avatar_url":"https://github.com/XHunter74.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerMonitor API\n\n![Version](https://img.shields.io/github/package-json/v/xhunter74/PowerMonitor.API?path=package.json\u0026color=blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n![Build](https://img.shields.io/badge/build-passing-brightgreen)\n![Dependencies](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen)\n\nPowerMonitor API is a backend service for monitoring, collecting, and analyzing power consumption and availability data. Built with [NestJS](https://nestjs.com/) and TypeScript, it provides RESTful endpoints for retrieving and managing power, voltage, amperage, and energy metering data, as well as system and calibration information.\n\n## Features\n\n- Collects and stores power, voltage, amperage, and energy metering data\n- Provides daily, monthly, and yearly statistics on power consumption and availability\n- Supports calibration coefficients and system information endpoints\n- Scheduled tasks for data cleanup and maintenance\n- JWT-based authentication and role-based access control\n- MQTT integration for real-time data\n- Logging with Winston\n- Real-time updates via WebSockets (Socket.IO)\n- Receives serial data frames from the monitoring board over a serial port, e.g.:\n    ```json\n    { \"type\": \"data\", \"voltage\": 220.0, \"current\": 5.0, \"frequency\": 50.0 }\n    ```\n- Centralized logging to Elasticsearch (via Winston Elasticsearch transport)\n- Application Performance Monitoring with Elastic APM (elastic-apm-node)\n\n## Project Structure\n\n- `src/modules/` – NestJS modules, grouping related controllers and services\n- `src/entities/` – TypeORM entities (database models)\n- `src/common/` – Shared DTOs, models, interfaces, and utilities\n- `src/migrations/` – Database migration scripts\n- `src/constants.ts` – Application-wide constants\n- `src/environments.ts` – Environment configuration\n- `src/main.ts` – Application entry point\n- `tests/` – Unit tests (Mocha + Chai)\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js (v20+ recommended)\n- npm\n- PostgreSQL database\n\n### Installation\n\n1. Clone the repository:\n    ```powershell\n    git clone \u003crepo-url\u003e\n    cd PowerMonitor.API\n    ```\n2. Install dependencies:\n    ```powershell\n    npm install\n    ```\n3. Configure environment variables:\n    - Copy `development.env` or `production.env` and update with your settings.\n\n### Database Setup\n\n- Configure your PostgreSQL connection in `src/ormconfig.ts` or via environment variables.\n- Run migrations if needed.\n\n### Running the Application\n\n- Development mode:\n    ```powershell\n    npm run start:dev\n    ```\n- Production build:\n    ```powershell\n    npm run build\n    npm run start:prod\n    ```\n\n### API Endpoints\n\n- Power data: `/api/power/*`\n- Power consumption: `/api/power-consumption/*`\n- Services/system info: `/api/services/*`\n- WebSocket real-time data: Socket.IO endpoint at `/socket.io/`\n\nMost endpoints require JWT authentication.\n\n## Scripts\n\n## Scripts\n\n- `npm run build` – Build for production\n- `npm run package` – Lint, version bump, replace build, and compile\n- `npm run build-dev` – Build in development mode\n- `npm run start` – Run with ts-node\n- `npm run start:dev` – Start in watch/dev mode\n- `npm run start:prod` – Run the production build\n- `npm run start:debug` – Run in debug mode\n- `npm run lint` – Lint the codebase\n- `npm run format` – Format code with Prettier\n- `npm run test` – Execute unit tests (Mocha + ts-node)\n- `npm run coverage` – Generate code coverage report\n\n## License\n\nCopyright (c) 2025 Serhiy Krasovskyy xhunter74@gmail.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhunter74%2Fpowermonitor.api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxhunter74%2Fpowermonitor.api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhunter74%2Fpowermonitor.api/lists"}