How devil6911/maitrigrid works
MaitriGrid is a mobile peer-to-peer energy marketplace: users register, connect solar equipment, monitor energy, list surplus, and buy local energy. The React Native app routes users through these workflows and calls a FastAPI backend, which handles domain operations and persists users, energy, listings, transactions, solar devices, and wallets in SQLite. The README establishes the marketplace product intent; sampled code confirms authentication, marketplace purchases, solar registration/connection, and the app/API structure. Several backend routes and screens are indexed but not excerpted, so their specific interactions are not expanded.
Main entry points: main.py FastAPI app · AppNavigator.js App navigation · api.js API client · auth_router.py Authentication
Components 26
Mobile app
- App entry
App.js - Access screens
src/screens/LoginScreen.js - Energy dashboard
src/screens/DashboardScreen.js - Marketplace screen
src/screens/MarketplaceScreen.js - Solar setup
src/screens/SolarIntegrationScreen.js - Statistics screen
src/screens/StatisticsScreen.js - Account screens
src/screens/EditProfileScreen.js - Notifications
src/screens/NotificationsScreen.js - App navigation
src/navigation/AppNavigator.js - Session context
src/context/AuthContext.js - API client
src/services/api.js
Backend API
- FastAPI app
backend/main.py - Authentication
backend/routers/auth_router.py - User profiles
backend/routers/user_router.py - Energy data
backend/routers/energy_router.py - Token security
backend/auth.py - API schemas
backend/schemas.py
Energy marketplace
- Listings and trades
backend/routers/marketplace_router.py - Transaction history
backend/routers/transactions_router.py - Wallet operations
backend/routers/wallet_router.py - Solar integration
backend/routers/solar_router.py - Statistics
backend/routers/statistics_router.py
Persistence
- Domain models
backend/models.py - SQLite database
backend/database.py - Demo data
backend/seed.py
Other components
- Energy user
Connections 37
- Energy user → App entry: opens
App.js - App entry → Session context: provides session
App.js - App entry → App navigation: renders
App.js - App navigation → Access screens: routes to
src/navigation/AppNavigator.js - App navigation → Energy dashboard: routes to
src/navigation/AppNavigator.js - App navigation → Marketplace screen: routes to
src/navigation/AppNavigator.js - App navigation → Solar setup: routes to
src/navigation/AppNavigator.js - App navigation → Statistics screen: routes to
src/navigation/AppNavigator.js - App navigation → Notifications: routes to
src/navigation/AppNavigator.js - App navigation → Account screens: routes to
src/navigation/AppNavigator.js - Access screens → Session context: uses session
src/screens/LoginScreen.js - Session context → API client: calls auth
src/context/AuthContext.js - Energy dashboard → API client: requests energy
src/screens/DashboardScreen.js - Marketplace screen → API client: requests listings
src/screens/MarketplaceScreen.js - Solar setup → API client: calls solar
src/screens/SolarIntegrationScreen.js - Statistics screen → API client: requests statistics
src/screens/StatisticsScreen.js - Account screens → API client: calls profile
src/screens/EditProfileScreen.js - API client → FastAPI app: sends HTTP requests
src/services/api.js - FastAPI app → Authentication: registers
backend/main.py - FastAPI app → User profiles: registers
backend/main.py - FastAPI app → Energy data: registers
backend/main.py - FastAPI app → Listings and trades: registers
backend/main.py - FastAPI app → Transaction history: registers
backend/main.py - FastAPI app → Wallet operations: registers
backend/main.py - FastAPI app → Solar integration: registers
backend/main.py - FastAPI app → Statistics: registers
backend/main.py - Authentication → Token security: verifies credentials
backend/routers/auth_router.py - Authentication → Domain models: reads and writes
backend/routers/auth_router.py - Listings and trades → Domain models: reads and writes
backend/routers/marketplace_router.py - Solar integration → Domain models: reads and writes
backend/routers/solar_router.py - Token security → SQLite database: loads user
backend/auth.py - Domain models → SQLite database: uses base
backend/models.py - FastAPI app → SQLite database: creates tables
backend/main.py - FastAPI app → Demo data: seeds data
backend/main.py - Authentication → API schemas: validates requests
backend/routers/auth_router.py - Listings and trades → API schemas: validates requests
backend/routers/marketplace_router.py - Solar integration → API schemas: validates requests
backend/routers/solar_router.py