Skip to content

agrpranjal07/walmart-autocart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Walmart Smart Shopping E-commerce Platform

A full-stack e-commerce platform with AI-powered shopping assistance, built with Next.js 14, Express.js, and a microservices architecture.

๐Ÿš€ Features

  • Smart Shopping Assistant: AI-powered product extraction from text and images
  • Multiple Input Methods: Manual entry, text input, image upload, and camera capture
  • Product Search: Intelligent product matching with top 6 results per item
  • Shopping Cart: Full cart management with quantity adjustments and coupon support
  • Walmart Branding: Clean, modern UI with authentic Walmart styling
  • Microservices Architecture: Scalable backend with separate NLP and search services
  • Real-time Updates: Seamless cart synchronization across pages

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend      โ”‚    โ”‚   Backend       โ”‚    โ”‚  NLP Service    โ”‚
โ”‚  (Next.js 14)   โ”‚โ—„โ”€โ”€โ–บโ”‚  (Express.js)   โ”‚โ—„โ”€โ”€โ–บโ”‚    (Port 4001)  โ”‚
โ”‚   Port 3000     โ”‚    โ”‚   Port 4000     โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ Search Service  โ”‚
                       โ”‚   (Port 4002)   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 14 with App Router
  • TypeScript for type safety
  • Tailwind CSS for styling
  • React Dropzone for file uploads
  • Axios for API calls

Backend

  • Express.js REST API
  • Node.js runtime
  • CORS for cross-origin requests
  • Dotenv for environment variables

Services

  • IP Service: Image processing for product extraction
  • Search Service: Product search and matching with mock Walmart data
  • Natural library for text processing

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js 18+
  • npm or yarn

Quick Start

  1. Clone the repository

    git clone <repository-url>
    cd walmart-autocart
  2. Install dependencies for all services

    npm run install:all
  3. Start all services

    npm run dev

This will start:

Manual Installation

If you prefer to start services individually:

# Frontend
cd frontend
npm install
npm run dev

# Backend (in new terminal)
cd backend
npm install
npm run dev

# NLP Service (in new terminal)
cd nlp-service
npm install
npm run dev

# Search Service (in new terminal)
cd search-service
npm install
npm run dev

๐Ÿณ Docker Support

Using Docker Compose

docker-compose up -d

Building Individual Services

# Frontend
docker build -t walmart-frontend ./frontend

# Backend
docker build -t walmart-backend ./backend

# NLP Service
docker build -t walmart-nlp ./nlp-service

# Search Service
docker build -t walmart-search ./search-service

๐ŸŒŸ Usage

1. Home Page

  • Manual Entry: Add products manually with names and quantities
  • Text Input: Paste shopping lists or product descriptions
  • Image Upload: Drag and drop product images
  • Camera Capture: Take photos of products or shopping lists

2. Product Search

  • System processes input through NLP service
  • Finds top 6 product matches per item
  • Displays results with prices, ratings, and reviews

3. Shopping Cart

  • Add products to cart from results page
  • Adjust quantities with +/- buttons
  • Apply coupon codes (try "SAVE10" or "WELCOME")
  • Proceed to checkout

4. Text Input Examples

2 gallons of milk
1 loaf of bread
toothpaste
bananas

or

- Milk (2 gallons)
- Bread
- Eggs (12 count)
- Toothpaste

or

๐Ÿ”ฝ Input: Handwritten Image

Shopping List Image

User uploads this photo of a handwritten list containing:

  1. Maggi 2 Packet
  2. Peanut Butter Creamy
  3. 1kg Maida
  4. Toothpaste
  5. Garam Masala

๐Ÿช„ NLP Service Converts This To:

[
  { "name": "Maggi", "query": "2 Packet Maggi" },
  { "name": "Peanut", "query": "Peanut Butter Creamy" },
  { "name": "Maida", "query": "1kg Maida" },
  { "name": "Toothpaste", "query": "Toothpaste" },
  { "name": "Garam", "query": "Garam Masala" }
]

๐Ÿ”ง Configuration

Environment Variables

Frontend (.env.local)

NEXT_PUBLIC_BACKEND_URL=http://localhost:4000
NEXT_PUBLIC_NLP_SERVICE_URL=http://localhost:4001
NEXT_PUBLIC_SEARCH_SERVICE_URL=http://localhost:4002

Backend (.env)

PORT=4000
NLP_SERVICE_URL=http://localhost:4001
SEARCH_SERVICE_URL=http://localhost:4002
NODE_ENV=development

NLP Service (.env)

PORT=4001
NODE_ENV=development
MAX_FILE_SIZE=10mb

Search Service (.env)

PORT=4002
NODE_ENV=development
WALMART_API_KEY=your_walmart_api_key_here
CACHE_TTL=3600

๐Ÿ“ API Endpoints

Backend (Port 4000)

  • POST /api/process-products - Main processing endpoint

NLP Service (Port 4001)

  • POST /api/extract-products - Extract products from text/images

Search Service (Port 4002)

  • POST /api/search-products - Search for products

๐ŸŽจ Styling

The application uses Walmart's official branding:

  • Primary Blue: #0071ce
  • Walmart Yellow: #ffc220
  • Typography: BogleWeb font family
  • Clean Design: Modern, accessible interface

๐Ÿšง Development

Project Structure

walmart-autocart/
โ”œโ”€โ”€ frontend/              # Next.js frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/           # App router pages
โ”‚   โ”‚   โ””โ”€โ”€ components/    # React components
โ”‚   โ””โ”€โ”€ public/            # Static assets
โ”œโ”€โ”€ backend/               # Express.js backend
โ”œโ”€โ”€ nlp-service/           # NLP microservice
โ”œโ”€โ”€ search-service/        # Search microservice
โ””โ”€โ”€ docker-compose.yml     # Docker configuration

Adding New Features

  1. New Components: Add to frontend/src/components/
  2. New Pages: Add to frontend/src/app/
  3. API Endpoints: Add to respective service files
  4. Styling: Use Tailwind classes with Walmart theme

Testing

  • Frontend components can be tested with Jest/React Testing Library
  • Backend APIs can be tested with Postman or curl
  • End-to-end testing with Cypress (future enhancement)

๐Ÿ”ฎ Future Enhancements

  • Real Walmart API Integration: Replace mock data with actual Walmart API
  • Advanced NLP: Implement more sophisticated product extraction
  • Image Recognition: Add actual image processing capabilities
  • User Authentication: Add login/signup functionality
  • Order History: Track past purchases
  • Real Payment Integration: Add Stripe/PayPal support
  • Mobile App: React Native version
  • Analytics: User behavior tracking
  • Caching: Redis for improved performance
  • Search Optimization: Elasticsearch integration

๐Ÿ› Known Issues

  • Image processing returns mock data (needs actual ML integration)
  • Cart persistence is local storage only
  • No real payment processing
  • Limited product database (mock data)

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ“ž Support

For issues and questions:

  • Check the existing issues
  • Create a new issue with detailed description
  • Include steps to reproduce any bugs

Built with โค๏ธ using modern web technologies and Walmart's design principles.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •