rainbow-toys-ecommerce

Angular and TypeScript toy store storefront demo with product search, sort and p

Visual Preview

Rainbow Toys is a front-end demo storefront built with Angular. Products come from the public DummyJSON API, login uses the DummyJSON demo auth API, and registration posts to a third-party API. There is no payment, no order backend and no real inventory.

What works today: product list with category filter, price-range filter, search and sort; product detail page; cart with quantity changes saved in the browser; checkout form; login and register with a JWT header interceptor; route guards.

Known limits: the admin role now comes from the DummyJSON /auth/me answer, not from localStorage or the username, but the app has no backend of its own, so the admin dashboard is still a UI demo (product add, edit and delete are simulated by DummyJSON). Placing an order only clears the cart in the browser and shows a message. It does not charge anyone or create an order anywhere. Unit tests are mostly generated stubs.


1. Architecture and Core Specifications


2. Technical Architecture & Features

System Diagram

graph TD
    User([Browser Client]) --> Router{Angular Router}
    Router -->|Guest / Auth Guard| Home[Home Component]
    Router -->|Guest / Auth Guard| Products[Products Component]
    Router -->|Guest / Auth Guard| SingleProduct[Single Product Detail]
    Router -->|Authenticated| Cart[Cart Component]
    Router -->|Authenticated| Checkout[Checkout Component]
    Router -->|Admin Role Guard| AdminDash[Admin Dashboard]

    HTTPClient[HttpClient / interceptorInterceptor] -->|Inject JWT Bearer Token| ExternalAPI[(DummyJSON & Private Auth APIs)]

Core Architecture Specifications


3. Tech Stack


4. Local Installation & Development

  1. Clone the repository:

    git clone https://github.com/ZiadtahaM/rainbow-toys-ecommerce.git
    cd rainbow-toys-ecommerce/ecommerce
  2. Install dependencies:

    npm install
  3. Launch local dev server:

    npm run start

Open http://localhost:4200 to view it in your browser.

  1. Production Build & Redirect Configuration:
    The build command compiles the Angular application and automatically outputs the SPA client-routing redirect file (_redirects) into the production output folder:
    npm run build

Tests

From the ecommerce folder, run npm test (Karma and Jasmine, needs Chrome). The suite has 36 tests: smoke tests for each component, 5 tests for the checkout validators, 8 tests for product filters, sort, pagination and the wishlist, 4 tests for the admin role, and 2 flow tests that run the real service and the real Checkout component (log in, add to cart, fail validation, place a demo order). All 36 pass on a fresh clone. They do not drive a real browser, so there is still no Cypress or Playwright end-to-end test.


5. Deployment Configuration (Cloudflare Pages)

The project is configured for deployment to Cloudflare Pages using the Wrangler CLI:

npx wrangler pages deploy dist/ecommerce/browser --project-name=mega-ecommerce-project --branch=main

Status: a Cloudflare Pages site exists at https://mega-ecommerce-project.pages.dev (project mega-ecommerce-project, probably deployed by the April 2026 Actions runs #18 and #19, not confirmed). It loads and shows the Rainbow Toys storefront, but its build date and code version are not recorded, so it may be older than this repository. The GitHub Actions workflow here needs the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID repository secrets, which are not set, and it uses the project name rainbow-toys, which differs from mega-ecommerce-project.