Skip to content

Ayush-Kumar0207/IoT-Dashboard-Development-using-React

Repository files navigation

IoT Dashboard Logo

⚑ IoT Dashboard

Real-time IoT device monitoring, telemetry visualization, and remote hardware control β€” built with React & TypeScript.

Live Demo

React 19 TypeScript Vite TailwindCSS Supabase Anedya Vercel License PRs Welcome


πŸ”΄ Live Demo

Resource URL
Dashboard io-t-dashboard-development-using-re.vercel.app
Simulator Hosted on Render (background service)
Auth Provider Supabase (managed)
IoT Platform Anedya Cloud β€” AP-IN-1 Region

Register an account on the live site to explore the full dashboard. The simulator on Render continuously pushes temperature & humidity data so charts are always populated.


πŸ“Έ Preview

Dashboard β€” Real-time telemetry cards, relay control, and historical sensor trends.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ⚑ IoT Admin         β”‚  IoT Device Overview                    β”‚
β”‚                        β”‚                                         β”‚
β”‚  β–Έ Overview            β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β–Έ User Management     β”‚  β”‚ 🌑 26.4Β°C   β”‚  β”‚ πŸ’§ 58.2%    β”‚      β”‚
β”‚                        β”‚  β”‚ Temperature  β”‚  β”‚ Humidity     β”‚      β”‚
β”‚  ───────────           β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚  User: admin@...       β”‚                                         β”‚
β”‚  ● admin               β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚                        β”‚  β”‚ ⚑ Remote Relay Control          β”‚   β”‚
β”‚  [Sign Out]            β”‚  β”‚  β—‹ ────── ON                    β”‚   β”‚
β”‚                        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                        β”‚                                         β”‚
β”‚                        β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚                        β”‚  β”‚ πŸ“ˆ Historical Telemetry          β”‚   β”‚
β”‚                        β”‚  β”‚  β•±β•²  β•±β•²  β•±β•²                    β”‚   β”‚
β”‚                        β”‚  β”‚ β•±  β•²β•±  β•²β•±  β•²  Temperature     β”‚   β”‚
β”‚                        β”‚  β”‚ ─── Humidity                    β”‚   β”‚
β”‚                        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

⚑ Quick Start

# 1. Clone the repository
git clone https://github.com/Ayush-Kumar0207/IoT-Dashboard-Development-using-React.git
cd IoT-Dashboard-Development-using-React

# 2. Install dependencies
npm install

# 3. Create your environment file
cp .env.example .env.local
# β†’ Fill in your Supabase & Anedya credentials (see Environment Variables below)

# 4. Run the Supabase SQL setup
# β†’ Execute supabase_setup.sql in your Supabase SQL Editor

# 5. Start the development server
npm run dev
# β†’ Open http://localhost:5173

πŸ“– Table of Contents


🧠 About the Project

Modern IoT deployments demand dashboards that are more than static data tables. IoT Dashboard bridges the gap between raw sensor telemetry and actionable insight by providing:

  • Live sensor feeds β€” Temperature and humidity values streamed every 5 seconds from hardware via the Anedya IoT Cloud platform.
  • Remote hardware control β€” Toggle physical relays directly from the browser with role-based permission gates.
  • Historical trend analysis β€” Interactive time-series charts powered by Recharts, auto-refreshing every 15 seconds.
  • Enterprise-grade access control β€” Three-tier RBAC (Admin β†’ Operator β†’ Viewer) backed by Supabase Row Level Security, with real-time role sync across sessions.

Whether you're building a smart home prototype, an industrial monitoring console, or a classroom IoT lab, this project provides a production-ready foundation with clean architecture and modern tooling.


✨ Features

Real-Time Monitoring

  • 🌑️ Live Temperature & Humidity β€” Polled every 5 seconds from the Anedya Cloud API
  • 🟒 Device Online/Offline Detection β€” Heartbeat + fallback telemetry timestamp check (3-minute window)
  • πŸ“Š Historical Trend Charts β€” Last 1 hour of sensor data rendered as interactive line charts (Recharts)
  • πŸ”„ Auto-Refresh β€” Dashboard data refreshes automatically with configurable intervals

Device Control

  • ⚑ Remote Relay Toggle β€” Send ON/OFF commands to physical hardware from the browser
  • πŸ” Permission-Gated Controls β€” Only Admins and Operators can toggle the relay; Viewers see a clear access-restricted notice
  • ⏱️ Command Expiry β€” Relay commands auto-expire after 30 seconds for safety

Authentication & Authorization

  • πŸ”‘ Email/Password Authentication β€” Powered by Supabase Auth
  • πŸ›‘οΈ Three-Tier RBAC β€” ADMIN Β· OPERATOR Β· VIEWER roles enforced at UI and database levels
  • πŸ“‘ Real-Time Role Sync β€” Role changes by an Admin are instantly reflected in all user sessions via Supabase Realtime channels
  • πŸ—„οΈ Row Level Security β€” PostgreSQL RLS policies ensure data integrity at the database layer

Admin Panel

  • πŸ‘₯ User Management Table β€” View all registered users with role badges and join dates
  • πŸ”„ Instant Role Updates β€” Optimistic UI updates with automatic rollback on failure
  • 🚫 Self-Protection β€” Admins cannot modify their own role from the management panel

User Experience

  • πŸ“± Fully Responsive β€” Desktop sidebar + mobile sheet navigation
  • ⚑ Skeleton Loading States β€” Smooth loading indicators across all data-driven components
  • πŸ”” Toast Notifications β€” Success/error feedback for every user action
  • 🎨 Dark Mode Ready β€” CSS variables configured for light and dark themes

πŸ— Tech Stack

Layer Technology Purpose
Frontend React 19, TypeScript 5.9 Component architecture & type safety
Build Tool Vite 8 Lightning-fast HMR & optimized builds
Styling TailwindCSS 3.4, Radix UI Utility-first CSS + accessible primitives
State Management Zustand 5 Lightweight global auth state
Data Fetching TanStack React Query 5 Server state, caching, polling
Charts Recharts 3 Responsive, interactive data visualizations
Routing React Router 7 SPA navigation with route guards
Auth & Database Supabase (PostgreSQL) Authentication, RLS, Realtime subscriptions
IoT Platform Anedya Cloud (AP-IN-1) Device telemetry, commands, health status
Deployment Vercel (Dashboard), Render (Simulator) Edge-optimized frontend + always-on backend
Icons Lucide React Consistent, lightweight icon set

πŸ› Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         BROWSER                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  React App (Vite + TypeScript)                            β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  β”‚
β”‚  β”‚  β”‚ Zustand   β”‚  β”‚ TanStack β”‚  β”‚ React Router         β”‚    β”‚  β”‚
β”‚  β”‚  β”‚ AuthStore β”‚  β”‚ Query    β”‚  β”‚ ProtectedRoute       β”‚    β”‚  β”‚
β”‚  β”‚  β”‚           β”‚  β”‚ Hooks    β”‚  β”‚ RoleRoute             β”‚    β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”‚
β”‚  β”‚        β”‚              β”‚                                    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚           β”‚              β”‚                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚              β”‚
            β–Ό              β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Supabase    β”‚   β”‚  Anedya Cloud   β”‚
  β”‚  ──────────  β”‚   β”‚  ─────────────  β”‚
  β”‚  β€’ Auth      β”‚   β”‚  β€’ /data/latest β”‚
  β”‚  β€’ Profiles  β”‚   β”‚  β€’ /data/getDataβ”‚
  β”‚  β€’ RLS       β”‚   β”‚  β€’ /commands    β”‚
  β”‚  β€’ Realtime  β”‚   β”‚  β€’ /health      β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  IoT Hardware   β”‚
                     β”‚  (or Simulator  β”‚
                     β”‚   on Render)    β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow:

  1. The Simulator (hosted on Render) pushes temperature & humidity data to the Anedya Cloud via its REST API.
  2. The React dashboard polls the Anedya Cloud API at configurable intervals (5s telemetry, 10s status, 15s charts).
  3. Supabase handles user authentication and stores profile/role data with RLS enforcement.
  4. Supabase Realtime channels ensure role changes propagate instantly to all connected browser sessions.

πŸ“‚ Project Structure

IoT-Dashboard-Development-using-React/
β”œβ”€β”€ public/                          # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.tsx   # Auth guard β€” redirects unauthenticated users
β”‚   β”‚   β”‚   └── RoleRoute.tsx        # RBAC guard β€” restricts by user role
β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   β”œβ”€β”€ HistoricalChart.tsx   # Recharts line chart (temperature + humidity)
β”‚   β”‚   β”‚   β”œβ”€β”€ RelayControl.tsx     # ON/OFF toggle with permission gating
β”‚   β”‚   β”‚   └── TelemetryCards.tsx   # Live temperature & humidity cards
β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   └── DashboardLayout.tsx  # Sidebar + mobile sheet + outlet
β”‚   β”‚   └── ui/                      # Radix-based design system (14 components)
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ useIoTData.ts            # TanStack Query hooks for Anedya API
β”‚   β”‚   β”œβ”€β”€ useAdminUsers.ts         # User management hooks with optimistic updates
β”‚   β”‚   └── use-toast.ts             # Toast notification hook
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ supabase.ts              # Supabase client initialization
β”‚   β”‚   └── utils.ts                 # Utility functions (cn helper)
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx            # Main monitoring view
β”‚   β”‚   β”œβ”€β”€ Admin.tsx                # User management panel (Admin only)
β”‚   β”‚   β”œβ”€β”€ Login.tsx                # Email/password login
β”‚   β”‚   └── Register.tsx             # Account registration
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ anedya.ts                # Anedya Cloud API client (telemetry, commands, health)
β”‚   β”‚   └── admin.ts                 # Supabase admin operations (fetch users, update roles)
β”‚   β”œβ”€β”€ store/
β”‚   β”‚   └── useAuthStore.ts          # Zustand auth + realtime profile sync
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── auth.ts                  # TypeScript types (UserRole, UserProfile)
β”‚   β”œβ”€β”€ App.tsx                      # Root component with routing
β”‚   β”œβ”€β”€ main.tsx                     # Entry point
β”‚   β”œβ”€β”€ index.css                    # Tailwind directives + CSS variables
β”‚   └── App.css                      # Additional styles
β”œβ”€β”€ supabase_setup.sql               # Database schema, RLS policies, triggers
β”œβ”€β”€ vite.config.ts                   # Vite configuration with path aliases
β”œβ”€β”€ tailwind.config.cjs              # Tailwind theme extension
β”œβ”€β”€ vercel.json                      # SPA rewrite rules for Vercel
β”œβ”€β”€ tsconfig.json                    # TypeScript configuration
└── package.json                     # Dependencies & scripts

βš™οΈ Environment Variables

Create a .env.local file in the project root:

# ── Supabase ──────────────────────────────────────────
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key

# ── Anedya IoT Cloud ──────────────────────────────────
VITE_ANEDYA_API_KEY=your-anedya-project-access-token
VITE_ANEDYA_NODE_ID=your-device-node-id
Variable Description
VITE_SUPABASE_URL Your Supabase project URL (found in Project Settings β†’ API)
VITE_SUPABASE_ANON_KEY Supabase anonymous/public key for client-side access
VITE_ANEDYA_API_KEY Anedya project access token (Bearer auth for API calls)
VITE_ANEDYA_NODE_ID UUID of the IoT device node registered in your Anedya project

πŸ§ͺ Usage

Dashboard View

Once logged in, the dashboard displays:

  • Device Status β€” Green pulsing indicator when the device (or simulator) is online
  • Telemetry Cards β€” Temperature (Β°C) and Humidity (%) with color-coded thresholds
  • Relay Control β€” Toggle switch to send ON/OFF commands (requires Operator or Admin role)
  • Historical Chart β€” Line chart showing the last hour of sensor data with auto-refresh

Admin Panel

Navigate to /admin (visible only to Admin users):

  • View all registered users in a sortable table
  • Change any user's role between ADMIN, OPERATOR, and VIEWER via dropdown
  • Role changes take effect immediately across all sessions (Supabase Realtime)

Role Permissions

Capability Admin Operator Viewer
View Dashboard βœ… βœ… βœ…
View Telemetry βœ… βœ… βœ…
Control Relay βœ… βœ… ❌
Manage Users βœ… ❌ ❌

πŸš€ Deployment

Vercel (Frontend)

The dashboard is deployed on Vercel with SPA rewrites configured in vercel.json:

{
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}

Steps:

  1. Push your repository to GitHub
  2. Import the project in Vercel
  3. Add environment variables (VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, VITE_ANEDYA_API_KEY, VITE_ANEDYA_NODE_ID)
  4. Vercel auto-detects Vite and deploys

Render (Simulator)

The simulator.js background service runs on Render as a Background Worker that continuously pushes telemetry data to the Anedya Cloud API β€” keeping the dashboard populated with live data 24/7.

Supabase (Database)

  1. Create a new Supabase project
  2. Navigate to the SQL Editor
  3. Paste and execute supabase_setup.sql β€” this creates the profiles table, RLS policies, triggers, and backfills existing users
  4. Enable Realtime on the profiles table (Database β†’ Replication β†’ Enable for profiles)

πŸ”’ Security

  • Row Level Security (RLS) β€” All database access is governed by PostgreSQL RLS policies. Users can only read their own profile; only Admins can update other users' roles.
  • SECURITY DEFINER Functions β€” The handle_new_user() trigger function runs with elevated privileges to auto-create profiles on signup.
  • Environment Variables β€” All secrets are stored in .env.local and never committed to version control.
  • Bearer Token Auth β€” Anedya API calls use project access tokens transmitted via Authorization headers.
  • Command Expiry β€” Relay commands expire after 30 seconds, preventing stale commands from executing on devices.

πŸ—Ί Roadmap

  • πŸŒ™ Dark mode toggle in the UI
  • πŸ“Š Multi-device support (manage multiple nodes from one dashboard)
  • πŸ“ˆ Customizable time range selectors for historical charts
  • πŸ”” Alert thresholds with email/push notifications
  • πŸ“± PWA support for mobile installation
  • πŸ§ͺ Unit & integration tests (Vitest + Testing Library)
  • πŸ“‹ Audit log for admin actions
  • 🌐 Multi-language (i18n) support

🀝 Contributing

Contributions make the open-source community thrive. Any contributions you make are greatly appreciated.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please follow Conventional Commits for commit messages.


❓ FAQ

How does the dashboard get data without a real IoT device?

A simulator.js service runs on Render and pushes randomized temperature & humidity values to the Anedya Cloud at regular intervals. The dashboard polls this data exactly like it would from real hardware.

Can I connect a real sensor instead of the simulator?

Yes. Any device (ESP32, Arduino, Raspberry Pi) that can send HTTP POST requests to the Anedya API with the correct NODE_ID and API_KEY will work seamlessly. The dashboard is hardware-agnostic.

Why do I see "OFFLINE" even though the simulator is running?

The dashboard considers a device online if telemetry data was received in the last 3 minutes. If the Render service is sleeping (free tier cold start), it may take a moment to wake up and push data.

How do I become an Admin?

The first user registers as a VIEWER by default. To promote yourself to Admin, run the following in the Supabase SQL Editor:

UPDATE public.profiles SET role = 'ADMIN' WHERE email = 'your@email.com';

πŸ“œ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘¨β€πŸ’» Author

Ayush Kumar
Ayush Kumar

πŸ“§ Email Β· πŸ™ GitHub

🌟 Support

If this project helped you or you found it interesting:

  • ⭐ Star this repository β€” it helps others discover the project
  • πŸ› Report bugs via Issues
  • πŸ’‘ Suggest features via Discussions
  • πŸ”€ Fork & contribute β€” PRs are always welcome

Built with ❀️ using React, Supabase & Anedya IoT Cloud

About

A high-performance IoT dashboard built with React 19 and TypeScript. Features real-time telemetry monitoring, historical data visualization, and remote hardware control via Anedya Cloud and Supabase.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors