How dhanyalk-alt/energy-marketplace works
Energy Marketplace supports producer and consumer accounts, role-specific dashboards, renewable-energy listings and purchases, negotiations, and related market features. The principal workflow is sign-in, enter the role-specific marketplace, then list or request energy and manage trades. The README documents PostgreSQL-backed FastAPI APIs; the tree also shows assistant, insights, battery, and weather subsystems. Router registration and sampled auth/weather code support the wiring shown; unsampled route-to-service relationships are left unspecified.
Main entry points: main.py FastAPI application · App.jsx Role application · login.py Authentication routes · weather.py Weather routes
Components 25
Web application
- Role application
src/App.jsx - Sign-in and register
src/components/auth/AuthGateway.jsx - Producer dashboard
src/components/producer/ProducerLayout.jsx - Consumer dashboard
src/components/consumer/ConsumerLayout.jsx - Weather dashboard
src/components/producer/weather/Forecasting.jsx - Weather data hook
src/components/producer/weather/useWeather.js - Weather API client
src/components/producer/weather/weatherService.js
Marketplace API
- FastAPI application
energy-backend/app/main.py - Authentication routes
energy-backend/app/routers/login.py - Producer routes
energy-backend/app/routers/producer.py - Consumer routes
energy-backend/app/routers/consumer.py - Trading routes
energy-backend/app/routers/trading.py - Market routes
energy-backend/app/routers/market.py - Weather routes
energy-backend/app/routers/weather.py - Assistant routes
energy-backend/app/routers/assistant.py - Producer insights routes
energy-backend/app/routers/producer_insights.py - Battery routes
energy-backend/app/battery_router.py
Marketplace services
- Negotiation pricing
energy-backend/app/services/negotiation_service.py - Permission-safe context
energy-backend/app/assistant_context_service.py - Producer recommendations
energy-backend/app/services/producer_insights_service.py
Persistent state
- Marketplace database
energy-backend/app/database.py
External data
- Weather and location data
energy-backend/app/external_data_service.py
Other components
- Producer
- Consumer
- Weather provider
Connections 26
- Producer → Role application: uses
- Consumer → Role application: uses
- Role application → Sign-in and register: shows
- Sign-in and register → Authentication routes: registers or signs in
- Authentication routes → FastAPI application: serves through
- Role application → Producer dashboard: selects role
- Role application → Consumer dashboard: selects role
- FastAPI application → Authentication routes: mounts
- FastAPI application → Producer routes: mounts
- FastAPI application → Consumer routes: mounts
- FastAPI application → Trading routes: mounts
- FastAPI application → Market routes: mounts
- FastAPI application → Weather routes: mounts
- FastAPI application → Assistant routes: mounts
- FastAPI application → Producer insights routes: mounts
- FastAPI application → Battery routes: mounts
- Weather dashboard → Weather data hook: consumes
- Weather data hook → Weather API client: fetches forecast
- Weather API client → Weather routes: requests forecast
- Weather routes → Weather and location data: obtains weather data
- Weather and location data → Weather provider: requests forecast
- Assistant routes → Permission-safe context: builds context
- Producer insights routes → Producer recommendations: serves insights
- Trading routes → Negotiation pricing: calculates offer
- Permission-safe context → Marketplace database: reads records
- Producer recommendations → Marketplace database: reads marketplace data