Skip to content

MITHRAN-BALACHANDER/Smart-Ev

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SmartEV - Comprehensive EV Ecosystem Platform

Node.js React React Native TypeScript Python Solidity

πŸš— Overview

SmartEV is a comprehensive electric vehicle ecosystem platform that combines blockchain technology, AI/ML analytics, IoT telemetry, and multi-platform applications to provide end-to-end EV management solutions. The platform serves manufacturers, dealers, fleet operators, and individual EV owners with a complete suite of tools for battery lifecycle tracking, charging station management, predictive analytics, and smart contract-based transactions.

πŸ—οΈ Architecture

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend Web  β”‚    β”‚  Mobile App     β”‚    β”‚   Admin Panel   β”‚
β”‚   (React/Vite)  β”‚    β”‚ (React Native)  β”‚    β”‚  (React/Vite)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    API Gateway & Load Balancer                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                      β”‚                      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚   Backend API   β”‚    β”‚  Chat Service   β”‚    β”‚  ML/AI Engine   β”‚
β”‚ (Node.js/TS)    β”‚    β”‚   (Node.js)     β”‚    β”‚   (Python)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚   MongoDB       β”‚    β”‚  Vector Store   β”‚    β”‚  Battery Twin   β”‚
β”‚   Database      β”‚    β”‚   (RAG Data)    β”‚    β”‚  (Telemetry)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚   Blockchain    β”‚
β”‚ (Hardhat/ETH)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌟 Key Features

πŸ”‹ Battery Lifecycle Management

  • Digital Battery Passports: Blockchain-based immutable battery records
  • Real-time Health Monitoring: AI-powered battery degradation analysis
  • Predictive Maintenance: ML models for optimal battery performance
  • Recycling Tracking: Complete end-of-life battery management
  • Battery Analytics: Comprehensive performance metrics and trends
  • Health Score Tracking: Real-time battery condition monitoring

πŸ“± Multi-Platform Applications

  • Web Dashboard: React-based admin and user interfaces
  • Mobile App: Cross-platform React Native application with Expo
  • Progressive Web App: Responsive web application for mobile devices
  • Admin Panel: Comprehensive management interface
  • Super Admin Dashboard: Advanced system-wide management tools
  • Fleet Management Interface: Multi-vehicle oversight capabilities

πŸ€– AI-Powered Analytics

  • Battery Twin Technology: Digital twins for real-time battery simulation
  • Predictive Analytics: Usage pattern analysis and optimization
  • Smart Recommendations: AI-driven charging and maintenance suggestions
  • Anomaly Detection: ML-based fault detection and alerting
  • Performance Optimization: AI-driven efficiency improvements
  • Usage Pattern Recognition: Machine learning-based behavior analysis

πŸ—ΊοΈ Charging Network Integration

  • Open Charge Map: Real-time charging station data from global community
  • Route Planning: Smart charging route optimization
  • Station Management: Admin tools for charging infrastructure
  • Real-time Availability: Live charging station status updates
  • Multi-brand Support: Integration with various charging networks
  • Session Management: Complete charging session tracking

πŸ’¬ Intelligent Chat Assistant

  • RAG-based AI: Context-aware EV assistance and support
  • Multi-language Support: Support for Indian regional languages
  • Voice Integration: Speech-to-text and text-to-speech capabilities
  • Knowledge Base: Comprehensive EV information and troubleshooting
  • Groq AI Integration: Advanced language model capabilities
  • File Upload Support: Document and image analysis capabilities

πŸ”— Blockchain Integration

  • Smart Contracts: Automated transactions and agreements
  • Ownership Tracking: Immutable ownership and transfer records
  • Supply Chain Transparency: Complete EV component traceability
  • Decentralized Identity: Secure user and device identity management
  • Battery Passport Registry: Blockchain-based battery lifecycle tracking
  • Transaction History: Complete audit trail of all operations

πŸ› οΈ Technology Stack

Backend

  • Framework: Node.js with Express.js and TypeScript
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT with bcrypt password hashing
  • API: RESTful APIs with comprehensive validation
  • Blockchain: Hardhat framework with Ethereum-compatible smart contracts
  • ML Integration: Python Flask APIs for model serving

Frontend

  • Web: React 18 with TypeScript and Vite build system
  • Mobile: React Native with Expo for cross-platform development
  • UI Framework: Tailwind CSS with Radix UI components
  • State Management: React Context API and custom hooks
  • Maps Integration: Leaflet.js with OpenStreetMap tiles

AI/ML Stack

  • Framework: Python with scikit-learn, PyTorch
  • Dashboard: Dash and Plotly for interactive visualizations
  • Data Processing: Pandas and NumPy for data manipulation
  • Model Serving: Flask with CORS for API endpoints
  • Battery Modeling: Custom ML models for battery performance prediction

Infrastructure

  • Containerization: Docker for microservices deployment
  • CI/CD: GitHub Actions for automated testing and deployment
  • Monitoring: Winston logging with structured logging
  • Security: Helmet.js, CORS, rate limiting, and input validation

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • Python 3.8+
  • MongoDB (local or Atlas)
  • Git

Installation

  1. Clone the repository
git clone https://github.com/Raghavendransahana/smartev.git
cd smartev
  1. Backend API Setup
cd backend/api
npm install
cp .env.example .env
# Configure your environment variables
npm run dev
  1. Frontend Web Setup
cd frontend/web
npm install
npm run dev
  1. Mobile App Setup
cd frontend/app
npm install
npm run start
  1. ML/AI Engine Setup
cd "model & ai/ml"
python -m venv mobility
source mobility/bin/activate  # On Windows: mobility\Scripts\activate
pip install -r requirements.txt
python battery_api_server.py
  1. Blockchain Setup
cd backend/blockchain
npm install
npx hardhat compile
npx hardhat deploy --network localhost
  1. Chat Service Setup
cd chat
npm install
cp .env.example .env
# Configure your AI API keys (Groq/OpenAI)
npm start

Environment Configuration

Create .env files in respective directories:

Backend API (backend/api/.env):

NODE_ENV=development
PORT=4000
MONGODB_URI=mongodb://localhost:27017/smartev
JWT_SECRET=your_jwt_secret_key_here
JWT_EXPIRE=7d

# Blockchain
BLOCKCHAIN_NETWORK_URL=http://localhost:8545
PRIVATE_KEY=your_private_key_here

# External APIs
OCM_API_URL=https://api.openchargemap.io/v3

Frontend Web (frontend/web/.env.local):

VITE_API_URL=http://localhost:4000/api
VITE_OCM_API_URL=https://api.openchargemap.io/v3

Chat Service (chat/.env):

GROQ_API_KEY=your_groq_api_key
PORT=3001
CORS_ORIGIN=http://localhost:5173

Mobile App (frontend/app/.env):

API_BASE_URL=http://localhost:4000/api
CHAT_API_URL=http://localhost:3001

οΏ½ Mobile Application Features

The React Native mobile application includes comprehensive EV management capabilities:

Core Screens

  • Dashboard Screen: Overview of vehicle status and key metrics
  • Vehicle Management: Add, edit, and manage multiple vehicles
  • Battery Management: Real-time battery monitoring and analytics
  • Analytics Screen: Detailed vehicle performance insights
  • Fleet Management: Multi-vehicle oversight for fleet operators
  • Charging Sessions: Track and manage charging activities
  • Blockchain Explorer: View blockchain transactions and battery passports
  • Settings: App configuration and user preferences
  • System Info: Application and system information
  • Integration Status: Monitor external service connections

Smart Features

  • Chat Integration: AI-powered EV assistant with context awareness
  • Real-time Telemetry: Live vehicle data monitoring
  • Offline Capabilities: Core functionality works without internet
  • Multi-theme Support: Dark/light theme options
  • Authentication: Secure login with JWT tokens
  • Push Notifications: Real-time alerts and updates

Technical Implementation

  • Cross-platform: Single codebase for iOS and Android
  • Expo Framework: Streamlined development and deployment
  • TypeScript: Full type safety throughout the application
  • Context API: Efficient state management
  • RESTful Integration: Seamless API communication

Core Endpoints

Authentication & User Management

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User authentication
  • GET /api/user/profile - Get user profile
  • PUT /api/user/profile - Update user profile
  • GET /api/system/health - System health check
  • GET /api/system/info - System information

Vehicle Management

  • GET /api/vehicles - List user vehicles
  • POST /api/vehicles - Register new vehicle
  • GET /api/vehicles/:id - Get vehicle details
  • PUT /api/vehicles/:id - Update vehicle information
  • DELETE /api/vehicles/:id - Remove vehicle

Battery Management

  • POST /api/battery/log - Log battery data
  • GET /api/battery/:vehicleId/history - Get battery history
  • GET /api/battery/:vehicleId/analytics - Get battery analytics
  • POST /api/battery/passport - Create battery passport
  • GET /api/battery/:vehicleId/health - Get battery health score

Charging Management

  • POST /api/charging/start - Start charging session
  • POST /api/charging/end - End charging session
  • GET /api/charging/sessions - Get charging history
  • GET /api/charging/stations - Get nearby charging stations
  • GET /api/charging/:sessionId - Get specific charging session details

Analytics & Reports

  • GET /api/analytics/vehicle/:id - Vehicle analytics
  • GET /api/analytics/summary - Usage summary
  • GET /api/analytics/fleet - Fleet-wide analytics
  • GET /api/analytics/battery-trends - Battery performance trends

Alerts & Notifications

  • GET /api/alerts - Get user alerts
  • PUT /api/alerts/:id/read - Mark alert as read
  • POST /api/alerts - Create new alert
  • DELETE /api/alerts/:id - Delete alert

Ownership & Transfers

  • POST /api/ownership/transfer - Transfer vehicle ownership
  • GET /api/ownership/history/:vehicleId - Get ownership history
  • PUT /api/ownership/approve/:transferId - Approve ownership transfer

Blockchain Integration

  • GET /api/blockchain/transactions - Get blockchain transactions
  • POST /api/blockchain/verify - Verify blockchain data
  • GET /api/blockchain/passport/:id - Get battery passport from blockchain
  • POST /api/blockchain/register-passport - Register new battery passport

API Response Format

{
  "success": true,
  "message": "Operation completed successfully",
  "data": {
    // Response data
  },
  "meta": {
    "timestamp": "2025-09-29T00:00:00.000Z",
    "version": "1.0.0"
  }
}

πŸ”§ Development

Project Structure

smartev/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api/                          # REST API server (Node.js/TypeScript)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/          # Request handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ models/               # MongoDB models
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/               # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ services/             # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ middlewares/          # Custom middleware
β”‚   β”‚   β”‚   β”œβ”€β”€ config/               # Configuration files
β”‚   β”‚   β”‚   β”œβ”€β”€ types/                # TypeScript type definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ utils/                # Utility functions
β”‚   β”‚   β”‚   └── scripts/              # Utility scripts
β”‚   β”‚   β”œβ”€β”€ tests/                    # API tests
β”‚   β”‚   β”œβ”€β”€ postman/                  # Postman collections
β”‚   β”‚   └── logs/                     # Application logs
β”‚   β”œβ”€β”€ blockchain/                   # Smart contracts (Hardhat)
β”‚   β”‚   β”œβ”€β”€ contracts/                # Solidity contracts
β”‚   β”‚   β”œβ”€β”€ scripts/                  # Deployment scripts
β”‚   β”‚   β”œβ”€β”€ artifacts/                # Compiled contracts
β”‚   β”‚   β”œβ”€β”€ deployments/              # Contract addresses
β”‚   β”‚   └── cache/                    # Build cache
β”‚   └── deployments/                  # Deployment configurations
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ web/                          # React web application
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/                # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ services/             # API integration
β”‚   β”‚   β”‚   β”œβ”€β”€ contexts/             # React contexts
β”‚   β”‚   β”‚   β”œβ”€β”€ lib/                  # Utility libraries
β”‚   β”‚   β”‚   └── assets/               # Static assets
β”‚   β”‚   └── public/                   # Public assets
β”‚   └── app/                          # React Native mobile app
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/           # Mobile components
β”‚       β”‚   β”œβ”€β”€ screens/              # Screen components
β”‚       β”‚   β”œβ”€β”€ navigation/           # Navigation setup
β”‚       β”‚   β”œβ”€β”€ api/                  # API services
β”‚       β”‚   β”œβ”€β”€ contexts/             # React contexts
β”‚       β”‚   β”œβ”€β”€ hooks/                # Custom hooks
β”‚       β”‚   β”œβ”€β”€ config/               # Configuration
β”‚       β”‚   β”œβ”€β”€ theme/                # UI themes
β”‚       β”‚   β”œβ”€β”€ types/                # TypeScript types
β”‚       β”‚   └── utils/                # Utility functions
β”‚       β”œβ”€β”€ assets/                   # Mobile assets
β”‚       └── .expo/                    # Expo configuration
β”œβ”€β”€ chat/                             # AI chat service
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/                   # Chat routes
β”‚   β”‚   └── services/                 # AI integration
β”‚   └── uploads/                      # File uploads
β”œβ”€β”€ model & ai/                       # ML/AI engine
β”‚   β”œβ”€β”€ ml/
β”‚   β”‚   β”œβ”€β”€ models/                   # Trained ML models
β”‚   β”‚   β”œβ”€β”€ notebooks/                # Jupyter notebooks
β”‚   β”‚   β”œβ”€β”€ data/                     # Training data
β”‚   β”‚   └── mobility/                 # Python virtual environment
β”‚   └── chatbot/                      # AI chatbot models
β”œβ”€β”€ telementry/                       # IoT telemetry service
β”‚   └── src/                          # Telemetry processing
└── docs/                             # Documentation
    β”œβ”€β”€ api/                          # API documentation
    β”œβ”€β”€ integrations/                 # Integration guides
    β”œβ”€β”€ DEPLOYMENT.md                 # Deployment guide
    └── README.md                     # Documentation overview

Running Tests

# Backend API tests
cd backend/api
npm test

# Frontend tests
cd frontend/web
npm test

# Integration tests
cd telementry
npm test

Code Quality

# Linting
npm run lint

# Type checking
npm run typecheck

# Format code
npm run format

πŸš€ Deployment

Production Environment Setup

  1. Environment Variables: Configure production environment variables
  2. Database: Set up MongoDB Atlas or production MongoDB instance
  3. Blockchain: Deploy smart contracts to mainnet or testnet
  4. API Deployment: Deploy backend API to cloud platform (AWS, Azure, GCP)
  5. Frontend Deployment: Deploy web app to CDN (Vercel, Netlify, CloudFront)
  6. Mobile App: Build and deploy to app stores

Docker Deployment

# Build all services
docker-compose build

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

CI/CD Pipeline

The project includes GitHub Actions workflows for:

  • Automated testing on pull requests
  • Code quality checks and linting
  • Security vulnerability scanning
  • Automated deployment to staging/production

πŸ” Security

Security Measures

  • Authentication: JWT-based secure authentication
  • Input Validation: Comprehensive request validation with Zod
  • Rate Limiting: API rate limiting to prevent abuse
  • CORS: Configured CORS policies for secure cross-origin requests
  • Helmet: Security headers for HTTP responses
  • Environment Variables: Secure configuration management
  • Database Security: MongoDB connection security and data validation

Security Best Practices

  • Regular dependency updates and vulnerability scanning
  • Secure API key management
  • Input sanitization and validation
  • Proper error handling without information disclosure
  • Secure blockchain private key management

πŸ“ˆ Monitoring & Analytics

Application Monitoring

  • Logging: Structured logging with Winston
  • Error Tracking: Comprehensive error logging and monitoring
  • Performance Monitoring: API response time tracking
  • Database Monitoring: MongoDB query performance analysis

Business Analytics

  • Battery Performance: Real-time battery health analytics
  • Charging Patterns: User charging behavior analysis
  • Network Utilization: Charging station usage statistics
  • User Engagement: Application usage metrics

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Documentation

  • API Documentation: /docs/api/
  • Integration Guides: /docs/integrations/
  • Developer Guides: /docs/development/

Community Support

  • Issues: Report bugs and feature requests on GitHub Issues
  • Discussions: Join community discussions on GitHub Discussions
  • Discord: Join our Discord server for real-time support

Commercial Support

For enterprise support, custom integrations, or commercial licensing, please contact us at support@smartev.com.

Empowering the future of electric mobility through technology innovation.

About

FlexiEV is a comprehensive electric vehicle ecosystem platform that combines blockchain technology, AI/ML analytics, IoT telemetry, and multi-platform applications to provide end-to-end EV management solutions. The platform serves manufacturers, dealers, fleet operators, and individual EV owners with a complete suite of tools for battery lifecycle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 73.1%
  • JavaScript 10.4%
  • Python 4.4%
  • Jupyter Notebook 4.1%
  • HTML 3.0%
  • CSS 1.7%
  • Other 3.3%