How keerthi-gg/dpp works
This is an MVP digital product passport (DPP) backend with a small browser interface. Its core workflow registers a product, looks it up by passport ID or QR reference, records lifecycle transitions, and exposes lifecycle history and regulator reporting. Lifecycle changes validate role, state progression, and a single-use transaction before updating product state and recording an event. The sampled implementation uses singleton in-memory repositories; route-to-service behavior is represented cautiously because router implementations were not excerpted.
Main entry points: container.py Service wiring · lifecycle_service.py Lifecycle service · main.py API application · lifecycle.py Lifecycle routes
Components 20
Client
- DPP interface
plastic-dpp-greenfield/backend/static/app.js
HTTP API
- API application
plastic-dpp-greenfield/backend/app/main.py - Product routes
plastic-dpp-greenfield/backend/app/routers/products.py - Lifecycle routes
plastic-dpp-greenfield/backend/app/routers/lifecycle.py - Transaction routes
plastic-dpp-greenfield/backend/app/routers/transactions.py - Regulator routes
plastic-dpp-greenfield/backend/app/routers/regulator.py - Mock role identity
plastic-dpp-greenfield/backend/app/routers/dependencies.py
Domain services
- Product service
plastic-dpp-greenfield/backend/app/services/product_service.py - Lifecycle service
plastic-dpp-greenfield/backend/app/services/lifecycle_service.py - Transaction ledger
plastic-dpp-greenfield/backend/app/services/transaction_service.py - Reporting service
plastic-dpp-greenfield/backend/app/services/reporting_service.py - Service wiring
plastic-dpp-greenfield/backend/app/container.py
Domain state
- Passport and event models
plastic-dpp-greenfield/backend/app/models - Product repository
plastic-dpp-greenfield/backend/app/storage/product_repository.py - Lifecycle event repository
plastic-dpp-greenfield/backend/app/storage/lifecycle_repository.py - Transaction repository
plastic-dpp-greenfield/backend/app/storage/transaction_repository.py
Other components
- Manufacturer
- Consumer
- Recycler
- Regulator
Connections 29
- DPP interface → API application: sends requests
- Manufacturer → Product routes: registers products
- Consumer → Lifecycle routes: updates ownership
- Recycler → Lifecycle routes: records recycling
- Regulator → Regulator routes: requests reports
- API application → Product routes: registers routes
plastic-dpp-greenfield/backend/app/main.py - API application → Lifecycle routes: registers routes
plastic-dpp-greenfield/backend/app/main.py - API application → Transaction routes: registers routes
plastic-dpp-greenfield/backend/app/main.py - API application → Regulator routes: registers routes
plastic-dpp-greenfield/backend/app/main.py - Product routes → Product service: dispatches to
plastic-dpp-greenfield/backend/app/routers/products.py - Lifecycle routes → Lifecycle service: dispatches to
plastic-dpp-greenfield/backend/app/routers/lifecycle.py - Transaction routes → Transaction ledger: dispatches to
plastic-dpp-greenfield/backend/app/routers/transactions.py - Regulator routes → Reporting service: dispatches to
plastic-dpp-greenfield/backend/app/routers/regulator.py - Lifecycle routes → Mock role identity: resolves caller
plastic-dpp-greenfield/backend/app/routers/lifecycle.py - Product routes → Mock role identity: resolves caller
plastic-dpp-greenfield/backend/app/routers/products.py - Lifecycle service → Product service: requires product
plastic-dpp-greenfield/backend/app/services/lifecycle_service.py - Lifecycle service → Transaction ledger: validates transaction
plastic-dpp-greenfield/backend/app/services/lifecycle_service.py - Lifecycle service → Lifecycle event repository: records events
plastic-dpp-greenfield/backend/app/services/lifecycle_service.py - Lifecycle service → Product repository: updates product
plastic-dpp-greenfield/backend/app/services/lifecycle_service.py - Product service → Product repository: reads and writes
plastic-dpp-greenfield/backend/app/services/product_service.py - Transaction ledger → Transaction repository: reads and writes
plastic-dpp-greenfield/backend/app/services/transaction_service.py - Reporting service → Product service: reads products
plastic-dpp-greenfield/backend/app/services/reporting_service.py - Service wiring → Product service: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Lifecycle service: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Transaction ledger: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Reporting service: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Product repository: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Lifecycle event repository: constructs
plastic-dpp-greenfield/backend/app/container.py - Service wiring → Transaction repository: constructs
plastic-dpp-greenfield/backend/app/container.py