A secure and role-based user interface controller built using Node-RED, allowing access control for Admin, User, and Guest roles with SQLite-based authentication.
- 🌐 User authentication with SQLite
- 🔒 Role-based access (Admin, User, Guest)
- 🧩 Dynamic UI control using Node-RED Dashboard
- 👋 Welcome navbar with logout functionality
- 🗃️ Prepared statements for secure login
- 🔄 Session storage and global context management
- Install Node-RED
- Add required nodes:
node-red-dashboard
node-red-node-sqlite
- Import
flows-compact.json
orflows-formatted.json
into your Node-RED editor - Place
database.db
under a/database
folder - Upload
esp32code.ino
to your ESP32 board - Run Node-RED and open the dashboard in your browser
Use the following SQLite script to recreate your database:
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
password TEXT NOT NULL,
role TEXT CHECK(role IN ('admin', 'user', 'guest')) NOT NULL
);
This project interfaces with IoT hardware components like LEDs, sensors, and touch modules using the ESP32. Below is the wiring guide:
- Anode (long leg) → 330Ω resistor
- Resistor other end → GPIO 2 on ESP32
- Cathode (short leg) → GND
- VCC → 3.3V on ESP32
- GND → GND on ESP32
- SCL → GPIO 22
- SDA → GPIO 21
- VCC → 3.3V on ESP32
- GND → GND on ESP32
- OUT → GPIO 4
- VCC → 5V on ESP32
- GND → GND on ESP32
- I/O → GPIO 5
- ⏱️ Auto logout on inactivity
- 🔒 Password hashing
- 🧪 Unit testing for backend logic
- 📊 Data logging with timestamps
For a detailed walkthrough, implementation screenshots, and explanation, refer to the User-Manual.pdf
file included in the repository.
MIT License
You are free to use, modify, and distribute this project with attribution.