CB
cbeAbishek/Vehicle-Fuel-Efficiency-Calculator
Mile Vaganam is a web app for calculating vehicle fuel efficiency, managing vehicle data, and analyzing fuel consumption, built with Java Spring Boot backend and React Vite frontend.
Mile Vaganam - Vehicle Fuel Efficiency Calculator
๐ Overview
Mile Vaganam is a modern web application designed to help users calculate vehicle fuel efficiency, manage vehicle data, and analyze fuel consumption patterns. The platform provides detailed mileage calculations based on vehicle specifications, trip distances, and real-time fuel prices.
โจ Key Features
- ๐ Vehicle Management: Comprehensive vehicle database with detailed specifications
- โฝ Fuel Efficiency Calculator: Real-time mileage and fuel cost calculations
- ๐ Analytics Dashboard: Advanced data visualization and insights
- ๐ User Authentication: Secure user registration and login system
- ๐ฑ Responsive Design: Mobile-first design with modern UI/UX
- ๐ Location-based Pricing: Fuel price calculation based on geographical location
๐๏ธ Architecture
Backend (Spring Boot)
- Framework: Spring Boot 3.4.4
- Language: Java 17
- Database: MySQL 8.0
- Security: Spring Security
- ORM: JPA/Hibernate
- Build Tool: Maven
Frontend (React + Vite)
- Framework: React 19.0.0
- Build Tool: Vite 6.2.0
- Styling: Tailwind CSS 4.1.3
- Animations: Framer Motion
- Icons: Lucide React
- Charts: Recharts
- HTTP Client: Axios
๐ Getting Started
Prerequisites
Before running this application, make sure you have the following installed:
- Java 17 or higher
- Node.js 18 or higher
- MySQL 8.0 or higher
- Maven 3.6 or higher
- Git
๐ ๏ธ Installation & Setup
1. Clone the Repository
git clone https://github.com/Mathi029/mile_vaganam.git
cd mile_vaganam2. Backend Setup (Spring Boot)
cd BackendConfigure Database:
- Create a MySQL database named
mile - Update database credentials in
src/main/resources/application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/mile
spring.datasource.username=your_username
spring.datasource.password=your_passwordInstall Dependencies & Run:
# Install dependencies
mvn clean install
# Run the application
mvn spring-boot:runThe backend server will start at http://localhost:8080
3. Frontend Setup (React + Vite)
cd ../FrontendInstall Dependencies & Run:
# Install dependencies
npm install
# Start development server
npm run devThe frontend application will start at http://localhost:5173
๐ Project Structure
mile_vaganam/
โโโ Backend/ # Spring Boot Backend
โ โโโ src/
โ โ โโโ main/
โ โ โ โโโ java/com/example/mile_vaganam/
โ โ โ โ โโโ controller/ # REST Controllers
โ โ โ โ โ โโโ MileageCalculatorController.java
โ โ โ โ โ โโโ UserCredentialsController.java
โ โ โ โ โ โโโ VehiclesController.java
โ โ โ โ โโโ dto/ # Data Transfer Objects
โ โ โ โ โโโ entity/ # JPA Entities
โ โ โ โ โโโ repository/ # Data Repositories
โ โ โ โ โโโ service/ # Business Logic
โ โ โ โ โโโ config/ # Configuration Classes
โ โ โ โ โโโ exception/ # Custom Exceptions
โ โ โ โโโ resources/
โ โ โ โโโ application.properties
โ โ โโโ test/ # Unit Tests
โ โโโ pom.xml # Maven Dependencies
โ โโโ Dockerfile # Docker Configuration
โ
โโโ Frontend/ # React Frontend
โ โโโ src/
โ โ โโโ Components/ # React Components
โ โ โ โโโ Admin/ # Admin Dashboard Components
โ โ โ โ โโโ dashboard.jsx
โ โ โ โ โโโ analysis.jsx
โ โ โ โ โโโ newanalysis.jsx
โ โ โ โโโ About.jsx
โ โ โ โโโ Contact.jsx
โ โ โ โโโ FuelEstimator.jsx
โ โ โ โโโ landing.jsx
โ โ โ โโโ Login.jsx
โ โ โ โโโ Navbar.jsx
โ โ โ โโโ Vehiclelist.jsx
โ โ โโโ Services/ # API Services
โ โ โโโ assets/ # Static Assets
โ โ โโโ App.jsx # Main App Component
โ โ โโโ main.jsx # Entry Point
โ โโโ public/ # Public Assets
โ โโโ package.json # NPM Dependencies
โ โโโ vite.config.js # Vite Configuration
โ
โโโ README.md # Project Documentation
๐ง API Endpoints
Vehicle Management
GET /vehicles- Get all vehiclesGET /vehicles/{id}- Get vehicle by IDPOST /vehicles- Create new vehiclePUT /vehicles/{id}- Update vehicleDELETE /vehicles/{id}- Delete vehicle
Mileage Calculator
GET /mileage-calculator- Get all calculationsGET /mileage-calculator/{id}- Get calculation by IDPOST /mileage-calculator- Create new calculationPUT /mileage-calculator/{id}- Update calculationDELETE /mileage-calculator/{id}- Delete calculation
User Management
POST /users- Create new userGET /users/{username}- Get user by username
๐๏ธ Database Schema
Tables
vehicles
CREATE TABLE vehicles (
vehicle_id BIGINT PRIMARY KEY AUTO_INCREMENT,
vehicle_type VARCHAR(255),
vehicle_name VARCHAR(255),
variant VARCHAR(255),
fuel_type VARCHAR(255),
vehicle_cc INT,
mileage FLOAT,
tank_capacity FLOAT,
img_url VARCHAR(500)
);mileage_calculator
CREATE TABLE mileage_calculator (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
search_id VARCHAR(36) NOT NULL,
timestamp DATETIME NOT NULL,
vehicle_name VARCHAR(255),
fuel_type VARCHAR(255),
variant VARCHAR(255),
tank_capacity FLOAT,
mileage FLOAT,
trip_distance FLOAT,
vehicle_type VARCHAR(255),
city VARCHAR(255),
state VARCHAR(255),
pincode VARCHAR(10),
latitude DOUBLE,
longitude DOUBLE,
fuel_price DOUBLE
);user_credentials
CREATE TABLE user_credentials (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME
);๐ Available Scripts
Backend (Maven)
mvn clean install # Install dependencies
mvn spring-boot:run # Run development server
mvn test # Run tests
mvn package # Build for productionFrontend (NPM)
npm install # Install dependencies
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint๐ก๏ธ Security Features
- Spring Security: Authentication and authorization
- JWT Tokens: Secure user sessions
- Password Encryption: BCrypt hashing
- CORS Configuration: Cross-origin resource sharing
- Input Validation: Request data validation
๐จ UI/UX Features
- Modern Design: Clean and intuitive interface
- Responsive Layout: Mobile-first design approach
- Smooth Animations: Framer Motion animations
- Interactive Charts: Data visualization with Recharts
- Dark Mode: Toggle between light and dark themes
- Loading States: Skeleton loaders and spinners
๐งช Testing
Backend Testing
cd Backend
mvn testFrontend Testing
cd Frontend
npm run test๐ณ Docker Deployment
Backend Container
cd Backend
docker build -t mile-vaganam-backend .
docker run -p 8080:8080 mile-vaganam-backend๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ฅ Team
- cbeAbishek - Project Lead & Full Stack Developer
๐ฎ Future Enhancements
- Mobile application (React Native)
- Real-time fuel price API integration
- Advanced analytics and reporting
- Multi-language support
- Social media integration
- Vehicle comparison tools
- Fuel efficiency tips and recommendations
Made with โค๏ธ by the Mile Vaganam Team
On this page
Contributors
Created August 2, 2025
Updated August 2, 2025
