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
- State Orchestration: Custom service-based client states (
serve.ts) synchronizing inventory selections, carts, and user sessions dynamically, persisted in client-side LocalStorage (not encrypted). - Access Control & Routing: Custom guards (
LoginGuardandadminGuardGuard) intercepting transitions to sensitive pages. Client profiles are validated asuseroradminroles, restricting checkout access or administrative panels. - HTTP Interceptor System: Global
HttpInterceptorFnintercepting all outgoing backend requests to automatically inject Bearer JWT Authorization headers when a token is present, while bypassing generic public routes. - Visual Styling & Accessibility: Implements a curated design system using CSS variables, custom media query breakpoints, and Bootstrap components for a responsive layout.
- Toast Notification Engine: Integrated
ngx-toastrmessaging system replacing default browser alert prompts with non-blocking toast alerts (e.g., adding to cart, email newsletter signup).
3. Tech Stack
- Framework: Angular 20 (
@angular/core^20.3.0 inecommerce/package.jsonon master; Angular CLI ^21.0.3) - Language: TypeScript
- Styling: Modular CSS + Bootstrap v5
- Notifications: ngx-toastr v19
- Hosting: Cloudflare Pages project
mega-ecommerce-projectserves an earlier deploy at https://mega-ecommerce-project.pages.dev. Older GitHub Actions runs (#18 and #19, April 2026) succeeded; the latest runs fail at the deploy step because the Cloudflare secrets are missing. The live site may not match the current code. Demo project, not a production store.
4. Local Installation & Development
-
Clone the repository:
git clone https://github.com/ZiadtahaM/rainbow-toys-ecommerce.git cd rainbow-toys-ecommerce/ecommerce -
Install dependencies:
npm install
-
Launch local dev server:
npm run start
Open http://localhost:4200 to view it in your browser.
- 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=mainStatus: 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.