Connecting EV drivers, station owners, and administrators with IoT-enabled charging hardware
- ✨ Features
- 🛠️ Tech Stack
- 🏗️ Architecture
- 🚀 Installation
- 💻 Usage
- 🔌 API Endpoints
- 📁 Project Structure
- 🔧 Environment Variables
- 🚀 Deployment
- 🧪 Testing
- 🤝 Contributing
- 📄 License
- 👥 Author
| Role | Capabilities |
|---|---|
| 🚗 EV Drivers | Book charging slots · Monitor real-time charging · View & pay bills |
| 🏪 Station Owners | Manage stations · Monitor revenue · Configure IoT devices |
| 🛡️ Administrators | Platform-wide management · User oversight · Analytics |
- Real-time Monitoring — Live voltage, current, power, and energy consumption via IoT
- Smart Booking System — Time-slot based charging reservations
- Automated Billing — Energy-based cost calculation and payment tracking
- IoT Integration — ESP32 + PZEM energy meter for hardware connectivity
- Map-based Discovery — Interactive station locator with live availability status
- OTP Authentication — Secure mobile-based login (no passwords)
- JWT Protection — Token-based API security
- Role-based Access Control — Granular permissions per user type
- Error Handling — Comprehensive middleware for robust operations
|
Frontend
|
Backend
|
IoT & Hardware
|
Tooling
|
┌──────────────┐ ┌────────────────┐ ┌─────────────────┐
│ EV Drivers │ │ Station Owners │ │ Administrators │
└──────┬───────┘ └───────┬────────┘ └────────┬────────┘
└────────────────────┼─────────────────────┘
│
┌─────────▼─────────┐
│ React App │
│ (Vite) │
└─────────┬─────────┘
│
┌─────────▼─────────┐
│ Express API │
│ (Node.js) │
└─────────┬─────────┘
│
┌─────────▼─────────┐
│ MongoDB │
│ (Mongoose) │
└─────────┬─────────┘
│
┌─────────▼─────────┐
│ IoT Devices │
│ ESP32 + PZEM │
└───────────────────┘
- Node.js 18+
- MongoDB (local or Atlas)
- Git
git clone https://github.com/yourusername/ev-home.git
cd ev-home# Navigate to backend
cd backend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your values
# Start dev server
npm run dev# From root directory
cd ..
npm install
npm run devcd backend
npm run seed🚗 For EV Drivers
- Sign up with your vehicle registration and mobile number
- Browse stations on the interactive map
- Book a charging slot for your preferred time
- Monitor charging in real-time via the dashboard
- View and pay your energy bills
🏪 For Station Owners
- Register your account and business details
- Add charging stations with location and pricing
- Configure IoT devices and WiFi networks
- Monitor active sessions and revenue
- Manage bookings and maintenance schedules
🛡️ For Administrators
- Access admin dashboard with credentials
- View platform analytics and statistics
- Manage users and stations across the platform
- Monitor all bookings and billing activity
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/validate-for-otp |
Request OTP |
POST |
/api/auth/verify-msg91-token |
Verify OTP and login |
GET |
/api/auth/me |
Get current user info |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/stations |
Get all stations |
POST |
/api/stations |
Create station (Owner/Admin) |
PUT |
/api/stations/:id |
Update station (Owner/Admin) |
DELETE |
/api/stations/:id |
Delete station (Admin) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/bookings |
Get user bookings |
POST |
/api/bookings |
Create booking |
PUT |
/api/bookings/:id/status |
Update booking status |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/sessions |
Get charging sessions |
POST |
/api/sessions/start |
Start charging session |
PUT |
/api/sessions/:id/stop |
Stop charging session |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/bills |
Get user bills |
PUT |
/api/bills/:id/pay |
Mark bill as paid |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/iot/data |
Receive sensor data from ESP32 |
GET |
/api/iot/config |
Get device configuration |
EV-Home/
├── backend/ # Node.js Express API
│ ├── config/ # Database configuration
│ ├── controllers/ # Route handlers
│ ├── middleware/ # Auth, error handling
│ ├── models/ # Mongoose schemas
│ ├── routes/ # API route definitions
│ ├── iot/ # ESP32 firmware
│ ├── seed/ # Database seeding
│ ├── tests/ # API tests
│ ├── utils/ # Helper functions
│ ├── server.js # Main server file
│ └── package.json
├── src/ # React frontend
│ ├── admin/ # Admin dashboard
│ │ ├── components/
│ │ ├── pages/
│ │ └── services/
│ ├── owner/ # Owner dashboard
│ │ ├── components/
│ │ ├── pages/
│ │ └── services/
│ ├── components/ # Shared components
│ ├── pages/ # Public pages
│ ├── services/ # API services
│ ├── context/ # React context
│ ├── config/ # Configuration files
│ ├── App.jsx
│ └── main.jsx
├── public/ # Static assets
├── index.html
├── package.json
├── vite.config.js
├── vercel.json
└── README.md
# Database
MONGODB_URI=mongodb://localhost:27017/evhome
# JWT
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRE=30d
# MSG91 OTP Service
MSG91_AUTH_KEY=your-msg91-auth-key
MSG91_TEMPLATE_ID=your-template-id
# IoT Configuration
IOT_API_KEY=your-iot-api-key
# Server
PORT=5000
NODE_ENV=developmentVITE_API_BASE_URL=http://localhost:5000/api
VITE_MAPBOX_ACCESS_TOKEN=your-mapbox-token| Service | Platform | Notes |
|---|---|---|
| Backend | Render | Connect GitHub repo, set env vars |
| Frontend | Vercel | Auto-deploys via vercel.json |
| Database | MongoDB Atlas | Free tier available |
# Backend tests
cd backend
npm test
# Frontend linting
cd ..
npm run lintContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add amazing feature' - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow the existing ESLint configuration
- Write tests for new features
- Update documentation as needed
- Use conventional commit messages
This project is licensed under the MIT License — see the LICENSE file for details.
Your Name
⭐ Star this repo if you find it helpful!
Further Reading
Deployment Guide · IoT Setup Guide · MSG91 OTP Docs · Portals Guide