# andybd2703/admininfo architecture

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

- Interactive diagram: https://gitdiagram.com/andybd2703/admininfo
- Repository: https://github.com/andybd2703/admininfo

## Overview

##### Project type and purpose
- This is a full-stack, single-page application (SPA) for event management and ticket sales.
- Frontend: Vue.js SPA that handles routing, views, state management (via eventBus), API calls.
- Backend: Node.js + Express REST API, following an MVC-style structure (config, models, controllers, routes, middlewares).
- Database: MySQL for persisting users, events, carts, purchases, favorites.
- File storage: local uploads folder for event images; templating for invoice (HTML).

##### File structure
- Top level:
- SIDE-frontend/ – Vue.js project (babel.config.js, public/index.html, src/)
- SIDE-backend/ – Express app (index.js, app.js, controllers/, routes/, models/, middlewares/, tests/, uploads/, templates/)
- database/ – SQL script or instructions to create the MySQL schema.
- Backend MVC pattern:
- config/db.js – DB connection
- models/*.js – ORM/schema definitions (Event, User, etc.)
- controllers/*Controller.js – business logic
- routes/*.js – define REST endpoints (/auth, /events, /carrito, /compra, etc.)
- middlewares/auth.js – JWT or session-based protection
- uploads/ – static storage served via Express
- templates/plantillaFactura.html – invoice generation
- Frontend SPA structure:
- src/router/index.js – defines client-side routes (VueRouter)
- src/views/*.vue – pages (home, login, register, event detail, cart, admin dashboards)
- src/services/api.js – Axios wrapper for calling backend endpoints
- src/eventBus.js – simple pub/sub for cross-component comms

##### README for additional insights
- Confirms RESTful communication, SPA, two user roles (attendee & organizer), MySQL backend.
- No mention of external payment gateway, but controllers/checkoutController.js likely handles payment integration.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Frontend Layer
    subgraph "Frontend"
        direction TB
        Browser["Browser"]:::frontend
        VueSPA["Vue.js SPA"]:::frontend
        MainJS["main.js"]:::frontend
        AppVue["App.vue"]:::frontend
        Router["router/index.js"]:::frontend
        Views["views/*.vue"]:::frontend
        APIService["services/api.js"]:::frontend
        EventBus["eventBus.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB
        ExpressApp["Express REST API"]:::backend
        IndexJS["index.js"]:::backend
        AppJS["app.js"]:::backend
        DBConfig["config/db.js"]:::backend
        subgraph "Models"
            direction TB
            EventModel["Event.js"]:::backend
            UserModel["User.js"]:::backend
        end
        subgraph "Controllers"
            direction TB
            CheckoutController["checkoutController.js"]:::backend
        end
        subgraph "Routes"
            direction TB
            AuthRoutes["auth.js"]:::backend
            EventsRoutes["events.js"]:::backend
            CarritoRoutes["carrito.js"]:::backend
            CompraRoutes["compra.js"]:::backend
            FavoritosRoutes["favoritos.js"]:::backend
            UsuariosRoutes["usuarios.js"]:::backend
        end
        AuthMiddleware["auth.js"]:::backend
        Uploads["uploads/"]:::datastore
        InvoiceTemplate["plantillaFactura.html"]:::datastore
        Tests["tests/*.test.js"]:::backend
    end

    %% Persistence & External
    subgraph "Persistence & External"
        direction TB
        MySQL["MySQL Database"]:::datastore
        DBScript["database script.txt"]:::datastore
        ExternalPayment["Payment Gateway"]:::external
    end

    %% Relationships
    Browser -->|"loads SPA"| VueSPA
    VueSPA -->|"initializes"| MainJS
    VueSPA -->|"renders"| AppVue
    VueSPA -->|"uses routes"| Router
    VueSPA -->|"renders pages"| Views
    VueSPA -->|"calls API"| APIService
    VueSPA -->|"communicates"| EventBus

    APIService -->|"HTTP requests"| ExpressApp
    ExpressApp -->|"uses bootstrap"| IndexJS
    ExpressApp -->|"configures app"| AppJS
    AppJS -->|"connects to DB"| DBConfig
    AppJS -->|"registers models"| EventModel
    AppJS -->|"registers models"| UserModel
    AppJS -->|"loads middleware"| AuthMiddleware
    AppJS -->|"loads routes"| AuthRoutes
    AppJS -->|"loads routes"| EventsRoutes
    AppJS -->|"loads routes"| CarritoRoutes
    AppJS -->|"loads routes"| CompraRoutes
    AppJS -->|"loads routes"| FavoritosRoutes
    AppJS -->|"loads routes"| UsuariosRoutes

    AuthRoutes -->|"/auth"| CheckoutController
    EventsRoutes -->|"/events"| CheckoutController
    CarritoRoutes -->|"/carrito"| CheckoutController
    CompraRoutes -->|"/compra"| CheckoutController
    FavoritosRoutes -->|"/favoritos"| CheckoutController
    UsuariosRoutes -->|"/usuarios"| CheckoutController

    CheckoutController -->|"business logic"| EventModel
    CheckoutController -->|"business logic"| UserModel
    CheckoutController -->|"generates invoice"| InvoiceTemplate
    CheckoutController -->|"processes payment"| ExternalPayment
    CheckoutController -->|"uploads images"| Uploads

    EventModel -->|"SQL queries"| MySQL
    UserModel -->|"SQL queries"| MySQL

    DBScript -->|"defines schema"| MySQL

    %% Click Events
    click VueSPA "https://github.com/andybd2703/admininfo/tree/main/SIDE-frontend/"
    click MainJS "https://github.com/andybd2703/admininfo/blob/main/SIDE-frontend/src/main.js"
    click AppVue "https://github.com/andybd2703/admininfo/blob/main/SIDE-frontend/src/App.vue"
    click Router "https://github.com/andybd2703/admininfo/blob/main/SIDE-frontend/src/router/index.js"
    click Views "https://github.com/andybd2703/admininfo/tree/main/SIDE-frontend/src/views/"
    click APIService "https://github.com/andybd2703/admininfo/blob/main/SIDE-frontend/src/services/api.js"
    click EventBus "https://github.com/andybd2703/admininfo/blob/main/SIDE-frontend/src/eventBus.js"

    click ExpressApp "https://github.com/andybd2703/admininfo/tree/main/SIDE-backend/"
    click IndexJS "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/index.js"
    click AppJS "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/app.js"
    click DBConfig "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/config/db.js"
    click EventModel "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/models/Event.js"
    click UserModel "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/models/User.js"
    click CheckoutController "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/controllers/checkoutController.js"
    click AuthRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/auth.js"
    click EventsRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/events.js"
    click CarritoRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/carrito.js"
    click CompraRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/compra.js"
    click FavoritosRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/favoritos.js"
    click UsuariosRoutes "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/routes/usuarios.js"
    click AuthMiddleware "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/middlewares/auth.js"
    click Uploads "https://github.com/andybd2703/admininfo/tree/main/SIDE-backend/uploads/"
    click InvoiceTemplate "https://github.com/andybd2703/admininfo/blob/main/SIDE-backend/templates/plantillaFactura.html"
    click Tests "https://github.com/andybd2703/admininfo/tree/main/SIDE-backend/tests/"
    click DBScript "https://github.com/andybd2703/admininfo/blob/main/database/archivo de texto para crear base de datos.txt"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:2px;
    classDef backend fill:#D6F5D6,stroke:#228B22,stroke-width:2px;
    classDef datastore fill:#FFE5B4,stroke:#DAA520,stroke-width:2px;
    classDef external fill:#E8E8E8,stroke:#808080,stroke-width:2px;
```
