How manushwi/madhuchain works
MadhuChain is a honey traceability system: beekeeper and factory workflows record supply-chain events, while consumers scan jar codes to inspect provenance and authenticity. The backend coordinates app-facing workflows, database records, analytics and fraud checks, and a permissioned Fabric ledger; a KVIC dashboard supports review and administration. The README documents the end-to-end capabilities, but several app screens and backend subsystems were not sampled, so those links are documented rather than inferred from unsampled code.
Main entry points: app.ts API router · fabricService.ts Fabric gateway · prisma.ts Operational database · factory.ts Factory workflows
Components 23
Field operations
- Beekeeper app
apps/beekeeper-app/app/(tabs)/index.tsx - Hive monitoring
services/backend/src/routes/hives.ts - Sensor ingestion
services/backend/src/routes/sensorData.ts - Harvest batches
services/backend/src/routes/batches.ts
Factory operations
- Factory app
apps/factory-app/app/(tabs)/batch/[id].tsx - Factory workflows
services/backend/src/routes/factory.ts - Batch blending
apps/factory-app/app/blend/create.tsx
Backend and ledger
- Authentication
services/backend/src/routes/auth.ts - API router
services/backend/src/app.ts - Operational database
services/backend/src/db/prisma.ts - Hive analytics
services/backend/src/services/hiveAnalytics.ts - Fraud checks
services/backend/src/services/fraudChecks.ts - Fabric gateway
services/backend/src/services/fabric/fabricService.ts - Ledger contract
chain/chaincode/madhuchain-cc/contract.go - Ledger event indexer
services/backend/src/workers/fabricEventIndexer.ts
Verification and oversight
- Jar verification site
apps/consumer-web/app/v/[token]/page.tsx - Verification API
services/backend/src/routes/verify.ts - KVIC dashboard
apps/kvic-dashboard/app/(dashboard)/page.tsx - Administration routes
services/backend/src/routes/admin.ts
Other components
- Beekeeper
- Factory worker
- Jar buyer
- KVIC reviewer
Connections 29
- Beekeeper → Beekeeper app: uses
- Beekeeper app → API router: requests
- API router → Authentication: routes auth
services/backend/src/app.ts - API router → Hive monitoring: routes hive
services/backend/src/app.ts - API router → Sensor ingestion: routes telemetry
services/backend/src/app.ts - API router → Harvest batches: routes batches
services/backend/src/app.ts - Hive monitoring → Operational database: reads and writes
services/backend/src/routes/hives.ts - Sensor ingestion → Operational database: stores readings
services/backend/src/routes/sensorData.ts - Sensor ingestion → Hive analytics: evaluates telemetry
services/backend/src/routes/sensorData.ts - Factory worker → Factory app: uses
- Factory app → API router: requests
- API router → Factory workflows: routes workflows
services/backend/src/app.ts - API router → Batch blending: supports blending
services/backend/src/app.ts - Factory workflows → Operational database: reads and writes
services/backend/src/routes/factory.ts - Factory workflows → Fraud checks: checks batches
services/backend/src/routes/factory.ts - Harvest batches → Operational database: records batches
services/backend/src/routes/batches.ts - Harvest batches → Fabric gateway: stamps harvest
services/backend/src/routes/batches.ts - Factory workflows → Fabric gateway: records events
services/backend/src/routes/factory.ts - Fabric gateway → Ledger contract: submits transactions
- Ledger event indexer → Fabric gateway: indexes events
- Jar buyer → Jar verification site: scans jar code
- Jar verification site → Verification API: fetches verification
apps/consumer-web/app/v/[token]/page.tsx - Verification API → Operational database: reads records
- Verification API → Fabric gateway: checks ledger proof
- KVIC reviewer → KVIC dashboard: reviews batches
- KVIC dashboard → Administration routes: requests oversight
- API router → Administration routes: routes admin
services/backend/src/app.ts - Administration routes → Operational database: reads and writes
services/backend/src/routes/admin.ts - Administration routes → Fabric gateway: audits ledger
services/backend/src/routes/admin.ts