A comprehensive fuel quota management system built with Spring Boot backend and React frontend to manage fuel distribution during crisis situations.
- User Management: Registration, authentication with JWT
- Vehicle Registration: QR code generation for vehicles
- Quota Management: Automatic weekly quota calculation and tracking
- Fuel Station Management: Station registration and fuel stock tracking
- Transaction Processing: Real-time fuel transaction management
- Security: Role-based access control (Admin, Station Manager, Vehicle Owner)
- API Documentation: Swagger/OpenAPI 3.0
- Modern UI: Beautiful and responsive design with Tailwind CSS
- Dashboard: Real-time quota status and activity tracking
- Vehicle Management: Register and manage multiple vehicles
- Station Locator: Find nearby fuel stations
- Transaction History: View fuel purchase history
- Role-based Access: Different interfaces for different user roles
- Framework: Spring Boot 3.x
- Language: Java 21
- Database: MySQL 8.0
- ORM: Spring Data JPA / Hibernate
- Security: Spring Security + JWT
- API Documentation: Swagger/OpenAPI 3.0
- Build Tool: Maven
- Framework: React 18
- Build Tool: Vite
- Styling: Tailwind CSS
- State Management: React Query
- Forms: React Hook Form
- Routing: React Router DOM
- Notifications: React Hot Toast
- JDK 21 or higher
- Node.js 16 or higher
- MySQL 8.0 or higher
- Maven 3.6+
- Git
git clone <repository-url>
cd FuelFe- Start MySQL server
- Create the database:
CREATE DATABASE fuel_quota_db;- Run the SQL script:
mysql -u root -p fuel_quota_db < database.sqlcd backend
# Update application.properties with your MySQL credentials
mvn clean install
mvn spring-boot:runcd frontend
npm install
npm run devSimply run the batch file:
run-system.bat- Frontend: http://localhost:3000
- Backend API: http://localhost:8080/api
- Swagger UI: http://localhost:8080/swagger-ui.html
- Username: admin
- Password: password
- Username: johndoe
- Password: password
- Register: Create an account
- Add Vehicle: Register your vehicle with details
- View Quota: Check remaining fuel quota
- Find Stations: Locate nearby fuel stations
- Track Usage: Monitor fuel consumption history
- Login: Use station manager credentials
- Scan QR: Scan vehicle QR codes
- Process Fuel: Record fuel transactions
- Manage Stock: Update fuel inventory
- Dashboard: Monitor system-wide statistics
- User Management: Manage all user accounts
- Station Management: Add/edit fuel stations
- Quota Settings: Configure quota rules
- Reports: Generate system reports
# Database
spring.datasource.url=jdbc:mysql://localhost:3306/fuel_quota_db
spring.datasource.username=root
spring.datasource.password=your_password
# JWT
jwt.secret=your_secret_key
jwt.expiration=86400000
# Server
server.port=8080VITE_API_URL=http://localhost:8080/apisrc/
βββ main/java/com/fuelquota/
β βββ entity/ # JPA Entities
β βββ repository/ # Data Access Layer
β βββ service/ # Business Logic
β βββ controller/ # REST Controllers
β βββ dto/ # Data Transfer Objects
β βββ security/ # Security Configuration
β βββ config/ # Application Configuration
src/
βββ components/ # Reusable UI Components
βββ pages/ # Page Components
βββ contexts/ # React Contexts
βββ services/ # API Services
βββ utils/ # Utility Functions
βββ assets/ # Static Assets
- JWT Authentication: Secure token-based authentication
- Role-based Access Control: Different access levels for users
- Password Encryption: BCrypt password hashing
- CORS Configuration: Secure cross-origin requests
- Input Validation: Server-side and client-side validation
- Car: 20L per week (base)
- Motorcycle: 4L per week
- Three Wheeler: 8L per week
- Van: 30L per week
- Lorry: 50L per week
- Bus: 80L per week
- Truck: 100L per week
Note: Quotas are adjusted based on engine capacity
- Weekly automatic reset every Monday
- Manual reset capability for admins
- Real-time quota tracking
- Real-time Monitoring: Track fuel distribution across regions
- Emergency Allocation: Quick quota adjustments during shortages
- Stock Management: Monitor fuel station inventory levels
- Usage Analytics: Identify consumption patterns
cd backend
mvn testcd frontend
npm testOnce the backend is running, visit http://localhost:8080/swagger-ui.html for interactive API documentation.
POST /auth/signin- User loginPOST /auth/signup- User registrationPOST /vehicles/register- Register vehicleGET /vehicles/my-vehicles- Get user vehiclesGET /stations- Get fuel stationsPOST /transactions- Create fuel transaction
- Build JAR file:
mvn clean package - Deploy to server:
java -jar target/fuel-quota-backend-1.0.0.jar
- Build for production:
npm run build - Deploy dist folder to web server
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License.
For support and questions:
- Email: support@fuelquota.com
- Documentation: [Project Wiki]
- Issues: [GitHub Issues]
- v1.0.0: Initial release with core features
- Vehicle registration and QR code generation
- Quota management system
- Basic user authentication
- Fuel station management
Note: This system is designed for crisis fuel management scenarios and includes features for quota enforcement, real-time monitoring, and efficient distribution tracking.
# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/fuel_quota_db
spring.datasource.username=your_username
spring.datasource.password=your_password
# JWT Configuration
app.jwt.secret=your-secret-key-here
app.jwt.expiration=86400000
# Twilio Configuration (for SMS)
twilio.account.sid=your_twilio_sid
twilio.auth.token=your_twilio_token
twilio.phone.number=your_twilio_phone
# DMT Mock Service URL
dmt.service.url=http://localhost:8081The Mock DMT (Department of Motor Traffic) service runs on port 8081:
cd mock-dmt-service
mvn spring-boot:runUsing Maven:
mvn clean install
mvn spring-boot:runUsing NetBeans:
- Open the project in NetBeans
- Right-click on the project β Run
The application will start on http://localhost:8080
- Username:
admin - Password:
admin123 - Role:
ADMIN
- Username:
vehicle_owner1 - Password:
password123 - Role:
VEHICLE_OWNER
- Username:
station_owner1 - Password:
password123 - Role:
FUEL_STATION_OWNER
- Username:
operator1 - Password:
password123 - Role:
FUEL_STATION_OPERATOR
POST /auth/login- User loginPOST /auth/register- User registrationGET /auth/check-username?username={username}- Check username availabilityGET /auth/check-email?email={email}- Check email availability
POST /vehicle-owner/register- Register as vehicle ownerGET /vehicle-owner/profile- Get profile detailsPOST /vehicle-owner/vehicles- Register a new vehicleGET /vehicle-owner/vehicles- List all vehiclesGET /vehicle-owner/vehicles/{id}- Get vehicle detailsGET /vehicle-owner/vehicles/{id}/qr-code- Get vehicle QR code
POST /fuel-station/register- Register fuel stationGET /fuel-station/my-station- Get station detailsPOST /fuel-station/operators- Add new operatorGET /fuel-station/operators- List all operatorsDELETE /fuel-station/operators/{id}- Remove operator
POST /transactions/scan-qr- Scan vehicle QR codePOST /transactions/pump-fuel- Record fuel pumpingGET /transactions/my-transactions- Get operator transactionsGET /transactions/vehicle/{vehicleId}- Get vehicle transactionsGET /transactions/fuel-station/{stationId}- Get station transactions
POST /mobile/api/auth/login- Mobile operator loginPOST /mobile/api/scan-qr- Scan QR codePOST /mobile/api/pump-fuel- Pump fuel transactionGET /mobile/api/operator/profile- Get operator profileGET /mobile/api/operator/transactions/today- Today's transactionsGET /mobile/api/operator/stats- Operator statistics
GET /admin/dashboard/stats- Dashboard statisticsGET /admin/users- List all usersGET /admin/fuel-stations- List all fuel stationsPUT /admin/fuel-stations/{id}/approve- Approve fuel stationGET /admin/transactions- List all transactionsGET /admin/reports/fuel-consumption- Fuel consumption report
The application uses JWT (JSON Web Token) for authentication:
- Login with credentials to receive JWT token
- Include token in Authorization header:
Bearer {token} - Token expires after 24 hours
users- Authentication and user managementvehicle_owners- Vehicle owner detailsvehicles- Registered vehiclesfuel_stations- Registered fuel stationsfuel_station_operators- Station operatorsfuel_quotas- Weekly fuel quotasfuel_transactions- Fuel pumping recordsaudit_logs- System audit trail
vehicle_registry- Mock vehicle registration data
- Import the API collection (if available)
- Set up environment variables:
base_url:http://localhost:8080token: JWT token after login
Login:
POST /auth/login
{
"usernameOrEmail": "vehicle_owner1",
"password": "password123"
}Register Vehicle:
POST /vehicle-owner/vehicles
Headers: Authorization: Bearer {token}
{
"vehicleNumber": "WP CAB-1234",
"vehicleType": "CAR",
"fuelType": "PETROL",
"engineCapacity": 1500,
"ownerNic": "199012345678V"
}Pump Fuel (Mobile):
POST /mobile/api/pump-fuel
Headers: Authorization: Bearer {operator_token}
{
"vehicleId": 1,
"pumpedLiters": 10.5,
"unitPrice": 450.00
}-
Update
application-prod.properties:- Database credentials
- JWT secret key
- External service URLs
- SMS/Email service credentials
-
Build for production:
mvn clean package -Pprod- Run the JAR:
java -jar target/fuel-quota-backend-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod- β JWT Authentication & Authorization
- β Vehicle Registration with DMT Validation
- β QR Code Generation for Vehicles
- β Fuel Station Registration & Approval
- β Operator Management
- β Real-time Quota Tracking
- β SMS Notifications (Twilio)
- β Transaction Recording
- β Admin Dashboard
- β Audit Logging
- β Scheduled Quota Reset (Weekly)
- β Mobile API for Android App
- 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
This project is licensed under the MIT License.
- Group project for INTE 31273
- Maximum 6 members per group
For issues and questions:
- Check the documentation
- Review existing issues
- Create a new issue with detailed information
Note: Remember to commit your work regularly to the Git repository. Do not wait until the last moment!