# santoshsomu/legend-carpet architecture

> Architecture diagram of the GitHub repository santoshsomu/legend-carpet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/santoshsomu/legend-carpet
- Repository: https://github.com/santoshsomu/legend-carpet

## Overview

##### Project Type & Purpose
- This is a small full-stack web application built on Python (app.py) using Flask (Jinja2 templates).
- It serves marketing content: service pages, portfolio, contact form, interactive UI elements, and integrates with external services (Google Maps, Analytics, reCAPTCHA).

##### Main Components
a. Client Layer
– Web Browser (Desktop, Tablet, Mobile)
– UI: HTML templates (templates/*.html), CSS (static/css/*.css), JavaScript (static/js/*.js), Images & Videos (static/images, static/videos)
b. Web & Application Layer
– Flask Application (app.py) running under a WSGI server (Gunicorn, uWSGI, or Flask’s built-in server)
– Jinja2 Template Engine
– (Optional) Reverse proxy / Load balancer (Nginx or Apache) for production
c. Data & Storage Layer
– Static Assets Storage (served directly by web server or via CDN)
– (Future/Optional) Backend datastore or email service for contact-form submissions
d. External Services
– Google Maps (iframe embed)
– Google Analytics (gtag.js)
– reCAPTCHA API (spam protection)
– SMTP or third-party email service (for “Contact Us” form)

##### Relationships & Data Flow
1. Client → HTTP/HTTPS → Load Balancer (if any) → Web Server
2. Web Server → Flask App →
- Renders Jinja2 templates (templates/)
- Serves static assets (static/ and style.css)
3. Client performs interactive actions:
- Requests CSS/JS for animations, sliders, form validation
- Loads portfolio images via lightbox component
- Submits contact form → POST to Flask endpoint → server-side validation → (reCAPTCHA verification → email service or datastore) → returns success/failure JSON or redirects
4. Client side analytics events → Google Analytics
5. Page embed → Google Maps iframe

##### Architectural Patterns & Principles
- MVC-style separation:
– Views: Jinja2 templates under /templates
– Static “Controller” logic: app.py routes
– Models (optional/future): form data mapping, datastore
- Static asset caching & CDN offload for performance
- Progressive enhancement: client-side JS for animations & validation
- Security: CSP headers, HTTPS, XSS protection, reCAPTCHA

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Client Layer"
    direction TB
    Browser["Web Browser"]:::frontend
    CSS1["static/css/style.css"]:::frontend
    CSS2["static/css/styles.css"]:::frontend
    CSS3["static/css/service.css"]:::frontend
    CSS4["static/css/portfolio.css"]:::frontend
    CSS5["style.css"]:::frontend
    JS1["static/js/script.js"]:::frontend
    JS2["static/js/animations.js"]:::frontend
    JS3["static/js/forms.js"]:::frontend
    JS4["static/js/portfolio.js"]:::frontend
    ImagesDir["static/images/"]:::frontend
    ImagesPort["static/images/portfolio/"]:::frontend
    VideosDir["static/videos/"]:::frontend
  end

  subgraph "Backend Layer"
    direction TB
    LB["Load Balancer (Nginx/Apache)"]:::backend
    WebServer["Web Server (Gunicorn/Flask)"]:::backend
    FlaskApp["Flask App (app.py)"]:::backend
    subgraph "Jinja2 Templates"
      direction TB
      T1["templates/base.html"]:::backend
      T2["templates/index.html"]:::backend
      T3["templates/about.html"]:::backend
      T4["templates/services.html"]:::backend
      T5["templates/service.html"]:::backend
      T6["templates/portfolio.html"]:::backend
      T7["templates/video_test.html"]:::backend
    end
  end

  subgraph "Data & Storage Layer"
    direction TB
    StaticStore["Static Assets Store/CDN"]:::storage
    FutureDB["Email/Datastore (future)"]:::storage
  end

  subgraph "External Services"
    direction TB
    GA["Google Analytics"]:::external
    GM["Google Maps"]:::external
    Recap["reCAPTCHA API"]:::external
    EmailSvc["Email Service (SMTP)"]:::external
  end

  Browser -->|"HTTP/HTTPS"| LB
  LB --> WebServer
  WebServer --> FlaskApp
  FlaskApp --> T1
  FlaskApp --> T2
  FlaskApp --> T3
  FlaskApp --> T4
  FlaskApp --> T5
  FlaskApp --> T6
  FlaskApp --> T7
  WebServer --> StaticStore
  Browser --> StaticStore
  Browser -->|Dashed| CSS1
  Browser -->|Dashed| CSS2
  Browser -->|Dashed| CSS3
  Browser -->|Dashed| CSS4
  Browser -->|Dashed| CSS5
  Browser -->|Dashed| JS1
  Browser -->|Dashed| JS2
  Browser -->|Dashed| JS3
  Browser -->|Dashed| JS4
  Browser --> ImagesDir
  Browser --> ImagesPort
  Browser --> VideosDir
  Browser -->|-->|GA
  Browser -->|-->|GM
  Browser -->|-->|Recap
  FlaskApp -->|...| EmailSvc
  FlaskApp -->|...| FutureDB

  click FlaskApp "https://github.com/santoshsomu/legend-carpet/blob/main/app.py"
  click T1 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/base.html"
  click T2 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/index.html"
  click T3 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/about.html"
  click T4 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/services.html"
  click T5 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/service.html"
  click T6 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/portfolio.html"
  click T7 "https://github.com/santoshsomu/legend-carpet/blob/main/templates/video_test.html"
  click CSS1 "https://github.com/santoshsomu/legend-carpet/blob/main/static/css/style.css"
  click CSS2 "https://github.com/santoshsomu/legend-carpet/blob/main/static/css/styles.css"
  click CSS3 "https://github.com/santoshsomu/legend-carpet/blob/main/static/css/service.css"
  click CSS4 "https://github.com/santoshsomu/legend-carpet/blob/main/static/css/portfolio.css"
  click CSS5 "https://github.com/santoshsomu/legend-carpet/blob/main/style.css"
  click JS1 "https://github.com/santoshsomu/legend-carpet/blob/main/static/js/script.js"
  click JS2 "https://github.com/santoshsomu/legend-carpet/blob/main/static/js/animations.js"
  click JS3 "https://github.com/santoshsomu/legend-carpet/blob/main/static/js/forms.js"
  click JS4 "https://github.com/santoshsomu/legend-carpet/blob/main/static/js/portfolio.js"
  click ImagesDir "https://github.com/santoshsomu/legend-carpet/tree/main/static/images/"
  click ImagesPort "https://github.com/santoshsomu/legend-carpet/tree/main/static/images/portfolio/"
  click VideosDir "https://github.com/santoshsomu/legend-carpet/tree/main/static/videos/"

  classDef frontend fill:#ccffcc,stroke:#333,stroke-width:1px
  classDef backend fill:#cce5ff,stroke:#333,stroke-width:1px
  classDef storage fill:#ffe5cc,stroke:#333,stroke-width:1px
  classDef external fill:#e0e0e0,stroke:#333,stroke-width:1px
```
