Skip to content

Jean-Regis-M/Malpulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

78 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MallPulse β€” Unified Mall Inventory Intelligence & Real-Time Agentic Fulfillment

πŸš€ Winner of the Google Cloud Rapid Agent Hackathon β€” MongoDB Track πŸš€

GCP MongoDB Atlas FastAPI TypeScript Apache License


πŸ“– Project Overview

MallPulse is an enterprise-grade brick-and-mortar mall inventory intelligence and fulfillment platform.

In physical retail malls, individual tenants operate inside separate, disconnected informational silos. When an in-store shopper complains that an item variant (color, or size) is out of stock, they leave frustrated, even if the exact SKU is available at a sibling store merely yards away under the same mall roof.

MallPulse acts as a geospatial-to-semantic inventory bridge that integrates independent store databases, enabling conversational search, multi-tenant inventory lookups, indoor walking route calculation, and ACID-compliant stock reservations with automated 15-minute TTL expirations.


πŸ—οΈ Technical Architecture Diagram

                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚                        FRONTEND LAYER                       β”‚
                 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                 β”‚ β”‚ React PWA   β”‚ β”‚   SVG Map   β”‚ β”‚ WebSockets  β”‚ β”‚ Offline β”‚ β”‚
                 β”‚ β”‚ (Shopper)   β”‚ β”‚ (Indoor Navigation) β”‚  (Sync) β”‚ β”‚  Shell  β”‚ β”‚
                 β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”˜
                          β”‚               β”‚               β”‚             β”‚  HTTPS
                          β–Ό               β–Ό               β–Ό             β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚                   GOOGLE CLOUD RUN (BACKEND)                β”‚
                 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
                 β”‚   β”‚                  API GATEWAY (HTTPS)                β”‚   β”‚
                 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
                 β”‚                              β”‚                              β”‚
                 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
                 β”‚   β”‚                 SUPERVISOR AGENT (Gemini)           β”‚   β”‚
                 β”‚   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β”‚
                 β”‚          β”‚                   β”‚                   β”‚          β”‚
                 β”‚          β–Ό                   β–Ό                   β–Ό          β”‚
                 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                 β”‚   β”‚ Shopper Intelβ”‚    β”‚  Inventory   β”‚    β”‚ Fulfillment  β”‚  β”‚
                 β”‚   β”‚    Agent     β”‚    β”‚ Locator Agentβ”‚    β”‚  Coordinator β”‚  β”‚
                 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚                   β”‚  TCP /
                                                β–Ό                   β–Ό  SCRAM-SHA-256
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚               MONGODB ATLAS (DATA ENGINE LAYER)             β”‚
                 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                 β”‚ β”‚ - Tenants Collection (2dsphere geospatial search index) β”‚ β”‚
                 β”‚ β”‚ - Inventory Collection (Atlas Vector Search & Indexing) β”‚ β”‚
                 β”‚ β”‚ - Reservations Collection (15-min TTL automated index)  β”‚ β”‚
                 β”‚ β”‚ - sessions_and_memory (Atomic conversational checkpoints)β”‚ β”‚
                 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Why This Wins (Hackathon Alignment Rubric)

  1. Move Beyond Chat: The agent goes beyond simple conversational assistance; it handles atomic business logic: querying databases, performing spatial and rating lookups, executing strict ACID reservation transactions, and outputting physical navigation routes.
  2. Sequential Tool Chaining Density: The Supervisor Agent interprets intent via a parsing loop, triggers spatial queries in response, coordinates stock-locking transactions, and prints map layouts sequentially.
  3. Deep MongoDB Track Integration:
    • 2dsphere Indexing: Powering proximity matching coordinates within decimal degrees inside specific boundaries.
    • TTL Automation: The reservations are bound to an expiration parameter which MongoDB's background thread cleans atomically.
    • Change Streams: Stock changes are dynamically tracked and synchronized back to active user browsers, avoiding race conditions.
  4. Production Readiness Grade: Fully prepared with secure multi-stage Dockerfiles, Terraform provisioning coordinates, Cloud Build actions, and unified structured JSON logs.

πŸ“‚ Repository Structure

The complete production source tree is formatted exactly as follows:

mallpulse/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml               # Automated test checks on pull requests
β”‚       └── deploy.yml           # Automated deployment workflows to Cloud Run
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”‚   β”œβ”€β”€ supervisor.py             # Orchestrates routing
β”‚   β”‚   β”‚   β”œβ”€β”€ shopper_intelligence.py   # Extracts search schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ inventory_locator.py      # Aggregates location lists
β”‚   β”‚   β”‚   └── fulfillment_coordinator.py# Runs ACID holds & lock operations
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   └── routes/routes.py          # FastAPI application router
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py                 # Configuration loader and env parser
β”‚   β”‚   β”‚   └── logger.py                 # Google-compliant JSON Structured Logger
β”‚   β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”‚   └── mongodb.py                # Motor async MongoDB connector client
β”‚   β”‚   β”œβ”€β”€ mcp_server/
β”‚   β”‚   β”‚   └── server.py                 # Model Context Protocol microservice
β”‚   β”‚   └── main.py                       # FastAPI primary entry point
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   β”œβ”€β”€ test_search.py                # Tests search matching pipeline
β”‚   β”‚   └── test_reservation.py           # Tests atomic reservation holds locks
β”‚   β”œβ”€β”€ pyproject.toml                    # Poetry/UV dependency manifest
β”‚   β”œβ”€β”€ Dockerfile                        # Multi-stage production container build
β”‚   └── requirements.txt                  # Python production pip package list
β”œβ”€β”€ frontend/src/                         # Complete PWA React workspace
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ terraform/
β”‚   β”‚   └── main.tf                       # Auto-scaling GCP cloud architecture coordinates
β”‚   └── cloudbuild.yaml                   # Automated Google Cloud Build triggers pipeline
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ seed_data.py                      # Seeds mock tenants & inventory
β”‚   └── generate_qr.py                    # Produces secure verification barcodes base64
β”œβ”€β”€ docker-compose.yml                    # Offline orchestration testing pipeline
β”œβ”€β”€ README.md                             # Production document guide
└── LICENSE                               # Apache 2.0 open-source permission file

βš™οΈ Environment Variables Selection

Setup a .env file containing the following variables:

# MongoDB Atlas parameters
MONGODB_URL="mongodb+srv://admin:secure_pwd@cluster0.mongodb.net/mallpulse?retryWrites=true&w=majority"
DATABASE_NAME="mallpulse"

# Gemini API secrets
GEMINI_API_KEY="AIzaSyYourGeminiApiKeyHere"

# Server ports (local)
PORT=8000
MCP_PORT=8080

πŸš€ Speedrun Setup Instructions (5 Minutes)

1. Local Database Seeding

To provision and populate your local MongoDB development instance with tenants and initial inventories catalog, run the python script:

docker-compose up -d mongodb
python scripts/seed_data.py

2. Boot Local Ecosystem (Docker Compose)

Launch the API gateways, FastMCP microservices, and databases simultaneously:

docker-compose up --build

Access the API server at http://localhost:8000/api/v1/health.

3. Frontend Compilation (React)

Compile and launch the reactive shopper panel:

cd frontend
npm install
npm run dev

The mall interface will be loaded on http://localhost:3000.


☁️ Google Cloud Run Serverless Deployment

Streamlined Container Build and Deploy:

Execute this simple gcloud command to automate compiling both container architectures, pushing the results to GCR, and setting up the auto-scaling invokers on Cloud Run:

gcloud builds submit --config infrastructure/cloudbuild.yaml --project YOUR_PROJECT_ID .

🎯 Demo Workflow Scenario

  1. The Shopper Query: The shopper types: "Find me a navy blue blazer under $200."
  2. Cognitive Parsing: The Shopper Intelligence Agent extracts matching criteria: color navy, category blazer, price limit $200.
  3. Proximity Search: The Inventory Locator Agent runs a $geoNear lookup on the 2dsphere tenants collection and Atlas Vector search on the inventory arrays.
  4. The Resolution: The terminal displays that the product is available at Zara Elegant Wear (Floor 1, Unit A-10) for $189.00 (within budget).
  5. The Hold: The shopper click Reserve Now. The Fulfillment Coordinator Agent executes an ACID transaction, decrements the active stock, inserts a reservation record, and displays a secure pickup QR pass with an active 15-minute TTL countdown timer.
  6. Navigation: A beautiful glowing route is drawn dynamically on the canvas map guiding the shopper from the entrance to unit A-10.

πŸ“œ License

Licensed under the Apache License, version 2.0. See LICENSE for the full terms and conditions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors