Skip to content

M0izz/EVFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EVFlow - Unified EV Charging Management System

πŸš—βš‘ The Google Maps of EV Charging

A centralized, brand-agnostic EV charging intelligence platform that simplifies and optimizes the electric vehicle charging experience.

🌟 Features

  • Smart Discovery: Find nearby charging stations with real-time availability
  • EV Compatibility Matching: Automatic filtering by your vehicle's connector type
  • Battery Tracking: Manual input with visual indicators
  • Real-Time Status: See which charging points are available, in use, or unavailable
  • Charging History: Track your charging sessions and get personalized insights
  • Smart Recommendations: Get suggestions for closest, least crowded, or fastest chargers
  • Community Validation: Report broken chargers and confirm availability
  • OpenChargeMap Integration: Access to thousands of charging stations worldwide

πŸš€ Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Modern, responsive styling
  • Mapbox GL JS - Interactive maps
  • Lucide React - Beautiful icons

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • PostgreSQL - Database with PostGIS extension
  • JWT - Authentication
  • bcryptjs - Password hashing
  • OpenChargeMap API - Charging station data

πŸ“¦ Installation

Prerequisites

  • Node.js 18+ and npm
  • PostgreSQL 14+ with PostGIS extension
  • Mapbox account (for maps)
  • OpenChargeMap API key (optional, for syncing stations)

Setup Steps

  1. Clone the repository
cd EVFlow
  1. Install frontend dependencies
npm install
  1. Install backend dependencies
cd backend
npm install
cd ..
  1. Set up environment variables

Create a .env file in the root directory:

# Database
DATABASE_URL=postgresql://postgres:password@localhost:5432/evflow
DB_HOST=localhost
DB_PORT=5432
DB_NAME=evflow
DB_USER=postgres
DB_PASSWORD=your_password

# JWT
JWT_SECRET=your-super-secret-jwt-key-change-this

# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000

# Mapbox (get from https://mapbox.com)
NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token

# OpenChargeMap (optional, get from https://openchargemap.org)
OPENCHARGE_API_KEY=your_opencharge_api_key
OPENCHARGE_API_URL=https://api.openchargemap.io/v3

# API URL for frontend
NEXT_PUBLIC_API_URL=http://localhost:5000
  1. Set up the database

Make sure PostgreSQL is running, then:

cd backend
npm run db:setup
npm run db:seed
cd ..
  1. Start the development servers

Terminal 1 - Backend:

cd backend
npm run dev

Terminal 2 - Frontend:

npm run dev
  1. Access the application

πŸ—ΊοΈ Syncing Charging Stations

To import real charging station data from OpenChargeMap:

  1. Register and create an account
  2. Navigate to the dashboard
  3. The app will automatically fetch nearby stations based on your location

Or use the API directly:

curl -X POST http://localhost:5000/api/stations/sync \
  -H "Content-Type: application/json" \
  -d '{"latitude": 37.7749, "longitude": -122.4194, "radius": 10}'

πŸ“± Usage

For EV Drivers

  1. Register/Login: Create an account or sign in
  2. Set Your EV Model: Select your vehicle in the profile
  3. Find Chargers: View nearby stations on the map
  4. Track Battery: Update your battery level for smart recommendations
  5. View Details: Click stations to see charging points and availability
  6. Log Sessions: Track your charging history
  7. Get Insights: View your charging patterns and preferences

API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/profile - Get user profile (protected)
  • PUT /api/auth/profile - Update profile (protected)

Stations

  • GET /api/stations/nearby - Find nearby stations
  • GET /api/stations/:id - Get station details
  • POST /api/stations/sync - Sync from OpenChargeMap
  • POST /api/stations/:id/reports - Submit report (protected)

Compatibility

  • GET /api/ev-models - List all EV models
  • GET /api/compatibility/stations - Get compatible stations (protected)

History

  • POST /api/history/sessions - Log charging session (protected)
  • GET /api/history/sessions - Get charging history (protected)
  • GET /api/history/insights - Get user insights (protected)

Recommendations

  • GET /api/recommendations/closest - Closest available charger
  • GET /api/recommendations/least-crowded - Least crowded station
  • GET /api/recommendations/best-speed - Best speed for battery level

πŸ—οΈ Project Structure

EVFlow/
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ dashboard/         # Dashboard page
β”‚   β”œβ”€β”€ login/            # Login page
β”‚   β”œβ”€β”€ register/         # Registration page
β”‚   β”œβ”€β”€ globals.css       # Global styles
β”‚   β”œβ”€β”€ layout.tsx        # Root layout
β”‚   └── page.tsx          # Landing page
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ StationMap.tsx    # Map component
β”‚   β”œβ”€β”€ StationCard.tsx   # Station card
β”‚   └── BatteryInput.tsx  # Battery input
β”œβ”€β”€ lib/                   # Utilities
β”‚   └── api.ts            # API functions
β”œβ”€β”€ backend/               # Express backend
β”‚   β”œβ”€β”€ controllers/      # Route controllers
β”‚   β”œβ”€β”€ utils/            # Utilities
β”‚   └── server.js         # Express server
β”œβ”€β”€ database/              # Database files
β”‚   └── schema.sql        # PostgreSQL schema
└── package.json          # Dependencies

🎨 Design Philosophy

EVFlow uses a modern, premium design with:

  • Glassmorphism effects for depth
  • Vibrant gradients for visual appeal
  • Smooth animations for engagement
  • Dark mode optimized for nighttime driving
  • Color-coded status for quick recognition
  • Responsive layout for all devices

πŸ” Security

  • JWT-based authentication
  • Password hashing with bcryptjs
  • Helmet.js for security headers
  • CORS configuration
  • Input validation with express-validator

🚧 Future Enhancements

  • Vehicle API integration (Tesla, etc.)
  • Route planning with charging stops
  • Payment integration
  • Station operator dashboard
  • Mobile apps (iOS/Android)
  • Real-time availability updates via WebSocket
  • Social features (reviews, ratings)
  • Advanced analytics for operators

πŸ“„ License

This project is built as a demonstration of a modern full-stack EV charging platform.

🀝 Contributing

This is a startup MVP. For production deployment, consider:

  • Adding comprehensive error handling
  • Implementing rate limiting
  • Setting up monitoring and logging
  • Adding automated tests
  • Implementing CI/CD pipeline
  • Scaling database with read replicas
  • Adding caching layer (Redis)

πŸ“ž Support

For issues or questions, please check the API documentation or review the implementation plan.


Built with ⚑ for the future of electric mobility

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors