How atharvpatil8147/nexcart-scm works
NexCart monitors external supply-chain signals, evaluates disruption risk against inventory, and supports customer recovery through personalized restock nudges. Users sign in to role-based workspaces to review live signals, SKU risk, disruptions, campaigns, and analytics; the frontend calls a FastAPI API backed by MongoDB. The README documents the two-agent prediction-to-nudge workflow and assistant, digest, analytics, SSE, and scheduling capabilities. Several implementation paths are unsampled, so those branches are included only where documented, with uncertain links omitted.
Main entry points: main.py FastAPI application · disruption_agent.py Disruption agent · connection.py MongoDB · nudges.py Nudge routes
Components 34
Web application
- Role workspaces
frontend/src/App.jsx - Session context
frontend/src/auth/AuthContext.jsx - API client
frontend/src/api/client.js - SKU risk view
frontend/src/pages/SKURisk.jsx - Role dashboards
frontend/src/pages/RoleWorkspaces.jsx - Assistant widget
frontend/src/components/AssistantWidget.jsx
API and access
- FastAPI application
backend/main.py - Authentication routes
backend/routers/auth.py - SKU routes
backend/routers/skus.py - Disruption routes
backend/routers/disruptions.py - Signal routes
backend/routers/signals.py - Nudge routes
backend/routers/nudges.py - Dashboard routes
backend/routers/dashboard.py - Assistant routes
backend/routers/assistant.py - Tokens and RBAC
backend/security.py - Permission rules
backend/permissions.py
Risk intelligence
- Disruption agent
backend/agents/disruption_agent.py - Risk scoring
backend/utils/risk_scorer.py - News signals
backend/services/news_service.py - Weather signals
backend/services/weather_service.py - Shipping signals
backend/services/shipping_service.py
Customer recovery
- Personalization agent
backend/agents/nudge_agent.py - LLM providers
backend/services/llm_provider.py - Operations assistant
backend/services/assistant_service.py - Customer notifications
backend/services/notification.py
Persistence and integrations
- MongoDB
backend/database/connection.py - Domain models
backend/database/models.py - Collection definitions
backend/database/collections.py - Audit logging
backend/audit.py - EventBridge
backend/services/eventbridge.py
Other components
- Operations user
- News, weather, shipping
- Push and email
- Groq and Gemini
Connections 47
- Operations user → Role workspaces: uses
frontend/src/App.jsx - Role workspaces → Session context: provides session
frontend/src/App.jsx - Role workspaces → SKU risk view: routes to
frontend/src/App.jsx - Role workspaces → Role dashboards: routes to
frontend/src/App.jsx - SKU risk view → API client: requests data
frontend/src/pages/SKURisk.jsx - Role dashboards → API client: requests data
frontend/src/pages/RoleWorkspaces.jsx - Assistant widget → API client: sends questions
frontend/src/components/AssistantWidget.jsx - Session context → API client: checks session
frontend/src/auth/AuthContext.jsx - API client → FastAPI application: HTTP requests
frontend/src/api/client.js - FastAPI application → Authentication routes: mounts routes
backend/main.py - FastAPI application → SKU routes: mounts routes
backend/main.py - FastAPI application → Disruption routes: mounts routes
backend/main.py - FastAPI application → Signal routes: mounts routes
backend/main.py - FastAPI application → Nudge routes: mounts routes
backend/main.py - FastAPI application → Dashboard routes: mounts routes
backend/main.py - FastAPI application → Assistant routes: mounts routes
backend/main.py - Authentication routes → Tokens and RBAC: uses tokens
backend/routers/auth.py - FastAPI application → Tokens and RBAC: checks requests
backend/main.py - Tokens and RBAC → Permission rules: checks roles
backend/security.py - News, weather, shipping → Disruption agent: provides signals
README.md - Disruption agent → News signals: collects signals
backend/agents/disruption_agent.py - Disruption agent → Weather signals: collects signals
backend/agents/disruption_agent.py - Disruption agent → Shipping signals: collects signals
backend/agents/disruption_agent.py - Disruption agent → LLM providers: analyzes risk
backend/agents/disruption_agent.py - Disruption agent → MongoDB: updates records
backend/agents/disruption_agent.py - Disruption agent → EventBridge: publishes events
backend/agents/disruption_agent.py - SKU routes → Risk scoring: scores risk
backend/routers/skus.py - Nudge routes → Personalization agent: runs campaign
backend/routers/nudges.py - Personalization agent → LLM providers: generates copy
backend/agents/nudge_agent.py - Groq and Gemini → LLM providers: model requests
README.md - Personalization agent → Customer notifications: dispatches nudges
backend/agents/nudge_agent.py - Customer notifications → Push and email: sends messages
README.md - Assistant routes → Operations assistant: handles questions
backend/routers/assistant.py - Operations assistant → LLM providers: uses model
backend/services/assistant_service.py - SKU routes → MongoDB: reads and writes
backend/routers/skus.py - Disruption routes → MongoDB: reads records
backend/routers/disruptions.py - Signal routes → MongoDB: reads records
backend/routers/signals.py - Nudge routes → MongoDB: reads and writes
backend/routers/nudges.py - Dashboard routes → MongoDB: reads metrics
backend/routers/dashboard.py - MongoDB → Collection definitions: uses names
backend/database/connection.py - SKU routes → Domain models: validates data
backend/routers/skus.py - Disruption routes → Domain models: validates data
backend/routers/disruptions.py - Signal routes → Domain models: validates data
backend/routers/signals.py - Nudge routes → Domain models: validates data
backend/routers/nudges.py - Authentication routes → Audit logging: records actions
backend/routers/auth.py - Disruption routes → Audit logging: records actions
backend/routers/disruptions.py - Nudge routes → Audit logging: records actions
backend/routers/nudges.py