Skip to content

LanguageShop is a modern, responsive Progressive Web App.

Notifications You must be signed in to change notification settings

gsroka/magdev-language-shop

Repository files navigation

🌍 LanguageShop – Merch Store for Language Schools

LanguageShop is a modern, responsive Progressive Web App (PWA) built with React 19, React Router v7, and Vite. It simulates an online merchandise store for a language school, featuring hoodies, t-shirts, mugs, and more β€” all powered by mocked data.

React TypeScript Vite Tailwind CSS PWA Conventional Commits


✨ Features

  • πŸ›οΈ Product Catalog: Hoodies, zip-up hoodies, t-shirts, mugs, and socks
  • πŸ” Smart Filtering: By category, price range, size, color, and availability
  • πŸ›’ Shopping Cart: Add, update quantity, remove β€” with localStorage persistence
  • πŸ“± Fully Responsive: Mobile-first design that works on all screen sizes
  • πŸ“₯ Offline Support: PWA with service worker caching for UI and product data
  • πŸ§ͺ Comprehensive Testing: Unit, integration, and E2E tests with Vitest + Playwright
  • 🧼 Clean Code: Built with SOLID, DRY, and KISS principles
  • πŸ“¦ Zero Backend: Full REST API simulation using MSW (Mock Service Worker)
  • πŸ“ Conventional Commits: Use Conventional Commits for commit messages

πŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 10+

Installation

  1. Clone the repository:

    git clone https://github.com/gsroka/languageshop.git
    cd languageshop
  2. Install dependencies:

    pnpm install
  3. Start the development server:

    pnpm dev
  4. Open your browser:
    Navigate to http://localhost:5173

πŸ’‘ No environment setup needed! All data is mocked β€” no API keys or .env files required.


πŸ› οΈ Tech Stack


πŸ“ Project Structure (React Router v7)

language-shop/
β”œβ”€β”€ app/                        # Main application directory (replaces src/)
β”‚   β”œβ”€β”€ routes/                 # File-based routing (e.g., routes.products.$id.tsx)
β”‚   β”œβ”€β”€ components/             # Shared UI and feature components
β”‚   β”‚   β”œβ”€β”€ ui/                 # Button, Input, Badge
β”‚   β”‚   β”œβ”€β”€ layout/             # Header, Footer, Root layout
β”‚   β”‚   └── features/           # ProductCard, CartItem, FilterPanel
β”‚   β”œβ”€β”€ hooks/                  # useDebounce, useLocalStorage
β”‚   β”œβ”€β”€ stores/                 # Zustand stores (cart, products, filters)
β”‚   β”œβ”€β”€ types/                  # TypeScript interfaces (Product, CartItem)
β”‚   β”œβ”€β”€ utils/                  # formatters, helpers
β”‚   β”œβ”€β”€ app.css                 # global styles
β”‚   └── root.tsx                # app root
β”œβ”€β”€ public/                     # Static assets, PWA manifest, icons
β”‚   └── manifest.webmanifest
β”œβ”€β”€ tests/                      # Unit & integration tests
β”œβ”€β”€ e2e/                        # Playwright E2E tests
β”œβ”€β”€ vite.config.ts              # Vite + PWA config
└── tsconfig.json               # With path alias: ~ β†’ app/

🧼 Engineering Principles

This project strictly follows modern software engineering best practices:

  • SOLID: Each store and component has a single responsibility.
  • DRY: Shared types, hooks, and UI components are reused across the app.
  • KISS: No over-engineering β€” logic lives only where necessary.
  • Conventional Commits: All commits follow the Conventional Commits 1.0.0 spec.

Example commits:

feat(cart): persist cart state in localStorage
fix(products): handle missing image with fallback
refactor(filters): extract price range logic to custom hook

πŸ“ Scripts

pnpm dev          # Start dev server (Vite + React Router)
pnpm build        # Build for production (SSR + PWA-ready)
pnpm start        # Start production server
pnpm preview      # Preview production build locally
pnpm lint         # Run ESLint
pnpm format:write # Format code with Prettier
pnpm typecheck    # Run TypeScript checks
pnpm test         # Run Vitest (unit + integration)
pnpm test:e2e     # Run Playwright E2E tests

πŸ—ΊοΈ Development Roadmap (TODO Phases)

View Full Implementation Plan

Phase 0: Project Setup & Configuration βœ…

  • Initialize project with pnpm create react-router@latest
  • Install vite-plugin-pwa for PWA support
  • Configure shadcn/ui
  • Set up tsconfig.json with path alias ~/
  • Create README.md with project overview
  • Initialize Git + Conventional Commits

Phase 1: Architecture, Routing & Typing

  • Define core types: Product, CartItem, ProductVariant
  • Create folder structure inside app/: components/, types/, etc.
  • Implement root layout (app/root.tsx)
  • Set up routes: /, /products/:id, /cart, /checkout
  • Add loading and error boundaries (React Router v7 conventions)
  • Create shared layout components: Header, Footer

Phase 2: Mock API with MSW

  • Install MSW
  • Create mock product data (5 categories, 20+ items)
  • Implement GET /api/products and GET /api/products/:id
  • Integrate apiClient abstraction in app/api/client.ts
  • Add delay and error simulation in MSW

Phase 3: Product Catalog & Filtering

  • Build ProductList and ProductCard components
  • Implement useProductStore with Zustand (fetch + cache)
  • Create FilterPanel with React Hook Form + Zod
  • Add search, category, price, size, color, availability filters
  • Connect filters to product store via useFilterStore

Phase 4: Shopping Cart (Zustand + localStorage)

  • Create useCartStore with persistence via Zustand persist
  • Implement addToCart, updateQuantity, removeFromCart
  • Build CartPage with editable items
  • Add cart badge in Header

Phase 5: Product Detail Page

  • Create dynamic route app/routes/products.$id.tsx
  • Fetch product by ID
  • Display variants (size, color), image gallery, description
  • Add β€œAdd to Cart” button with variant selection

Phase 6: Checkout Flow (Mock)

  • Build CheckoutPage with contact form (RHF + Zod)
  • Validate name, email, address
  • Show order summary
  • On submit: show success modal, clear cart

Phase 7: PWA & Offline Support

  • Configure vite-plugin-pwa to cache routes and API
  • Add an offline fallback page
  • Test offline mode in DevTools

Phase 8: Testing

  • Unit tests for Zustand stores (Vitest)
  • Component tests (RTL): ProductCard, Cart
  • E2E test: add to cart β†’ checkout (Playwright)

Phase 9: Polish & Performance

  • Lazy-load images (loading="lazy")
  • Optimize re-renders (React.memo, useCallback)
  • Add meta tags, favicon, PWA icons
  • Lighthouse audit β†’ fix accessibility/performance

πŸ“§ Contact

Grzegorz Sroka - @gsroka89

Project Link: https://github.com/gsroka/languageshop

About

LanguageShop is a modern, responsive Progressive Web App.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published