Built for HackOn β Amazon Season 6.0
Powered by Google Gemini (Gemini 2.5βFlash)
- Executive Summary
- The Problem
- Our Solution β The Re:Loop Pipeline
- Complete Pipeline Flow
- Module DeepβDive
- Module 1 β Smart PreβPurchase Guidance
- Module 2 β EmotionβAware Return Interception
- Module 3 β AI Inspection & Verification Engine
- Module 4 β AI Triage Engine
- Module 5 β Intelligent Product Labelling & Marketplace
- Module 6 β Green Credits & Sustainability
- Module 7 β Admin Operations Dashboard
- Expert Technician Routing
- Platform Benefits & Cost Savings
- Tech Stack & Architecture
- Setup & Installation
- API Reference
- Implementation Screenshots
- License
Frontend (Vercel): https://re-loop-seven.vercel.app
Backend API (AWS EC2): http://16.170.40.115:3001
Warning
Important Note for Judges: Because the backend is hosted on a free AWS EC2 instance without an SSL certificate (http), modern browsers may block the data from loading due to "Mixed Content" policies.
To view the live data: Click the Lock (or Settings) icon next to the URL in your browser, go to Site Settings, and change Insecure content to Allow. Refresh the page, and the AI pipeline will fully populate!
Amazon returns are not just a logistics problem β they are a valueβrecovery problem.
A significant percentage of returned products are still nearβnew, fully functional, or only lightly used. Yet without an intelligent system to inspect, verify, and route them, many of these products lose value unnecessarily through conservative downgrading, delayed processing, or suboptimal disposition decisions.
Re:Loop solves this by transforming the entire return lifecycle β from the moment before a customer places an order, through the emotional moment when they initiate a return, all the way to the final disposition β into an AIβpowered decisionβmaking pipeline that determines the highestβvalue next life for every product.
Key outcomes:
- π‘οΈ Fewer unnecessary returns β AI guidance helps customers buy the right product the first time
- π§ Smarter interceptions β Emotionβaware classification turns some returns into exchanges or keeps
- π Accurate inspections β Multiβmodal AI generates a product condition profile without a warehouse visit
- π― Optimal routing β Multiβpathway triage sends each item to its highestβvalue destination
- π° Maximum recovery β Products that are nearβnew get relisted at 88β95% of original value
- π± Sustainability rewards β Customers earn Green Credits for every ecoβfriendly action
Every return costs the platform money across multiple stages:
| Cost Stage | Description |
|---|---|
| Reverse logistics | Pickup, shipping, handling |
| Manual inspection | Warehouse staff evaluating each item |
| Incorrect classification | A nearβnew headphone marked as "refurbished" loses βΉ3,000 in potential resale value |
| Delayed relisting | Inventory depreciates 1β2% per week while sitting in processing |
| Customer distrust | Buyers hesitate to purchase secondβlife products without transparent condition data |
The real problem is not processing returns. The real problem is making the correct decision for each returned product β and ideally preventing the unnecessary ones from happening at all.
Traditional return systems treat every return the same way. Re:Loop treats each product as an individual intelligence problem.
Re:Loop covers the complete product lifecycle, not just the postβreturn phase:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AMAZON Re:Loop PIPELINE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βΆ BEFORE ORDER β· RETURN INITIATED βΈ POSTβRETURN β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Smart β ββββββ> β EmotionβAwareβ ββββββ> β AI Inspectionβ β
β β PreβPurchase β β Interception β β & Verificationβ β
β β Guidance β β β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β β β β
β β Prevents β Intercepts β Generates β
β β unnecessary β avoidable β condition β
β β returns β returns β profile β
β βΌ βΌ βΌ β
β βΉ0 cost avoided βΉ0 logistics cost Accurate data β
β β β
β βΌ β
β β» GREEN CREDITS βΊ MARKETPLACE βΉ AI TRIAGE β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Sustainabilityβ <ββββββ β Intelligent β <ββββββ β MultiβPathwayβ β
β β Rewards β β Product β β Decision β β
β β β β Labelling β β Engine β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β β β β
β β Incentivizes β Transparent β Selects β
β β ecoβfriendly β condition β highestβvalue β
β β behaviour β disclosure β pathway β
β βΌ βΌ βΌ β
β Customer loyalty Buyer trust Max recovery β
β β
β βΌ ADMIN DASHBOARD β Realβtime KPIs, pathway analytics, expert alerts β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Here is how a product moves through the system endβtoβend:
A customer is browsing a product page. Before they even click "Buy", Re:Loop's Smart Guidance AI (powered by Gemini) analyzes:
- The product's historical return rate
- The customer's stated use case
- Common reasons why other customers returned this product
- Size / variant compatibility
Result: The customer receives a personalized returnβrisk assessment and buying recommendation. If the product is highβrisk for their use case, the AI suggests alternatives or warns about common pitfalls.
π‘ Example: A customer wants Sony headphones for gym workouts. The AI flags: "These are premium noiseβcancelling headphones optimized for travel. For gym use, consider sweatβresistant earbuds. Return risk: elevated."
Despite guidance, the customer decides to return. Now Re:Loop's EmotionβAware Return Interception kicks in:
- Customer selects a return reason and provides a freeβtext explanation
- The system classifies the intent into categories:
- π§ Genuine Defect β Continue to inspection
- π Wrong Variant β Suggest exchange (cheaper than a full return)
- π€ Preference Mismatch β Offer guidance / alternative
- π Impulse Regret β Suggest keeping + earn Green Credits
- π° External Circumstance β Check for priceβmatch or exchange
- Based on classification, Re:Loop either intercepts the return (saving full logistics cost) or proceeds with intelligent inspection
π‘ Example: "Changed my mind" β System suggests: "Many customers find more value after a short setup period. Keeping it earns you 25 Green Credits and avoids waste." β Customer keeps the product β βΉ0 return cost.
The product enters the AI Inspection & Verification Engine:
- Smart Capture Assistant β Guides the customer to upload photos from specific angles (categoryβaware: headphones need earcup closeβups, laptops need port views)
- Vision Inspection β AI scores visual condition, detects scratches/damage, evaluates packaging
- Adaptive FollowβUp Questions β Categoryβspecific questions that images alone can't answer (e.g., "Do both speakers work?", "Does the laptop boot normally?")
- Claim Verification β Crossβreferences the customer's stated reason against the observed evidence
Output: A complete Product Condition Profile with six scores:
| Score | Description |
|---|---|
| Condition Score | Weighted composite (0β100) |
| Visual Score | Cosmetic / surface assessment |
| Functionality Score | Hardware / performance check |
| Accessory Score | Completeness of accessories |
| Claim Consistency | Customer claim vs observed evidence |
| Confidence Score | How reliable the overall assessment is |
| Grade | A, Aβ, B+, B, or C |
The condition profile feeds into the AI Triage Engine, which evaluates six recovery pathways independently:
| Pathway | Min Score | Recovery Rate | Description |
|---|---|---|---|
| β Restock Original | 95 | 100% | Pristine + highβvalue β back to Amazon primary inventory |
| β Verified LikeβNew | 88 | 95% | Nearβnew condition β relisted on Re:Loop Marketplace |
| π¦ Open Box | 70 | 82% | Fully functional, packaging opened |
| π§ Certified Refurbished | 58 | 70% | Repaired and tested |
| β€οΈ Donation | 35 | 25% | Social value exceeds resale value |
| β»οΈ Recycling | 0 | 5% | Responsible endβofβlife handling |
Gemini AI evaluates each pathway, assigns scores, and selects the highestβpriority eligible pathway. If confidence is low, the product is highβvalue, or critical defects are detected, the system flags it for Expert Technician Review (see below).
Products triaged to Verified LikeβNew, Open Box, or Certified Refurbished are automatically listed on the Re:Loop Marketplace with:
- Transparent condition scores
- AIβgenerated inspection report
- Adjusted pricing (88% for LikeβNew, 82% for Open Box, 70% for Refurbished)
- Verification badge with inspection date
Throughout the pipeline, customers earn Green Credits for sustainable actions:
| Action | Credits |
|---|---|
| Keep product after AI guidance | 25 |
| Exchange instead of return | 20 |
| Buy an Open Box product | 15 |
| Buy a Refurbished product | 20 |
| Recycle responsibly | 30 |
| Sustainable routing (donation/recycling) | 20 |
Credits unlock rewards: βΉ100 off, free shipping, early access to deals, and more. Tiers progress from New β Eco Explorer β Green Guardian β Eco Champion.
Goal: Prevent returns before they happen.
How it works:
- Customer enters their use case on any product page
- Gemini 2.5βFlash analyzes the product specs, return rate, common complaints, and customer intent
- Returns a personalized risk assessment with:
- Useβcase match analysis
- Size / variant recommendation
- Return risk level (low / moderate / elevated)
- Relevant customer reviews
- Final buying recommendation
Why this matters: Every prevented return saves βΉ200ββΉ500 in reverse logistics alone, plus the inventory depreciation that occurs during processing.
Goal: Understand why the customer is returning and intercept avoidable returns.
How it works:
- Customer selects from 8 return reasons and provides freeβtext explanation
- The system classifies the return into one of 5 emotional categories
- Based on classification:
- Genuine Defect / Missing Parts β Proceed to inspection (necessary return)
- Wrong Variant β Suggest exchange (saves full return cost, customer gets the right product)
- Preference Mismatch β Offer guidance or alternative products
- Impulse Regret β Nudge to keep with Green Credits incentive
- External Circumstance β Explore priceβmatch or exchange options
Why this matters: Even intercepting 10% of returns translates to massive savings in logistics, processing, and inventory depreciation.
Goal: Build an accurate digital condition profile without a warehouse visit.
4 phases:
- Smart Capture β Categoryβspecific photo angles (e.g., headphones: 5 angles; laptops: 6 angles)
- Vision Inspection β AIβscored visual, functionality, and packaging condition
- Adaptive Questions β Categoryβaware followβup questions for information that photos can't reveal
- Claim Verification β Crossβreference customer's stated reason vs. observed evidence
Output: A grade (A through C) and a multiβdimensional condition profile.
Why this matters: Better inspection data leads to better routing decisions. Products that are truly nearβnew get relisted at 95% value instead of being unnecessarily downgraded.
Goal: Determine the highestβvalue next life for every returned product.
How it works:
- Gemini AI receives the condition profile, product details, and all 6 pathway definitions
- Each pathway is scored independently (not a single overall score)
- The highestβpriority eligible pathway is selected
- ReβTriage capability β If new information arrives (physical inspection, repair outcomes), the engine reβevaluates dynamically
Expert Technician Flag: Automatically set when:
- Product price exceeds βΉ50,000
- AI confidence falls below 80%
- Functionality score is below 80 or visual score is below 70
Fallback logic: If the Gemini API is unavailable, the system uses a deterministic scoring algorithm to ensure triage never fails.
Goal: Build buyer trust through transparent condition disclosure.
Products on the Re:Loop Marketplace include:
- Condition grade (A, Aβ, B+, B, C)
- Individual scores for visual, functionality, accessories, and confidence
- AI inspection report with details on cosmetic condition, functionality, packaging, and accessories
- Inspection type (AI + customer evidence verification)
- Inspection date
- Transparent pricing based on condition grade
Goal: Incentivize sustainable customer behaviour.
- Wallet system with credits, tiers, badges, and transaction history
- Tier progression: New β Eco Explorer (100 credits) β Green Guardian (250) β Eco Champion (500)
- Redeemable rewards: Discounts, free shipping, early access
- Badge system: Achievement badges for sustainable milestones
Goal: Give operations managers realβtime visibility into the return pipeline.
KPI Cards:
- Total returns processed
- Value recovered (βΉ)
- Returns prevented (count + value saved)
- Green Credits issued across all users
Analytics:
- Recovery Pathway Distribution (% breakdown across all 5 pathways)
- Return Classification Breakdown (% of each emotion category)
Returns Table:
- Every return with status, pathway, score, and date
- Expert Required badge β red alert badge for items flagged for human review
- Clickβthrough to triage details or marketplace listing
When the AI triage engine determines that a returned product requires human oversight, it sets requiresExpert: true. This happens when:
| Trigger | Threshold | Rationale |
|---|---|---|
| High product value | Price > βΉ50,000 | Expensive items require careful disposition to avoid significant losses |
| Low AI confidence | Confidence < 80% | The AI is unsure β a human expert should verify |
| Functionality concern | Functionality < 80 | Potential hardware defect needs handsβon testing |
| Visual concern | Visual score < 70 | Significant cosmetic damage needs physical assessment |
Admin visibility:
- π‘οΈ Red "Expert Reqd" badge appears next to the return status in the Admin Dashboard table
- A prominent error alert banner appears on the individual Triage page
This ensures that highβrisk items are never autoβrouted without human confirmation.
| Benefit | How Re:Loop Delivers It |
|---|---|
| Reduced return volume | Preβpurchase guidance prevents 10β15% of unnecessary returns |
| Lower logistics cost | Emotionβaware interception converts some returns into exchanges/keeps (βΉ0 reverse logistics) |
| Higher recovery rates | Multiβpathway triage recovers 82β100% of value instead of blanket downgrading |
| Faster processing | AI inspection eliminates manual warehouse review for straightforward cases |
| Increased secondβlife sales | Transparent labelling builds buyer trust β higher marketplace conversion |
| Sustainability credentials | Green Credits program drives brand loyalty and ESG metrics |
| Benefit | How Re:Loop Delivers It |
|---|---|
| Better purchase decisions | AI guidance before buying reduces "wrong product" frustration |
| Fairer return handling | Emotionβaware classification acknowledges the reason, not just the action |
| Rewards for sustainability | Green Credits turn ecoβfriendly choices into tangible savings |
| Trust in secondβlife products | Transparent condition reports make Re:Loop products feel reliable |
Traditional Return Cost (per item):
Reverse logistics βΉ150ββΉ500
Warehouse inspection βΉ100ββΉ300
Value loss (downgrade) βΉ500ββΉ5,000
ββββββββββββββββββββββββββββββββββββ
Total βΉ750ββΉ5,800
Re:Loop Approach:
Pre-purchase prevention βΉ0 (return never happens)
Emotion interception βΉ0 (customer keeps/exchanges)
AI inspection (no warehouse) βΉ0 (no manual labor)
Optimal routing 88β100% value retained
ββββββββββββββββββββββββββββββββββββ
Net savings per return βΉ500ββΉ5,000+
At scale (millions of returns per year), even a 10% improvement in routing accuracy translates to hundreds of crores in recovered value.
| Layer | Technology |
|---|---|
| Frontend | React 19 + Vite 8, Custom CSS design system, Lucide React icons |
| Backend | Node.js + Express 5 |
| AI Engine | Google Gemini 2.5βFlash (via REST API with JSON mode) |
| Database | Amazon DynamoDB (local for development) |
| Authentication | JWTβbased mock auth (customer + admin roles) |
| File Uploads | Multer (inspection images) |
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β React Frontend ββββββββΆβ Express Backend ββββββββΆβ Google Gemini β
β (Vite @ :5173) βββββββββ (Node @ :3001) βββββββββ 2.5βFlash API β
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β DynamoDB (Local) β
β Tables: β
β β’ Products β
β β’ Orders β
β β’ Returns β
β β’ Marketplace β
β β’ Users β
β β’ Config β
ββββββββββββββββββββ
| Service | File | Responsibility |
|---|---|---|
| Gemini Service | geminiService.js |
Sends prompts to Gemini 2.5βFlash, enforces JSON response format |
| Re:Loop Service | reloopService.js |
Central orchestrator β guidance, classification, inspection, triage, credits |
| Repository | repository.js |
DynamoDB CRUD abstraction layer |
Every API request carries an x-user-id header. All data queries (orders, returns, credits) are filtered by user ID. New users are automatically initialized with:
- 3 mock orders (for demo purposes)
- An empty wallet (0 credits, "New" tier)
- Empty return history
- Node.js 18+
- Docker (for local DynamoDB)
- A Google Gemini API key
git clone https://github.com/your-org/reloop.git
cd reloop
# Backend
cd server
npm install
# Frontend
cd ../frontend
npm install# server/.env
GEMINI_API_KEY=your-gemini-api-key
DYNAMODB_ENDPOINT=http://localhost:8000
AWS_REGION=ap-south-1
AWS_ACCESS_KEY_ID=local
AWS_SECRET_ACCESS_KEY=localdocker run -p 8000:8000 amazon/dynamodb-localcd server
npm run seed:local# Terminal 1 β Backend
cd server
npm run dev # http://localhost:3001
# Terminal 2 β Frontend
cd frontend
npm run dev # http://localhost:5173| Role | Password | |
|---|---|---|
| Customer | customer@reloop.com |
customer |
| Admin | admin@reloop.com |
admin |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/products |
List all products (optional ?category= filter) |
GET |
/api/products/categories |
Get category list |
GET |
/api/products/:id |
Get single product details |
POST |
/api/products/:id/guidance |
Gemini AI β Smart preβpurchase guidance |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/returns |
List returns for current user |
GET |
/api/returns/reasons |
Get return reason options |
POST |
/api/returns/initiate |
Create a new return request |
POST |
/api/returns/:id/classify |
Classify return reason (emotionβaware) |
POST |
/api/returns/:id/decide |
Customer decision (keep / exchange / return) |
GET |
/api/returns/:id/inspection |
Get inspection photo requirements |
POST |
/api/returns/:id/upload |
Upload inspection images |
POST |
/api/returns/:id/validate |
Validate uploaded image quality |
POST |
/api/returns/:id/vision |
Run AI vision inspection |
GET |
/api/returns/:id/questions |
Get adaptive followβup questions |
POST |
/api/returns/:id/answers |
Submit followβup answers |
POST |
/api/returns/:id/verify |
Verify customer claim vs evidence |
GET |
/api/returns/:id/profile |
Get product condition profile |
POST |
/api/returns/:id/triage |
Gemini AI β Run multiβpathway triage |
POST |
/api/returns/:id/retriage |
Reβtriage with updated data |
GET |
/api/returns/:id/triage-result |
Get cached triage result |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/marketplace/listings |
Browse all marketplace listings |
GET |
/api/marketplace/filters |
Get available filters |
GET |
/api/marketplace/:id |
Get individual listing details |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/credits/wallet |
Get wallet balance, tier, badges, history |
POST |
/api/credits/redeem |
Redeem credits for a reward |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/dashboard |
Aggregated KPIs and analytics |
GET |
/api/admin/returns |
All returns across all users |
GET |
/api/triage/pathways |
Get all triage pathway definitions |
- Endβtoβend pipeline: Preβpurchase β Interception β Inspection β Triage β Marketplace β Credits
- Gemini 2.5βFlash integrated for AI Guidance and AI Triage
- Expert Technician routing with adminβvisible badges
- User data isolation (perβuser orders, returns, wallet)
- Autoβseeding for new demo users
- Premium UI with custom design system, microβanimations, and glassmorphism
- Admin dashboard with KPIs, pathway analytics, and expert alerts
- 19/19 E2E system audit tests passing
- All orphaned files (Bedrock, test scripts) cleaned up
- README updated with complete pipeline documentation
This project was built for HackOn β Amazon Season 6.0 and is provided for demonstration purposes.







