@startuml uml-component-diagram !include _style.iuml skinparam componentStyle rectangle title Diagrama UML de Componentes - ExpressMX ' ===================================================================== ' Capa Cliente ' ===================================================================== package "Capa Cliente" { component "<>\nmobile-client\n(Expo / React Native)" as mobileClient component "<>\nmobile-provider\n(Expo / React Native)" as mobileProvider component "<>\nBrowser\n(Chromium / Safari)" as browser } ' ===================================================================== ' Aplicaciones (apps/*) ' ===================================================================== package "Aplicaciones" { package "<> web-admin (Next.js 16)" as webAdmin { component "<>\nDashboard Pages\n(App Router)" as pages component "<>\nAPI REST\n(/api/v1, /api/*)" as api component "<>\nServer Actions\n(use server)" as actions component "<>\nAuth Subsystem\n(jose + bcrypt)" as authsub component "<>\nRBAC Engine\n(buildViewer / tienePermiso)" as rbac component "<>\nAudit Logger\n(logAccion)" as audit } } ' ===================================================================== ' Packages compartidos (packages/* y packages/config/*) ' ===================================================================== package "Packages compartidos" { component "<>\n@expressmx/database\n(pg Pool, queries SQL)" as dbPkg component "<>\n@expressmx/validations\n(Zod schemas)" as valPkg component "<>\n@expressmx/types\n(DTOs / contratos)" as typesPkg component "<>\n@expressmx/utils\n(helpers puros)" as utilsPkg package "@expressmx/config" as configPkg { component "<>\n@expressmx/config/eslint" as eslintCfg component "<>\n@expressmx/config/typescript" as tsCfg } } ' ===================================================================== ' Servicios externos ' ===================================================================== package "Servicios externos" { database "<>\nNeon Postgres\n(serverless)" as neon cloud "<>\nResend\n(SMTP / HTTPS)" as resend cloud "<>\nExpo EAS\n(build / OTA)" as eas cloud "<>\nVercel Edge\n(hosting)" as vercel } ' ===================================================================== ' Puertos UML (interfaces tipadas) ' ===================================================================== interface "JWT Bearer" as JWT interface "Session Cookie" as Cookie interface "Postgres wire" as PgWire interface "REST/JSON" as Rest interface "SMTP/HTTPS" as Smtp ' ===================================================================== ' Cliente -> Aplicacion (puertos) ' ===================================================================== mobileClient -( JWT : "REST/JSON sobre HTTPS" mobileProvider -( JWT : "REST/JSON sobre HTTPS" JWT )- api browser -( Cookie : "HTTPS" Cookie )- pages Cookie )- actions ' ===================================================================== ' Subcomponentes internos del web-admin ' ===================================================================== pages --> actions : "use server" pages --> api : "fetch interno" actions --> authsub : "valida sesion" api --> authsub : "valida sesion" actions --> rbac : "exige permisos" api --> rbac : "exige permisos" actions --> audit : "registra mutacion" api --> audit : "registra mutacion" ' ===================================================================== ' Subcomponentes -> packages compartidos ' ===================================================================== api --> valPkg : "schemas" actions --> valPkg : "schemas" pages --> typesPkg : "DTOs" api --> typesPkg : "DTOs" actions --> typesPkg : "DTOs" api --> utilsPkg : "helpers" actions --> utilsPkg : "helpers" rbac --> dbPkg : "query SQL" audit --> dbPkg : "INSERT auditoria" api --> dbPkg : "consulta dominio" actions --> dbPkg : "consulta dominio" authsub --> dbPkg : "lookup usuario" ' ===================================================================== ' Packages cruzados (config y types reusan validations) ' ===================================================================== typesPkg ..> valPkg : "reusa" dbPkg ..> eslintCfg : "lint" dbPkg ..> tsCfg : "tsconfig" valPkg ..> tsCfg : "tsconfig" typesPkg ..> tsCfg : "tsconfig" utilsPkg ..> tsCfg : "tsconfig" ' ===================================================================== ' Mobile reusa packages aislados (sin database) ' ===================================================================== mobileClient --> valPkg : "schemas" mobileClient --> typesPkg : "DTOs" mobileClient --> utilsPkg : "helpers" mobileProvider --> valPkg : "schemas" mobileProvider --> typesPkg : "DTOs" mobileProvider --> utilsPkg : "helpers" ' ===================================================================== ' Aplicaciones -> servicios externos (puertos) ' ===================================================================== dbPkg --( PgWire PgWire -- neon authsub --( Smtp : "envia OTP / reset" actions --( Smtp : "envia notificaciones" Smtp -- resend api --( Rest pages --> vercel : "deploy" actions --> vercel : "runtime" api --> vercel : "runtime" mobileClient --> eas : "build / OTA" mobileProvider --> eas : "build / OTA" @enduml