Real-time IoT device monitoring, telemetry visualization, and remote hardware control β built with React & TypeScript.
| 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.
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 β β
β β βββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# 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- About the Project
- Features
- Tech Stack
- Architecture
- Project Structure
- Environment Variables
- Usage
- Deployment
- Security
- Roadmap
- Contributing
- FAQ
- License
- Author
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.
- π‘οΈ 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
- β‘ 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
- π Email/Password Authentication β Powered by Supabase Auth
- π‘οΈ Three-Tier RBAC β
ADMINΒ·OPERATORΒ·VIEWERroles 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
- π₯ 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
- π± 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
| 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 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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:
- The Simulator (hosted on Render) pushes temperature & humidity data to the Anedya Cloud via its REST API.
- The React dashboard polls the Anedya Cloud API at configurable intervals (5s telemetry, 10s status, 15s charts).
- Supabase handles user authentication and stores profile/role data with RLS enforcement.
- Supabase Realtime channels ensure role changes propagate instantly to all connected browser sessions.
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
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 |
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
Navigate to /admin (visible only to Admin users):
- View all registered users in a sortable table
- Change any user's role between
ADMIN,OPERATOR, andVIEWERvia dropdown - Role changes take effect immediately across all sessions (Supabase Realtime)
| Capability | Admin | Operator | Viewer |
|---|---|---|---|
| View Dashboard | β | β | β |
| View Telemetry | β | β | β |
| Control Relay | β | β | β |
| Manage Users | β | β | β |
The dashboard is deployed on Vercel with SPA rewrites configured in vercel.json:
{
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}Steps:
- Push your repository to GitHub
- Import the project in Vercel
- Add environment variables (
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY,VITE_ANEDYA_API_KEY,VITE_ANEDYA_NODE_ID) - Vercel auto-detects Vite and deploys
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.
- Create a new Supabase project
- Navigate to the SQL Editor
- Paste and execute
supabase_setup.sqlβ this creates theprofilestable, RLS policies, triggers, and backfills existing users - Enable Realtime on the
profilestable (Database β Replication β Enable forprofiles)
- 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.localand never committed to version control. - Bearer Token Auth β Anedya API calls use project access tokens transmitted via
Authorizationheaders. - Command Expiry β Relay commands expire after 30 seconds, preventing stale commands from executing on devices.
- π 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
Contributions make the open-source community thrive. Any contributions you make are greatly appreciated.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please follow Conventional Commits for commit messages.
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';Distributed under the MIT License. See LICENSE for more information.
Ayush Kumar π§ Email Β· π GitHub |
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