How jasraj1111/swiggy-instamart-agent works
SmartCart AI is an autonomous grocery-reordering product, but the checked-in runtime is an early FastAPI foundation: account authentication and preference management work, while purchase-history and prediction endpoints are stubs. The README describes later consumption analysis, depletion forecasting, agent orchestration, reorder execution, and Swiggy MCP integration; these are shown as planned capabilities, not implemented flows. Source excerpts support the authentication, settings, and API wiring shown below. Planned-stage links follow the README architecture; frontend/API wiring and external grocery execution are not evidenced in source, so are marked unverified.
Main entry points: main.py FastAPI application · auth_service.py Authentication service · deps.py Current-user dependency · models.py Domain data models
Components 23
API and user access
- Web frontend
frontend - FastAPI application
backend/main.py - Application configuration
backend/config.py
Identity and preferences
- Authentication routes
backend/api/routes/auth.py - Authentication service
backend/services/auth_service.py - Password and JWT security
backend/utils/security.py - Authentication schemas
backend/schemas/auth.py - Current-user dependency
backend/api/deps.py - Preference settings
backend/api/routes/settings.py - User schemas
backend/schemas/user.py - Domain data models
backend/models/models.py - Async database sessions
backend/database/session.py
Grocery intelligence
- Purchase history API
backend/api/routes/history.py - Prediction API
backend/api/routes/predictions.py - Consumption analysis
backend - Depletion forecasting
backend
Reorder execution
- LangGraph agent
backend - Tool execution layer
backend - Autonomous reorder logic
backend - Swiggy MCP / mock tools
backend
Other components
- SmartCart user
- PostgreSQL
- Grocery service
Connections 31
- SmartCart user → Web frontend: uses
- Web frontend → FastAPI application: calls API
- FastAPI application → Application configuration: loads settings
backend/main.py - FastAPI application → Authentication routes: registers router
backend/main.py - FastAPI application → Purchase history API: registers router
backend/main.py - FastAPI application → Prediction API: registers router
backend/main.py - FastAPI application → Preference settings: registers router
backend/main.py - Authentication routes → Authentication service: calls
backend/api/routes/auth.py - Authentication routes → Authentication schemas: uses
backend/api/routes/auth.py - Authentication service → Password and JWT security: hashes and signs
backend/services/auth_service.py - Authentication service → Domain data models: queries and creates
backend/services/auth_service.py - Authentication service → Authentication schemas: returns responses
backend/services/auth_service.py - Current-user dependency → Password and JWT security: decodes token
backend/api/deps.py - Current-user dependency → Authentication service: looks up user
backend/api/deps.py - Purchase history API → Current-user dependency: requires user
backend/api/routes/history.py - Purchase history API → Domain data models: references user model
backend/api/routes/history.py - Prediction API → Current-user dependency: requires user
backend/api/routes/predictions.py - Prediction API → Domain data models: references user model
backend/api/routes/predictions.py - Preference settings → Current-user dependency: requires user
backend/api/routes/settings.py - Preference settings → Domain data models: reads and updates
backend/api/routes/settings.py - Preference settings → User schemas: validates preferences
backend/api/routes/settings.py - Async database sessions → Application configuration: reads database URL
backend/database/session.py - Domain data models → Async database sessions: uses ORM base
backend/models/models.py - Async database sessions → PostgreSQL: opens sessions
- Purchase history API → Consumption analysis: planned input
README.md - Consumption analysis → Depletion forecasting: feeds forecasts
README.md - Depletion forecasting → LangGraph agent: supplies predictions
README.md - LangGraph agent → Tool execution layer: dispatches tools
README.md - Tool execution layer → Swiggy MCP / mock tools: invokes integration
README.md - LangGraph agent → Autonomous reorder logic: supports automation
README.md - Autonomous reorder logic → Grocery service: executes reorder