App (backend) that provides information about percent of clean energy in next 3 days and let you calculate green window for charging your car in next 48 hours!
Do you want a preview? Here you can check it!
- Backend: [Java 17 + Spring Boot 3.3.5]
- Frontend: [React + TypeScript]
- Container: [Docker]
- API: NESO API
App provides API as said above from any source.
GET /api/charging/best-window?hours=3returns
{
"startTime": "2025-12-01T02:30Z",
"endTime": "2025-12-01T05:30Z",
"cleanEnergyPercent": 78.39999999999999
}GET /api/energy/mixreturns
[
{
"date": "2025-11-30",
"cleanEnergyPercent": 58.69791666666666,
"dailyMix": {
"hydro": 0.0,
"other": 0.0,
"biomass": 9.78958333333333,
"imports": 10.422916666666666,
"gas": 30.872916666666665,
"solar": 2.3854166666666665,
"coal": 0.0,
"nuclear": 13.022916666666665,
"wind": 33.49999999999999
}
},
{
"date": "2025-12-01",
"cleanEnergyPercent": 66.11956521739131,
"dailyMix": {
"hydro": 0.0,
"other": 0.0,
"biomass": 7.908695652173911,
"imports": 10.423913043478262,
"gas": 23.45,
"solar": 0.4304347826086956,
"coal": 0.0,
"nuclear": 11.652173913043478,
"wind": 46.12826086956522
}
}
]src/
├── main/java/org/qualv13/carcharging/
│ ├── client/ # API communication
│ │ └── CarbonIntensityClient # API from carbonintensity.org.uk
│ │
│ ├── config/ # REST config
│ │ ├── RestClientConfig # HTTP
│ │ └── WebConfig # Web
│ │
│ ├── controller/ # Endpoints for frontend
│ │ ├── ChargingController
│ │ └── EnergyController
│ │
│ ├── model/ # Data structures
│ │ ├── dto/ # data transfer objects
│ │ │ ├── ChargingWindowDto
│ │ │ └── DailyMixDto
│ │ └── external/ # data from external sources (API)
│ │ ├── CarbonApiResponse
│ │ ├── FuelMix
│ │ └── GenerationData
│ │
│ ├── service/ # Logic
│ │ └── EnergyService # calculating mix for upcoming days
│ │ └── ChargingService # calculating charging window
│ │
│ ├── util/ # Utilities
│ │ └── EnergyConstants # set of clean energy names
│ │
│ └── CarChargingApplication.java # app start
│
└── test/ # Tests
└── .../service/
├── ChargingServiceTest # test of ChargingService.java
├── EnergyServiceIntegrationTest
└── EnergyServiceTest # test of EnergyService.java
In terminal inside project write
docker build -t carchargingand then
docker run -p 8080:8080 carchargingI like Docker, okay?
if you don't - sure, here is easier version
mvn spring-boot:runor in IntelliJ
find CarChargingApplication.java in src/main/java/.../carcharging and click "Run" next to class name
Feel free to write DMs to me about service and how to improve my work:D