How pramod-vishwakarma/restaurant-pwa works
Project Type and Purpose
• This is a front-end–only Progressive Web App (PWA) for a restaurant site: a static, multi-page application built with HTML, CSS3 (compiled from SCSS), JavaScript (including jQuery), and Material Bootstrap (MDB).
• There is no backend service or database in this repo; all pages and interaction logic live in the client.
High-Level Component Breakdown
a. Client / Browser
• Renders HTML pages (index.html, home.html, menu.html, add-to-cart.html, feedback.html, etc.).
• Executes JavaScript logic for UI interactions (cart management, feedback forms, page navigation).
• Stores transient data (e.g., shopping cart contents) in localStorage or IndexedDB.
b. Service Worker (PWA layer)
• Caches HTML, CSS, JS, and image assets for offline availability (even if not explicitly provided, you’d include this in the PWA design).
• Intercepts network requests to serve cached assets or fall back to offline page.
c. Static Asset Server / CDN (or GitHub Pages, Netlify, etc.)
• Hosts all the compiled resources: HTML, CSS, JS bundles, images.
d. Build Pipeline (Dev-time)
• SCSS source → compiled CSS (css/style.css).
• JS libraries (Bootstrap/MDB, custom scripts) consolidated and minified.
Relationships and Data Flow
• User opens the PWA in the browser → Browser checks for Service Worker → SW installs and caches assets.
• For each page navigation:
• Browser requests HTML → SW serves from cache or network.
• HTML references CSS and JS → SW serves from cache → Browser renders UI.
• User actions (add to cart, submit feedback) → Custom JS updates the DOM and persists data in localStorage.
• Build step (outside of the user’s session) compiles SCSS to CSS and bundles JavaScript libraries.
Architectural Patterns & Design Principles
• Progressive Enhancement: starts as a static multi-page site, layered with JS for richer UX.
• PWA Cache-First strategy: static assets served from the Service Worker cache.
• Modular CSS/JS:
• SCSS folders organized by bootstrap-rtl-fix, bootstrap, free, custom → logical separation of vendor vs override vs custom styles.
• JS under src/js → splits Bootstrap source, free MDB scripts, utilities.
• No server-side MVC; all rendering and state management occur client-side.