This project has high resource efficiency and performance, including real-time data processing, as well as good cybersecurity.
| Part | Description |
|---|---|
| Scheme | Virtual |
| Features | • Publish • Subscribe |
| Development Board | DOIT ESP32 DEVKIT V1 |
| Code Editor | Visual Studio Code |
| Application Support | • Wokwi • MQTTX • Node.js |
| MQTT Broker | EMQX Broker |
| Communications Protocol | • Hypertext Transfer Protocol (HTTP) • Message Queuing Telemetry Transport (MQTT) |
| IoT Architecture | 3 Layer |
| Framework | • Bootstrap 5 • Express.js • Font-Awesome 6 |
| Libraries | MQTT.js |
-
Visual Studio Code
https://bit.ly/VScode_Installer
-
NodeJS
https://nodejs.org/en/download/prebuilt-installer
-
MQTTX
https://mqttx.app/downloads
| Infrastructure |
|---|
![]() |
-
Create a new directory named
dashboard-iot. -
Download and extract this repository.
-
Copy the directories:
publicandviews. -
Copy the file:
server.js. -
Paste and Replace into the
dashboard-iotdirectory. -
Open
Terminalinside that directory. -
Create a
package.jsonfile by typing the command:npm init -y
-
Install
expressto make a backend server:npm install express
-
Install
mqttfor IoT data communication:npm install mqtt
-
Install
mqttjsto connect the web and Node.js to the MQTT broker in real time:npm install mqttjs
-
Install
ejsto create web pages with dynamic content:npm install ejs
-
Install
bootstrapto manage the appearance (layout):npm install bootstrap
-
Install
fontawesomefor icons:npm install @fortawesome/fontawesome-free
-
Open
package.json, then change thescriptssection to look like this:"scripts": { "start": "node server.js", "dev": "nodemon server.js" },
-
Install
nodemonto restart the server automatically:npm install --save-dev nodemon
-
To run the web, type the command:
npm run dev
-
Open your browser, then type ->
http://localhost:3000/. -
Fill in the Topic and Data form first, for example:
kelasiot/pot|4095-> then clickPublish, then the result will be displayed. -
This port and Topic Subscribe can be changed according to the user's preference. These settings are contained in a file called
server.js. -
Please access the features and enjoy [Done].
MQTTX Web provides 2 communication protocols, namely WebSocket (WS) and WebSocket Secure (WSS). There is also MQTTX Desktop, which is a more complete option.
- If you are using
MQTTX Web, make sure to select theWSSprotocol to be secure. - If you are using
MQTTX Desktop, don't forget to download the app. Then, once downloaded, open that application on your laptop or computer. - Click
+ New Connection-> then name the connection as you want -> then clickConnect. - Create a new topic with the name
kelasiot/pot. - Then for topic settings you can customize as seen below:
• Format Payload to Publish by : `Plaintext`.
• Qos : `0`.
• Put a check mark on `Retain`.
- Publish data.
- After that, please click
+ New Subscription-> then list the topics you want to subscribe, for example:kelasiot/#. - Wait for the subscription results to be displayed.
- Have fun and enjoy [Done].
- Open the Railway platform: Click Here , then log in with GitHub.
- Allow Railway to access the repository.
- Upload the project to GitHub.
- Log in to the Railway dashboard: Click Here
- Click
Add New Project. - Select the desired GitHub repository.
- Select the
Settingsmenu -> Change theNameandDescriptionas needed -> Click theUpdatebutton. - Select the
Architecturemenu -> ClickProject. - Click
Variablesin the Project section -> Click theNew Variablebutton, then fill it in exactly like this:
-
Placeholder:
VARIABLE_NAMEMQTT_BROKER
-
Placeholder:
VALUE or ${{REF}}mqtt://broker.emqx.io
-
- Click
Settingsin the Project section -> Search forPublic Networking-> Click theGenerate Domainbutton. - To get a clean domain: Click
Edit-> Click theUpdatebutton (*Optional).
Link to simulate : Click Here
| Dashboard View | Running the Server |
|---|---|
![]() |
![]() |
| MQTTX Simulation | Wokwi Simulation |
|---|---|
![]() |
![]() |
If this work is useful to you, then support this work as a form of appreciation to the author by clicking the ⭐Star button at the top of the repository.
This application is the result of the development of the Kelas IoT Workshop. I do not deny that I still use third-party services in this work, including: libraries, frameworks, and so on.
MIT License - Copyright © 2024 - Devan C. M. Wijaya, S.Kom
Permission is hereby granted without charge to any person obtaining a copy of this software and the software-related documentation files to deal in them without restriction, including without limitation the right to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons receiving the Software to be furnished therewith on the following terms:
The above copyright notice and this permission notice must accompany all copies or substantial portions of the Software.
IN ANY EVENT, THE AUTHOR OR COPYRIGHT HOLDER HEREIN RETAINS FULL OWNERSHIP RIGHTS. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, THEREFORE IF ANY DAMAGE, LOSS, OR OTHERWISE ARISES FROM THE USE OR OTHER DEALINGS IN THE SOFTWARE, THE AUTHOR OR COPYRIGHT HOLDER SHALL NOT BE LIABLE, AS THE USE OF THE SOFTWARE IS NOT COMPELLED AT ALL, SO THE RISK IS YOUR OWN.




