# cungbac/web-exercises architecture

> Architecture diagram of the GitHub repository cungbac/web-exercises, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cungbac/web-exercises
- Repository: https://github.com/cungbac/web-exercises

## Overview

##### Project type and purpose
- This repository is not a single application but a collection of six web‐based exercises, each demonstrating different web technologies and architectural styles:
1. Bootstrap‐Ecommerce‐Template (static HTML/CSS/JS)
2. DOM‐Exercises (pure client‐side JS)
3. Express‐Handlebars‐Exercise (Node.js + Express + Handlebars)
4. Sequelize‐Postgres‐Exercise (Node.js + Express + Sequelize + PostgreSQL)
5. CRUD‐Exercise (Node.js + Express + Sequelize + PostgreSQL)
6. Authenticate‐Exercise (Node.js + Express + Sequelize + PostgreSQL + email/password reset)
- The README lays out high‐level goals and tech stacks for each exercise.

##### File structure
- Top‐level folders each contain an independent project.
- Static/template exercises (Bootstrap & DOM) have only html/, css/, js/, image assets.
- Server‐side exercises share a familiar MVC‐style layout:
- config/config.json
- index.js (Express app entry point)
- controllers/*.js
- routes/*.js
- models/*.js + models/index.js
- seeders/*.js
- views/*.hbs (Handlebars templates)
- package.json + lockfiles declare dependencies.
- db/ or sequelize-cli migrations/seeds are invoked to initialize and seed PostgreSQL.

##### README for additional insights
- Each exercise has specific data flows (e.g., seeding blog, category, tag, comment; authentication flows including email).
- The README outlines RESTful CRUD operations, authentication & authorization, template rendering, and client‐only DOM logic.

##### Elements
- Green for client/static
- Blue for server logic
- Orange for data persistence
- Purple for external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser("Browser"):::frontend

    subgraph "Static Exercises"
        BST("Bootstrap-Ecommerce-Template"):::frontend
        DOM("DOM-Exercises"):::frontend
    end

    subgraph "Express MVC Exercises"
        EH("Express-Handlebars-Exercise"):::server
        SP("Sequelize-Postgres-Exercise"):::server
        CRUD("CRUD-Exercise"):::server
        AUTH("Authenticate-Exercise"):::server
    end

    DB("PostgreSQL"):::db
    ESvc("Email Service"):::external

    Browser --> BST
    Browser --> DOM
    Browser --> EH
    Browser --> SP
    Browser --> CRUD
    Browser --> AUTH

    EH -->|"Render Handlebars Views"| Browser
    EH -->|"Serve Static HTML/CSS/JS"| Browser

    SP --> DB
    SP -->|"Serve HTML/CSS/JS Frontend"| Browser

    CRUD --> DB
    CRUD -->|"Expose RESTful CRUD APIs"| Browser

    AUTH --> DB
    AUTH -->|"Authenticate & Manage Sessions"| Browser
    AUTH -->|SMTP / Password Reset Email| ESvc

    click BST "https://github.com/cungbac/web-exercises/tree/main/bootstrap-ecommerce-template/"
    click BST "https://github.com/cungbac/web-exercises/blob/main/bootstrap-ecommerce-template/index.html"
    click BST "https://github.com/cungbac/web-exercises/blob/main/bootstrap-ecommerce-template/css/style.css"
    click BST "https://github.com/cungbac/web-exercises/blob/main/bootstrap-ecommerce-template/js/main.js"

    click DOM "https://github.com/cungbac/web-exercises/tree/main/DOM-Exercises/"
    click DOM "https://github.com/cungbac/web-exercises/blob/main/DOM-Exercises/js/script.js"
    click DOM "https://github.com/cungbac/web-exercises/blob/main/DOM-Exercises/js/handlebars-pagination-helper.js"

    click EH "https://github.com/cungbac/web-exercises/tree/main/Express-Handlebars-Exercise/"
    click EH "https://github.com/cungbac/web-exercises/blob/main/Express-Handlebars-Exercise/data.js"
    click EH "https://github.com/cungbac/web-exercises/tree/main/Express-Handlebars-Exercise/html/"
    click EH "https://github.com/cungbac/web-exercises/blob/main/Express-Handlebars-Exercise/html/css/main.css"

    click SP "https://github.com/cungbac/web-exercises/tree/main/Sequelize-Postgres-Exercise/"
    click SP "https://github.com/cungbac/web-exercises/tree/main/Sequelize-Postgres-Exercise/models/"
    click SP "https://github.com/cungbac/web-exercises/tree/main/Sequelize-Postgres-Exercise/seeders/"
    click SP "https://github.com/cungbac/web-exercises/tree/main/Sequelize-Postgres-Exercise/html/"

    click CRUD "https://github.com/cungbac/web-exercises/tree/main/CRUD-Exercise/"
    click CRUD "https://github.com/cungbac/web-exercises/blob/main/CRUD-Exercise/index.js"
    click CRUD "https://github.com/cungbac/web-exercises/blob/main/CRUD-Exercise/config/config.json"
    click CRUD "https://github.com/cungbac/web-exercises/blob/main/CRUD-Exercise/controllers/userController.js"
    click CRUD "https://github.com/cungbac/web-exercises/blob/main/CRUD-Exercise/routes/userRouter.js"
    click CRUD "https://github.com/cungbac/web-exercises/tree/main/CRUD-Exercise/models/"
    click CRUD "https://github.com/cungbac/web-exercises/tree/main/CRUD-Exercise/seeders/"
    click CRUD "https://github.com/cungbac/web-exercises/blob/main/CRUD-Exercise/views/user-management.hbs"

    click AUTH "https://github.com/cungbac/web-exercises/tree/main/Authenticate-Exercise/"
    click AUTH "https://github.com/cungbac/web-exercises/blob/main/Authenticate-Exercise/index.js"
    click AUTH "https://github.com/cungbac/web-exercises/blob/main/Authenticate-Exercise/config/config.json"
    click AUTH "https://github.com/cungbac/web-exercises/blob/main/Authenticate-Exercise/controllers/authController.js"
    click AUTH "https://github.com/cungbac/web-exercises/blob/main/Authenticate-Exercise/routes/authRouter.js"
    click AUTH "https://github.com/cungbac/web-exercises/tree/main/Authenticate-Exercise/models/"
    click AUTH "https://github.com/cungbac/web-exercises/tree/main/Authenticate-Exercise/seeders/"
    click AUTH "https://github.com/cungbac/web-exercises/tree/main/Authenticate-Exercise/views/"
    click AUTH "https://github.com/cungbac/web-exercises/tree/main/Authenticate-Exercise/html/assets/"

    classDef frontend fill:#a8f0c6,stroke:#333,stroke-width:1px
    classDef server fill:#90cdf4,stroke:#333,stroke-width:1px
    classDef db fill:#f6ad55,stroke:#333,stroke-width:1px
    classDef external fill:#d6bcfa,stroke:#333,stroke-width:1px
```
