# ma2903/devlooks architecture

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

- Interactive diagram: https://gitdiagram.com/ma2903/devlooks
- Repository: https://github.com/ma2903/devlooks

## Overview

##### Project type and purpose
- This is a full-stack academic e-commerce platform (“DevLooks”) built to demonstrate modern web development.
- Front-end: Vue 3 SPA (Vite, TailwindCSS).
- Back-end: Node.js with Express, TypeScript, MongoDB.
- Integrations: Mercado Pago payments, Google Gemini AI for avatar generation and sentiment analysis, email (Nodemailer), shipping via Correios.

##### File structure
- Top-level:
- package.json, tsconfig.json, vite.config.js, static index.html
- server/ → Express app (MVC):
– controllers/ (request handlers)
– services/ (business logic)
– models/ (Mongoose schemas)
– routes/ (Express routers)
– middlewares/ (auth, validation)
– config/ (DB, environment, test data)
– factories/ (Factory Pattern for test data)
– validators/ (request payload validation)
- view/ → Vue source:
– App.vue, main.js, router.js
– components/ (reusable UI parts)
– pages/ (views/routes)
– composables/ (custom hooks, e.g. useMercadoPago)
– services/ (API wrappers, user store)
- public/ → static assets, manifest, SEO files
- Various config files: .env examples, Lighthouse guide

##### README for additional insights
- Confirms MVC architecture on the back-end, Factory and Observer patterns.
- Lists core features (auth, cart, checkout, admin).
- Specifies technology stack and CI/build status.
- Describes performance optimizations and deployment targets (Vercel/Render, MongoDB Atlas).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Front-end Tier
    subgraph "Front-end (Vue SPA)" 
        direction TB
        FE_APP["App.vue"]:::frontend
        FE_MAIN["main.js"]:::frontend
        FE_ROUTER["router.js"]:::frontend
        FE_COMPONENTS["components/"]:::frontend
        FE_PAGES["pages/"]:::frontend
        FE_COMPOSABLES["composables/"]:::frontend
        FE_SERVICES["services/"]:::frontend
    end

    %% Back-end Tier
    subgraph "Back-end (Node.js & Express)" 
        direction TB

        BE_ENTRY["index.ts"]:::backend

        subgraph "API Layer"
            direction TB
            ROUTES["routes/"]:::backend
            CONTROLLERS["controllers/"]:::backend
            AI_CTRL["AIController.ts"]:::backend
            AVATAR_CTRL["AvatarController.ts"]:::backend
            NOTIF_CTRL["NotificationController.ts"]:::backend
            SHIP_CTRL["ShippingController.ts"]:::backend
        end

        subgraph "Business Logic Layer"
            direction TB
            SERVICES["services/"]:::backend
            NOTIF_SVC["NotificationService.ts"]:::backend
            FACTORIES["factories/"]:::backend
            VALIDATORS["validators/"]:::backend
            MIDDLEWARE_AUTH["authMiddleware.ts"]:::backend
            MIDDLEWARE_VAL["validationMiddleware.ts"]:::backend
        end

        subgraph "Data Layer"
            direction TB
            MODELS["models/"]:::backend
            CONFIG_DB["database.ts"]:::backend
            CONFIG_APP["config.ts"]:::backend
        end
    end

    %% External Services and Data Store
    MongoDB["MongoDB Atlas"]:::data
    MercadoPago["Mercado Pago API"]:::external
    Gemini["Google Gemini AI"]:::external
    SMTP["Email SMTP (Nodemailer)"]:::external
    Correios["Correios Shipping API"]:::external

    %% Data files
    SEED_PRODUCTS["playerstore.products.json"]:::data
    SEED_USERS["test.users.json"]:::data

    %% Connections
    FE_APP --> FE_MAIN
    FE_MAIN --> FE_ROUTER
    FE_ROUTER --> FE_PAGES
    FE_ROUTER --> FE_COMPONENTS
    FE_PAGES --> FE_SERVICES
    FE_SERVICES --> FE_COMPOSABLES
    FE_COMPOSABLES -->|uses| FE_SERVICES
    FE_COMPOSABLES -->|calls| MercadoPago

    FE_APP -->|REST/JSON| ROUTES
    ROUTES --> MIDDLEWARE_VAL
    ROUTES --> MIDDLEWARE_AUTH
    MIDDLEWARE_VAL --> CONTROLLERS
    MIDDLEWARE_AUTH --> CONTROLLERS

    CONTROLLERS -->|invoke| SERVICES
    CONTROLLERS -->|async| AI_CTRL
    CONTROLLERS -->|async| AVATAR_CTRL
    CONTROLLERS -->|async| NOTIF_CTRL
    CONTROLLERS -->|async| SHIP_CTRL

    SERVICES --> NOTIF_SVC
    SERVICES --> FACTORIES
    SERVICES --> VALIDATORS

    SERVICES --> MODELS
    MODELS -->|driver| MongoDB

    AI_CTRL -->|call| Gemini
    AVATAR_CTRL -->|call| Gemini
    NOTIF_SVC -->|send| SMTP
    SHIP_CTRL -->|call| Correios

    SEED_PRODUCTS --> FACTORIES
    SEED_USERS --> FACTORIES

    BE_ENTRY --> ROUTES
    BE_ENTRY --> CONFIG_DB
    BE_ENTRY --> CONFIG_APP

    %% Click Events
    click FE_APP "https://github.com/ma2903/devlooks/blob/main/view/App.vue"
    click FE_MAIN "https://github.com/ma2903/devlooks/blob/main/view/main.js"
    click FE_ROUTER "https://github.com/ma2903/devlooks/blob/main/view/router.js"
    click FE_COMPONENTS "https://github.com/ma2903/devlooks/tree/main/view/components/"
    click FE_PAGES "https://github.com/ma2903/devlooks/tree/main/view/pages/"
    click FE_COMPOSABLES "https://github.com/ma2903/devlooks/tree/main/view/composables/"
    click FE_SERVICES "https://github.com/ma2903/devlooks/tree/main/view/services/"
    click BE_ENTRY "https://github.com/ma2903/devlooks/blob/main/server/index.ts"
    click ROUTES "https://github.com/ma2903/devlooks/tree/main/server/routes/"
    click CONTROLLERS "https://github.com/ma2903/devlooks/tree/main/server/controllers/"
    click SERVICES "https://github.com/ma2903/devlooks/tree/main/server/services/"
    click MODELS "https://github.com/ma2903/devlooks/tree/main/server/models/"
    click MIDDLEWARE_AUTH "https://github.com/ma2903/devlooks/blob/main/server/middlewares/authMiddleware.ts"
    click MIDDLEWARE_VAL "https://github.com/ma2903/devlooks/blob/main/server/middlewares/validationMiddleware.ts"
    click CONFIG_DB "https://github.com/ma2903/devlooks/blob/main/server/config/database.ts"
    click CONFIG_APP "https://github.com/ma2903/devlooks/blob/main/server/config/config.ts"
    click FACTORIES "https://github.com/ma2903/devlooks/tree/main/server/factories/"
    click VALIDATORS "https://github.com/ma2903/devlooks/tree/main/server/validators/"
    click AI_CTRL "https://github.com/ma2903/devlooks/blob/main/server/controllers/AIController.ts"
    click AVATAR_CTRL "https://github.com/ma2903/devlooks/blob/main/server/controllers/AvatarController.ts"
    click NOTIF_SVC "https://github.com/ma2903/devlooks/blob/main/server/services/NotificationService.ts"
    click NOTIF_CTRL "https://github.com/ma2903/devlooks/blob/main/server/controllers/NotificationController.ts"
    click SHIP_CTRL "https://github.com/ma2903/devlooks/blob/main/server/controllers/ShippingController.ts"

    %% Styles
    classDef frontend fill:#bbf,stroke:#339,stroke-width:1px
    classDef backend fill:#bfb,stroke:#393,stroke-width:1px
    classDef data fill:#f96,stroke:#c60,stroke-width:1px
    classDef external fill:#ccc,stroke:#666,stroke-width:1px
```
