Developer Environment Setup
Follow this guide to set up the Energy Monitoring System codebase on your local machine.
🗂️ Workspace Layout
The repository is structured into distinct project components:
/frontend/ems-webapp: Next.js application for user dashboards./backend: Node.js / Express API handling WebSocket data and database routing./firmware: C++/Arduino firmware for ESP32 microcontrollers./dev-docs: Docusaurus developer documentation site.
🚀 Step-by-Step Setup
Prerequisites
Ensure you have the following tools installed:
- Node.js (v18.x or later)
- Arduino IDE or PlatformIO (for firmware development)
- MongoDB (locally or an Atlas cluster URI)
- Supabase Account (for Auth and PostgreSQL)
- Mosquito client
- Websockets Socket.io
- Google Cloud
1. Set Up the Frontend Webapp
-
Navigate to the frontend directory:
cd frontend/ems-webapp -
Install npm dependencies:
npm install -
Create a
.env.localfile insidefrontend/ems-webapp/and populate it with your Firebase/Supabase configuration credentials: -
Start the development server:
npm run dev
2. Set Up the Documentation Site
- Navigate to the
docsdirectory:cd docs - Install dependencies:
npm install
- Start Docusaurus locally:
The site will load atnpm run start
http://localhost:3000.
🔧 Contribution Guidelines
- Branching Policy: Always create feature branches from
main(e.g.,feature/live-graphs,bugfix/alert-delay). - Code Style:
- Frontend uses Prettier and ESLint. Run
npm run lintbefore committing. - Firmware should follow clear formatting with descriptive variable names.
- Frontend uses Prettier and ESLint. Run