The platform combines standard admin capabilities with domain-specific emissions and alternatives tooling. The important part is how these workflows connect across governance, composition data, and analytics.
Authentication + Account Flows
01JWT login, admin-mediated user registration, password reset tokens with generic initiation responses, and Gmail OAuth2 email delivery with branded templates.
- Account enumeration-resistant reset initiation
- Role payload included in login response
- Admin-created user flow with bcrypt + optional welcome email
Multi-tenant Organisations + RBAC Admin
02Organisations, users, roles, and user-role assignments with soft delete and role-aware filtering behaviour.
- Paginated list/search/sort admin endpoints
- DB-backed user context helper + cached role-name checks
- Assignment count views for role governance
Product Library + Composition
03Scoped product CRUD with category hierarchy tagging and ingredient composition percentages, returned via server-built snapshots for consistent responses.
- System admin vs organisation member scoping
- 3-level product category hierarchy
- Joined product + ingredient composition snapshots
Product Versioning / Audit / Restore
04Dedicated product_version table with JSONB snapshot + changes, structured diffing, and restore support built around transactions.
- Stable compare format for diffing
- Restore creates a new version record
- Created/updated by metadata retained
Ingredient Emission Factors
05Grid-style master data workflows for ingredients/emissions with subcategory normalization, country resolution helpers, and org/system scope rules.
- Human-ish key normalization to subcategory IDs
- Subcategory mapping cache with TTL
- Country match by ID, ISO, or name
Category Governance + Swap Options
063-level product and ingredient category hierarchies with admin-only mutation, soft delete + reassignment, and ingredient swap mappings for alternatives logic.
- Governed category delete + reassignment workflows
- Ordered swap options mapping with max count cap
- Direct feed into recommender logic
Emissions Proxy + Fallbacks
07Express proxy under /emissions-data/* injects keys and forwards to Python services, with path/URL fallbacks and local Postgres compute fallback when functions are unavailable.
- Browser never sees Function App keys
- Practical resiliency and 404 handling
- Local fallback preserves user workflows
Frontend Emissions Workflows
08Product library emissions views, compare flows, expanded details, and client-managed swap scenario state with graceful degradation in partially deployed environments.
- Per-product and per-kg style metrics
- Limited side-by-side compare interactions
- Draft/saved swap state + tabbed analytics
Insights & Coffee Data/ML Utilities
09Python function apps, scenario composer tooling, notebooks, and a Streamlit upload helper for ingestion validation, fuzzy matching, and repeatable mapping workflows.
- SQLAlchemy engine caching + env-based Postgres creds
- Category-based alternatives grouped by swap class
- Upload validation with Postgres-first and Azure SQL fallback paths