# thiago-laurence/proyecto-de-software architecture

> Architecture diagram of the GitHub repository thiago-laurence/proyecto-de-software, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thiago-laurence/proyecto-de-software
- Repository: https://github.com/thiago-laurence/proyecto-de-software

## Overview

##### Project type and purpose
- This is a two‐part full-stack web application:
– “admin” is a Flask-based administrative backend (Python, Flask, Jinja2 templates, SQLAlchemy models).
– “portal” is a Vue.js Single Page Application (SPA) front-end built with Vite, Tailwind CSS and served behind Nginx.
- The system provides:
– A secure administration interface (user/role/institution management, service orders).
– A public portal for customers to view services, place orders, and authenticate.

##### File structure
Top-level
- docker-compose.yml, .env – orchestrate services and environment variables.
- admin/ – Flask monolith:
- Dockerfile, entrypoint.sh – container build and startup.
- app.py, token.py, mail.py, oauth.py – application entry points.
- src/core/models – SQLAlchemy models (User, Role, Institution, ServiceOrder, etc.).
- src/web/controllers – Blueprints organized by API, authentication, pages.
- templates & static – Jinja2 HTML templates, CSS/JS assets, Tailwind config.
- tests – unit tests.
- portal/ – Vue 3 SPA:
- Dockerfile, nginx/default.conf – containerized front end served by Nginx.
- src/ – main.js, router, stores (Pinia), components, views.
- api.js – HTTP client for communicating with the Flask API.
- tailwind.config.js, vite.config.js – build and styling config.

##### README for additional insights
- Describes roles (root, owner, admin, operator, user) and credentials for demo.
- Technology stack: Git/GitLab, Python, Flask, JavaScript, Vue.js, HTML5/CSS3.

##### Diagramming the architecture
a. Main components
– SPA Front-end (Vue.js app)
– Admin Web App (Flask monolith)
– Relational Database (e.g., PostgreSQL)
– Reverse Proxy / Web Server (Nginx for portal)
– Docker & Docker Compose (orchestration)
– External services (SMTP mail service, optional OAuth provider)
b. Relationships and interactions
– User’s browser ↔️ Nginx (serves SPA)
– SPA ↔️ Flask API (via JSON over HTTP, api.js uses axios/fetch)
– Browser ↔️ Flask server (for admin UI templated pages)
– Flask ↔️ Database (ORM queries to SQL database)
– Flask ↔️ Mail server (via mail.py)
– Docker Compose ↔️ orchestrates containers (admin, portal, database, redis if used)
c. Architectural patterns and principles
– MVC / Blueprint pattern in Flask (models, controllers, templates)
– Single Page Application on front end with client-side routing (Vue Router)
– Separation of concerns:
- Front-end static assets vs back-end API logic.
- Configuration and code in containers.
– 12-factor app principles (env vars, config files, stateless containers)
d. Key technologies & libraries
– Python, Flask, Jinja2, SQLAlchemy, bcrypt, Alembic/seeds
– JavaScript, Vue.js, Pinia (stores), Vue Router, Vite, Tailwind CSS
– Docker, docker-compose, Nginx, Git/GitLab CI

##### Final recommendations
- Drill down: inside the Flask container, show MVC structure and dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["User Browser"]:::client

    %% Infrastructure
    subgraph "Infrastructure"
        DockerCompose["Docker Compose"]:::infra
        Nginx["Nginx Proxy"]:::infra
    end

    %% Portal Service Container
    subgraph "Portal Service Container"
        SPASvc["Vue SPA"]:::frontend
        SPADockerfile["Dockerfile"]:::infra
        NginxConfig["Nginx Config"]:::infra
        subgraph "SPA Code"
            SPAIndex["index.html"]:::frontend
            SPAMain["main.js"]:::frontend
            SPAApp["App.vue"]:::frontend
            SPARouter["Router"]:::frontend
            SPAStores["Stores"]:::frontend
            SPAComponents["Components"]:::frontend
            SPAViews["Views"]:::frontend
            SPAApi["API Client"]:::frontend
            SPAConfig["Build & Styling Config"]:::frontend
        end
    end

    %% Admin Service Container
    subgraph "Admin Service Container"
        AdminSvc["Flask Admin App"]:::backend
        AdminDockerfile["Dockerfile"]:::infra
        AdminEntrypoint["entrypoint.sh"]:::infra
        subgraph "Entrypoints"
            AdminApp["app.py"]:::backend
            AdminToken["token.py"]:::backend
            AdminMail["mail.py"]:::backend
            AdminOAuth["oauth.py"]:::backend
        end
        subgraph "Core"
            DBConfig["database.py"]:::backend
            Models["Models"]:::backend
            Seeds["seeds.py"]:::backend
            Bcrypt["bcrypt.py"]:::backend
        end
        subgraph "Web"
            Controllers["Controllers"]:::backend
            Forms["Forms"]:::backend
            Schemas["Schemas"]:::backend
            Templates["Templates"]:::backend
            StaticAssets["Static Assets"]:::backend
        end
        Tests["Tests"]:::backend
    end

    %% Data Stores & Services
    Database["PostgreSQL"]:::datastore
    SMTP["SMTP Service"]:::infra

    %% Connections
    Browser --> Nginx
    Nginx -->|Serves SPA| SPASvc
    Browser --> SPASvc
    SPASvc -->|JSON API Calls| AdminSvc
    Nginx -->|Proxy /api/admin| AdminSvc
    AdminSvc -->|ORM Queries| Database
    AdminSvc -->|Sends Email| SMTP
    DockerCompose --> Nginx
    DockerCompose --> SPASvc
    DockerCompose --> AdminSvc
    DockerCompose --> Database

    %% Click Events - Portal
    click SPASvc "https://github.com/thiago-laurence/proyecto-de-software/tree/main/portal/"
    click SPADockerfile "https://github.com/thiago-laurence/proyecto-de-software/tree/main/portal/Dockerfile"
    click NginxConfig "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/nginx/default.conf"
    click SPAIndex "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/index.html"
    click SPAMain "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/src/main.js"
    click SPAApp "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/src/App.vue"
    click SPARouter "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/src/router/index.js"
    click SPAStores "https://github.com/thiago-laurence/proyecto-de-software/tree/main/portal/src/stores/"
    click SPAComponents "https://github.com/thiago-laurence/proyecto-de-software/tree/main/portal/src/components/"
    click SPAViews "https://github.com/thiago-laurence/proyecto-de-software/tree/main/portal/src/views/"
    click SPAApi "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/src/api.js"
    click SPAConfig "https://github.com/thiago-laurence/proyecto-de-software/blob/main/portal/vite.config.js"

    %% Click Events - Admin
    click AdminSvc "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/"
    click AdminDockerfile "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/Dockerfile"
    click AdminEntrypoint "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/entrypoint.sh"
    click AdminApp "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/app.py"
    click AdminToken "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/token.py"
    click AdminMail "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/mail.py"
    click AdminOAuth "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/oauth.py"
    click DBConfig "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/src/core/database.py"
    click Models "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/src/core/models/"
    click Seeds "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/src/core/seeds.py"
    click Bcrypt "https://github.com/thiago-laurence/proyecto-de-software/blob/main/admin/src/core/bcrypt.py"
    click Controllers "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/src/web/controllers/"
    click Forms "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/src/web/forms/"
    click Schemas "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/src/web/schemas/"
    click Templates "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/src/web/templates/"
    click StaticAssets "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/static/"
    click Tests "https://github.com/thiago-laurence/proyecto-de-software/tree/main/admin/tests/"

    %% Styles
    classDef frontend fill:#b2f5ea,stroke:#2c7a7b,color:#2c7a7b
    classDef backend fill:#bee3f8,stroke:#2b6cb0,color:#2b6cb0
    classDef datastore fill:#fed7d7,stroke:#c53030,color:#c53030
    classDef infra fill:#e2e8f0,stroke:#4a5568,color:#4a5568
    classDef client fill:#fff5b1,stroke:#d69e2e,color:#d69e2e
```
