Skip to content

re-ygh/javascript-amazon-project

Repository files navigation

javascript-amazon-project

Built with the tools and technologies:

JSON JavaScript Jasmine


Overview

javascript-amazon-project is a modular front-end application inspired by Amazon’s e-commerce platform, designed to deliver a responsive shopping experience with dynamic product rendering, smooth cart management, and robust testing. It leverages structured HTML, vanilla JavaScript, and both static and API-driven data to create a seamless and interactive user experience.

Why javascript-amazon-project?

This project demonstrates the process of building a feature-rich, test-driven e-commerce interface from scratch. The core capabilities include:

  • 🧩 🔧 Modular Architecture: Separate HTML pages and JavaScript modules for maintainability and scalability.
  • 🌐 💻 Dynamic Product Rendering: Integration of local JSON and remote API calls via fetch and XMLHttpRequest for product listing and search.
  • 🛒 🚀 Full Shopping Flow: Add-to-cart actions, dynamic quantity updates, checkout, order summary, and tracking.
  • 💰 🎯 Utility Functions: Centralized currency formatting for consistent UI presentation.
  • 📡 🌍 API Integration: Fetch and XHR-based requests to demonstrate multiple data retrieval methods.
  • 🧪 🛠️ Automated Testing: Jasmine testing framework ensures reliability of key functions, data handling, and UI interactions.
  • 📱 🎨 Responsive Design: Optimized for a smooth user experience across devices.

Features

Component Details
⚙️ Architecture
  • Client-side rendering with vanilla JavaScript
  • Uses both static JSON (products.json) and API calls
  • Simple MVC-like separation between data handling and UI rendering
🔩 Code Quality
  • Modular JavaScript with reusable functions
  • Clear naming conventions
  • Minimal code duplication
🧪 Testing
  • Automated unit tests with Jasmine for core logic
  • Test coverage includes product filtering, cart updates, and utility functions
🔌 Integrations
  • API consumption using both fetch and XMLHttpRequest
  • Local JSON for product catalog
📡 Data Handling
  • Real-time cart updates without page reloads
  • Client-side search and filtering
📱 Responsive Design
  • Mobile-first approach
  • Works seamlessly on desktop, tablet, and mobile
⚡️ Performance
  • Lightweight static assets
  • Efficient DOM updates and event delegation
🛡️ Security
  • Safe handling of API data
  • No sensitive user data stored client-side

Project Index

JAVASCRIPT-AMAZON-PROJECT/
__root__
⦿ __root__
File Name Summary
amazon.html - Defines the main structure and layout of an Amazon-themed webpage, integrating responsive design, branding elements, search functionality, and navigation links
- Serves as the user interface foundation, dynamically populating product listings within a grid layout through linked scripts
- Facilitates seamless user interaction and navigation, forming the core visual and functional entry point of the overall web application.
checkout.html - Provides the checkout page interface, enabling users to review their order and payment details before completing a purchase
- It integrates visual components and layout structure to facilitate a seamless and responsive user experience, serving as the central point for order confirmation within the overall e-commerce architecture.
tracking.html - Provides an order tracking webpage that displays delivery details, product information, and shipment progress within an e-commerce platform
- Integrates header navigation and styling to ensure consistency across the site, while enabling dynamic retrieval of order and product identifiers via URL parameters for personalized tracking experiences.
orders.html - Displays a user’s order history with detailed summaries of each purchase, including order dates, totals, product details, and tracking options
- Serves as the main interface for users to review past transactions, facilitating easy reordering and shipment tracking within the overall e-commerce platform architecture.
scripts
⦿ scripts
File Name Summary
checkout.js - Orchestrates the checkout page by loading product and cart data, then rendering the header, order summary, and payment summary to facilitate a seamless user checkout experience
- Ensures data dependencies are resolved before displaying key checkout components, integrating data fetching with UI rendering within the overall application architecture.
amazon.js - Facilitates product display and user interaction within the shopping interface by rendering product listings, managing cart updates, and handling add-to-cart actions
- Integrates product data with UI components to enable seamless browsing and purchasing, supporting the overall e-commerce architectures goal of providing an intuitive shopping experience.
checkout
⦿ scripts.checkout
File Name Summary
orderSummary.js - Render the comprehensive order summary interface, displaying cart items with product details, delivery options, and delivery dates
- Facilitates user interactions for updating quantities, selecting delivery methods, and removing items, while dynamically updating the checkout and payment summaries to ensure an accurate and seamless shopping experience within the overall e-commerce architecture.
checkoutHeader.js - Defines the structure and content of the checkout page header, ensuring consistent branding and navigation
- Integrates dynamic cart quantity display to inform users of their current item count, enhancing the checkout experience within the overall e-commerce architecture
- This component plays a key role in maintaining a cohesive and user-friendly interface during the checkout process.
paymentSummary.js - Generates the order summary interface, displaying itemized costs, shipping, taxes, and total amount based on cart data
- Facilitates order review and submission, integrating with backend services to finalize purchases
- Serves as a critical component in the checkout flow, ensuring users can review and confirm their orders before completion.
utils
⦿ scripts.utils
File Name Summary
money.js - Provides a utility function to convert monetary values from cents to a formatted dollar string, ensuring consistent currency representation across the application
- It supports the broader architecture by standardizing financial data display, facilitating accurate and user-friendly presentation of monetary amounts throughout the project.
backend
⦿ backend
File Name Summary
products.json - Backend/products.jsonThis file serves as a static data source containing detailed information about the products available within the application
- It provides essential attributes such as product IDs, images, names, ratings, prices, and relevant keywords
- In the overall architecture,
products.json` functions as a centralized repository of product data that supports features like product listing, search, and filtering, enabling the backend to efficiently serve product information to the frontend or other services
- Its structured format ensures easy data management and quick retrieval, forming a foundational component of the e-commerce or product catalog system.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors