How madkulolo/template-zakaz-beta works
Project type and purpose
• This is a front-end-only, single-page web cashier application for a shawarma restaurant (“пупупу шаурма”).
• It runs entirely in the browser, uses vanilla JavaScript (ES5), HTML, CSS, and persists all data in browser localStorage.
• No server or remote API calls—everything is modules loaded by index.html.
File structure
• Top-level:
• index.html – host page
• css/styles.css – application styles
• js/ – four modules
– data.js (data layer, localStorage API)
– cart.js (cart business logic)
– ui.js (view/rendering layer)
– main.js (app orchestration, event wiring)
• .github/workflows – CI definitions (lint, static checks)
• No backend directory or API folder—pure client.
README insights
• Architecture described as modular JS, separation of concerns.
• Data persistence: localStorage only.
• UI: two tabs (“Новый заказ”, “История заказов”), adaptive design for mobile.
• Future extension could add a real database or server.
Main components
a. Presentation Layer (UI)
– index.html + css/styles.css
– js/ui.js
– Mobile-optimized, handles user events (click “+”, “–”, “Добавить”, “✅ Оформить заказ”)
b. Business-Logic Layer
– js/cart.js (cart operations, price calculations, toppings logic)
– js/main.js (event listeners, tab switching, application flow)
c. Data Layer
– js/data.js (CRUD to localStorage, order history)
– Browser localStorage (key-value store)
d. (Optional) Development & CI
– .github/workflows (static code checks)
Relationships and interactions
• On page load, index.html bootstraps main.js.
• main.js registers UI event handlers in ui.js.
• ui.js emits user actions (e.g., “add item”) to business logic (cart.js).
• cart.js updates the in-memory data model and calls data.js to persist to localStorage.
• data.js reads/writes localStorage and returns data to cart.js or main.js.
• main.js/ ui.js re-render views based on data changes.
Architectural patterns and principles
• MVC-style separation:
• Model = data.js + localStorage
• View = ui.js + HTML/CSS
• Controller = cart.js + main.js
• Modular JavaScript files—single responsibility per module.
• Event-driven communication between UI and logic.
Technologies, frameworks, libraries
• HTML5, CSS3 (flex, media queries for responsiveness)
• Vanilla JavaScript ES5 modules (no bundler)
• Browser localStorage API
• GitHub Actions for static checks