# sgcm14/tienda-virtual architecture

> Architecture diagram of the GitHub repository sgcm14/tienda-virtual, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sgcm14/tienda-virtual
- Repository: https://github.com/sgcm14/tienda-virtual

## Overview

1. **Repository type**
   - This is a **fully static front-end** project for a pet store (“Tienda Virtual de Mascotas / PetShop”).
   - There is **no backend, database, or build pipeline** in the repo; all behavior runs in the browser using **HTML, CSS, and vanilla JavaScript**.

2. **Top-level site structure**
   - The app is split into five user-facing pages:
     - `index.html` — home/landing page
     - `nosotros.html` — about page
     - `productos.html` — product catalog and cart interaction
     - `carrito.html` — checkout/cart review page
     - `contacto.html` — contact page
   - This is a multi-page site rather than a single-page app.

3. **Global presentation layer**
   - `assets/css/style.css` is the shared stylesheet that defines the site-wide visual layout.
   - `assets/img/` contains the product and UI imagery used by the pages.
   - The design is a conventional ecommerce-style storefront with a hero/slider, product cards, modal image viewing, and cart UI.

4. **Shared front-end behavior**
   - `assets/js/scripts.js` appears to hold common UI logic used across pages, such as navigation behavior, slider interaction, modal handling, or other site-wide effects.
   - This is the main “shared client-side layer” for presentation behavior.

5. **Product catalog subsystem**
   - `productos.html` is the core shopping surface.
   - It presents a list of products, hover effects, and click-to-open product images in a modal.
   - Each product card includes a **“comprar”** action that adds the item to the cart.

6. **Cart interaction subsystem**
   - `assets/js/carrito.js` likely manages the cart dropdown/submenu shown from the top-right cart icon on the product page.
   - This layer handles the visible cart contents, item removal via the “x”, and the “vaciar carrito” action.
   - The cart is clearly intended to persist beyond a single click, so the browser-side state is central to the architecture.

7. **Checkout / purchase flow**
   - `assets/js/compra.js` and `assets/js/pedido.js` are the checkout-related scripts.
   - The flow described in the README is:
     - user adds products on the catalog page
     - opens the cart
     - chooses **“procesar compra”**
     - is redirected to `carrito.html`
     - reviews selected items and fills in customer data
   - This page is the handoff point from product selection to order submission.

8. **State propagation across pages**
   - Since the site moves from `productos.html` to `carrito.html`, cart contents must be carried across page navigation using **browser-side state**.
   - The repo does not show a server session or API, so the architecture is almost certainly client-only persistence, most likely via browser storage or equivalent JS-managed state.

9. **Contact subsystem**
   - `contacto.html` plus `assets/js/contacto.js` implement the contact form or contact interaction.
   - This is a separate user path from shopping, intended for inquiries rather than purchase flow.

10. **User experience boundaries**
   - There are three clear UX zones:
     - **Browse/learn**: home and about pages
     - **Shop**: catalog with cart controls
     - **Finalize/contact**: cart checkout and contact form
   - The repository keeps these concerns separated by page and by script file.

11. **Documentation and reference assets**
   - `doc/` contains screenshots used in the README to document each screen and interaction.
   - These are not runtime dependencies, but they help explain intended behavior and UI states.

12. **Important architectural takeaway**
   - The whole system is a **static ecommerce prototype** implemented entirely in the browser.
   - The main “integration points” are not services or APIs, but **page navigation, shared assets, and client-side cart state**.
   - Any diagram of this repo should center on the browser as the runtime, with HTML pages as entry points and JavaScript modules as behavior layers.

Main entry points: [`productos.html`](https://github.com/sgcm14/tienda-virtual/blob/master/productos.html) (Catalog), [`carrito.html`](https://github.com/sgcm14/tienda-virtual/blob/master/carrito.html) (Checkout), [`assets/css/style.css`](https://github.com/sgcm14/tienda-virtual/blob/master/assets/css/style.css) (Styles), [`doc`](https://github.com/sgcm14/tienda-virtual/tree/master/doc) (Screenshots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_browser(("Browser<br/>runtime"))
end

subgraph group_pages["Pages"]
  node_index["Home<br/>page<br/>[index.html]"]
  node_nosotros["About<br/>page<br/>[nosotros.html]"]
  node_productos["Catalog<br/>page<br/>[productos.html]"]
  node_carrito["Checkout<br/>page<br/>[carrito.html]"]
  node_contacto["Contact<br/>page<br/>[contacto.html]"]
end

subgraph group_behavior["Behavior"]
  node_scripts["Shared JS<br/>[scripts.js]"]
  node_cartjs["Cart UI<br/>js<br/>[carrito.js]"]
  node_buyjs["Purchase<br/>js<br/>[compra.js]"]
  node_orderjs["Order Form<br/>js<br/>[pedido.js]"]
  node_contactjs["Contact JS<br/>[contacto.js]"]
  node_state{{"Cart State<br/>browser state"}}
end

subgraph group_assets["Assets"]
  node_style["Styles<br/>css<br/>[style.css]"]
  node_images[("Images<br/>media")]
end

subgraph group_docs["Docs"]
  node_docs[("Screenshots<br/>docs")]
end

node_browser -->|"loads"| node_index
node_browser -->|"loads"| node_nosotros
node_browser -->|"loads"| node_productos
node_browser -->|"loads"| node_carrito
node_browser -->|"loads"| node_contacto
node_index -->|"uses"| node_style
node_index -->|"uses"| node_scripts
node_nosotros -->|"uses"| node_style
node_nosotros -->|"uses"| node_scripts
node_productos -->|"uses"| node_style
node_productos -->|"uses"| node_scripts
node_productos -->|"uses"| node_cartjs
node_productos -->|"shows"| node_images
node_productos -->|"updates"| node_state
node_cartjs -->|"reads/writes"| node_state
node_carrito -->|"uses"| node_style
node_carrito -->|"uses"| node_buyjs
node_carrito -->|"uses"| node_orderjs
node_carrito -->|"reads"| node_state
node_contacto -->|"uses"| node_style
node_contacto -->|"uses"| node_contactjs
node_docs -.->|"documents"| node_index
node_docs -.->|"documents"| node_productos
node_docs -.->|"documents"| node_carrito
node_docs -.->|"documents"| node_contacto

click node_index "https://github.com/sgcm14/tienda-virtual/blob/master/index.html"
click node_nosotros "https://github.com/sgcm14/tienda-virtual/blob/master/nosotros.html"
click node_productos "https://github.com/sgcm14/tienda-virtual/blob/master/productos.html"
click node_carrito "https://github.com/sgcm14/tienda-virtual/blob/master/carrito.html"
click node_contacto "https://github.com/sgcm14/tienda-virtual/blob/master/contacto.html"
click node_style "https://github.com/sgcm14/tienda-virtual/blob/master/assets/css/style.css"
click node_scripts "https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/scripts.js"
click node_cartjs "https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/carrito.js"
click node_buyjs "https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/compra.js"
click node_orderjs "https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/pedido.js"
click node_contactjs "https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/contacto.js"
click node_images "https://github.com/sgcm14/tienda-virtual/tree/master/assets/img"
click node_docs "https://github.com/sgcm14/tienda-virtual/tree/master/doc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser toneBlue
class node_index,node_nosotros,node_productos,node_carrito,node_contacto toneAmber
class node_scripts,node_cartjs,node_buyjs,node_orderjs,node_contactjs,node_state toneMint
class node_style,node_images toneRose
class node_docs toneIndigo
```

## Components

### Runtime

Browser-executed static site

- **Browser**: runtime · Executes the static storefront in-page

### Pages

User-facing HTML entry points

- [Home](https://github.com/sgcm14/tienda-virtual/blob/master/index.html): page · Landing page · `index.html`
- [About](https://github.com/sgcm14/tienda-virtual/blob/master/nosotros.html): page · Brand and company information · `nosotros.html`
- [Catalog](https://github.com/sgcm14/tienda-virtual/blob/master/productos.html): page · Product browsing and cart entry point · `productos.html`
- [Checkout](https://github.com/sgcm14/tienda-virtual/blob/master/carrito.html): page · Cart review and purchase handoff · `carrito.html`
- [Contact](https://github.com/sgcm14/tienda-virtual/blob/master/contacto.html): page · Inquiry form and contact flow · `contacto.html`

### Behavior

Client-side JavaScript layers

- [Shared JS](https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/scripts.js): js · Common UI behavior across pages · `assets/js/scripts.js`
- [Cart UI](https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/carrito.js): js · Cart dropdown and item controls · `assets/js/carrito.js`
- [Purchase](https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/compra.js): js · Checkout initiation and purchase flow · `assets/js/compra.js`
- [Order Form](https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/pedido.js): js · Order data handling on checkout page · `assets/js/pedido.js`
- [Contact JS](https://github.com/sgcm14/tienda-virtual/blob/master/assets/js/contacto.js): js · Contact form behavior · `assets/js/contacto.js`
- **Cart State**: browser state · Client-side cart persistence across navigation

### Assets

Shared styling and media

- [Styles](https://github.com/sgcm14/tienda-virtual/blob/master/assets/css/style.css): css · Shared site-wide presentation · `assets/css/style.css`
- [Images](https://github.com/sgcm14/tienda-virtual/tree/master/assets/img): media · Product and UI imagery · `assets/img`

### Docs

Reference screenshots

- [Screenshots](https://github.com/sgcm14/tienda-virtual/tree/master/doc): docs · README reference images · `doc`

## Connections

- Browser → Home: loads
- Browser → About: loads
- Browser → Catalog: loads
- Browser → Checkout: loads
- Browser → Contact: loads
- Home → Styles: uses
- Home → Shared JS: uses
- About → Styles: uses
- About → Shared JS: uses
- Catalog → Styles: uses
- Catalog → Shared JS: uses
- Catalog → Cart UI: uses
- Catalog → Images: shows
- Catalog → Cart State: updates
- Cart UI → Cart State: reads/writes
- Checkout → Styles: uses
- Checkout → Purchase: uses
- Checkout → Order Form: uses
- Checkout → Cart State: reads
- Contact → Styles: uses
- Contact → Contact JS: uses
- Screenshots → Home: documents
- Screenshots → Catalog: documents
- Screenshots → Checkout: documents
- Screenshots → Contact: documents
