448 lines
8.9 KiB
JSON
448 lines
8.9 KiB
JSON
{
|
|
"schema_version": 1,
|
|
"diagram_type": "architecture",
|
|
"meta": {
|
|
"title": "Arquitectura de Gruperly",
|
|
"locale": "es",
|
|
"output": ".archify/architecture-gruperly-20261103-121500/arquitectura-gruperly.html",
|
|
"quality_profile": "showcase",
|
|
"repository": {
|
|
"url": "https://git.2pidev.com/jselesan/gruperly.git",
|
|
"link_mode": "local-only",
|
|
"revision": "d21e1c37302d8d3f2ff8b0af05f4df21284bffe3"
|
|
},
|
|
"views": [
|
|
{
|
|
"id": "request",
|
|
"label": "Pedido del profe",
|
|
"focus": [
|
|
"teacher",
|
|
"web",
|
|
"nginx",
|
|
"guards",
|
|
"api",
|
|
"db"
|
|
],
|
|
"note": "Mismo dominio: nginx sirve el bundle y hace proxy de /api al contenedor api."
|
|
},
|
|
{
|
|
"id": "students",
|
|
"label": "App de alumnos",
|
|
"focus": [
|
|
"student",
|
|
"web",
|
|
"guards",
|
|
"storage"
|
|
],
|
|
"note": "Sin Better Auth: cookie y middleware propios; comprobantes en S3 privado."
|
|
},
|
|
{
|
|
"id": "integrations",
|
|
"label": "Integraciones",
|
|
"focus": [
|
|
"api",
|
|
"mp",
|
|
"stripe",
|
|
"whatsapp",
|
|
"smtp",
|
|
"storage"
|
|
],
|
|
"note": "Cada proveedor detrás de un puerto; sin credenciales responde 503 y el resto sigue andando."
|
|
}
|
|
]
|
|
},
|
|
"components": [
|
|
{
|
|
"id": "teacher",
|
|
"type": "external",
|
|
"label": "Profesor",
|
|
"sublabel": "navegador / PWA",
|
|
"icon": "person",
|
|
"pos": [
|
|
40,
|
|
60
|
|
],
|
|
"size": [
|
|
120,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/web/src/routes/_authenticated.tsx",
|
|
"line": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "web",
|
|
"type": "frontend",
|
|
"label": "Web PWA",
|
|
"sublabel": "React 19 · Vite",
|
|
"pos": [
|
|
230,
|
|
56
|
|
],
|
|
"size": [
|
|
140,
|
|
68
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/web/vite.config.ts",
|
|
"line": 12,
|
|
"label": "VitePWA"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "student",
|
|
"type": "external",
|
|
"label": "Alumno / tutor",
|
|
"sublabel": "/i/:token · /student",
|
|
"icon": "person",
|
|
"pos": [
|
|
230,
|
|
240
|
|
],
|
|
"size": [
|
|
140,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/web/src/routes/i.$token.tsx",
|
|
"line": 1
|
|
},
|
|
{
|
|
"path": "apps/web/src/routes/_student.tsx",
|
|
"line": 1
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "nginx",
|
|
"type": "cloud",
|
|
"label": "nginx",
|
|
"sublabel": "bundle + proxy /api",
|
|
"pos": [
|
|
450,
|
|
60
|
|
],
|
|
"size": [
|
|
140,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/web/nginx.conf",
|
|
"line": 14,
|
|
"end_line": 26
|
|
},
|
|
{
|
|
"path": "docker-compose.yml",
|
|
"line": 1,
|
|
"end_line": 8
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "guards",
|
|
"type": "security",
|
|
"label": "Guards de sesión",
|
|
"sublabel": "Better Auth · alumno",
|
|
"pos": [
|
|
680,
|
|
56
|
|
],
|
|
"size": [
|
|
150,
|
|
68
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/http/session-auth.ts",
|
|
"line": 23,
|
|
"end_line": 48
|
|
},
|
|
{
|
|
"path": "apps/backend/src/modules/student-portal/middleware.ts",
|
|
"line": 50
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "api",
|
|
"type": "backend",
|
|
"label": "API Hono + jobs",
|
|
"sublabel": "Bun.serve :4000 · cron",
|
|
"pos": [
|
|
880,
|
|
56
|
|
],
|
|
"size": [
|
|
150,
|
|
68
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/server.ts",
|
|
"line": 14,
|
|
"end_line": 23
|
|
},
|
|
{
|
|
"path": "apps/backend/src/app.ts",
|
|
"line": 44,
|
|
"end_line": 73
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "db",
|
|
"type": "database",
|
|
"label": "PostgreSQL",
|
|
"sublabel": "Prisma 7 · adapter-pg",
|
|
"pos": [
|
|
1090,
|
|
60
|
|
],
|
|
"size": [
|
|
140,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/lib/prisma.ts",
|
|
"line": 14,
|
|
"end_line": 18
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "mp",
|
|
"type": "external",
|
|
"label": "Mercado Pago",
|
|
"sublabel": "OAuth · Checkout Pro",
|
|
"pos": [
|
|
610,
|
|
320
|
|
],
|
|
"size": [
|
|
130,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/modules/mp/lib/mp-oauth.ts",
|
|
"line": 3,
|
|
"end_line": 4
|
|
},
|
|
{
|
|
"path": "apps/backend/src/modules/mp/lib/mp-http.ts",
|
|
"line": 4
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "stripe",
|
|
"type": "external",
|
|
"label": "Stripe",
|
|
"sublabel": "Pro fuera de AR",
|
|
"pos": [
|
|
760,
|
|
320
|
|
],
|
|
"size": [
|
|
110,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/modules/billing/providers/index.ts",
|
|
"line": 24,
|
|
"end_line": 31
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "whatsapp",
|
|
"type": "external",
|
|
"label": "WhatsApp",
|
|
"sublabel": "OpenWA / Kapso",
|
|
"pos": [
|
|
890,
|
|
320
|
|
],
|
|
"size": [
|
|
130,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/modules/whatsapp/providers/index.ts",
|
|
"line": 26,
|
|
"end_line": 40
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "smtp",
|
|
"type": "external",
|
|
"label": "SMTP",
|
|
"sublabel": "mails",
|
|
"pos": [
|
|
1040,
|
|
320
|
|
],
|
|
"size": [
|
|
100,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/lib/email.ts",
|
|
"line": 181,
|
|
"end_line": 187
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "storage",
|
|
"type": "cloud",
|
|
"label": "S3 (RustFS)",
|
|
"sublabel": "comprobantes",
|
|
"pos": [
|
|
1160,
|
|
320
|
|
],
|
|
"size": [
|
|
130,
|
|
60
|
|
],
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/src/lib/storage.ts",
|
|
"line": 38,
|
|
"end_line": 54
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"boundaries": [
|
|
{
|
|
"kind": "region",
|
|
"label": "Dokploy",
|
|
"wraps": [
|
|
"nginx",
|
|
"guards",
|
|
"api",
|
|
"db"
|
|
]
|
|
},
|
|
{
|
|
"kind": "security-group",
|
|
"label": "contenedor api",
|
|
"wraps": [
|
|
"guards",
|
|
"api"
|
|
]
|
|
}
|
|
],
|
|
"connections": [
|
|
{
|
|
"id": "teacher-web",
|
|
"from": "teacher",
|
|
"to": "web",
|
|
"label": "HTTPS",
|
|
"variant": "emphasis"
|
|
},
|
|
{
|
|
"id": "student-web",
|
|
"from": "student",
|
|
"to": "web",
|
|
"label": "link de WhatsApp"
|
|
},
|
|
{
|
|
"id": "web-nginx",
|
|
"from": "web",
|
|
"to": "nginx",
|
|
"label": "/api/v1",
|
|
"variant": "emphasis"
|
|
},
|
|
{
|
|
"id": "nginx-guards",
|
|
"from": "nginx",
|
|
"to": "guards",
|
|
"label": "proxy_pass",
|
|
"variant": "emphasis"
|
|
},
|
|
{
|
|
"id": "guards-api",
|
|
"from": "guards",
|
|
"to": "api",
|
|
"variant": "security"
|
|
},
|
|
{
|
|
"id": "api-db",
|
|
"from": "api",
|
|
"to": "db",
|
|
"label": "SQL"
|
|
},
|
|
{
|
|
"id": "api-mp",
|
|
"from": "api",
|
|
"to": "mp",
|
|
"label": "cobros"
|
|
},
|
|
{
|
|
"id": "api-stripe",
|
|
"from": "api",
|
|
"to": "stripe",
|
|
"label": "Pro"
|
|
},
|
|
{
|
|
"id": "api-whatsapp",
|
|
"from": "api",
|
|
"to": "whatsapp",
|
|
"label": "mensajes"
|
|
},
|
|
{
|
|
"id": "api-smtp",
|
|
"from": "api",
|
|
"to": "smtp",
|
|
"label": "mails"
|
|
},
|
|
{
|
|
"id": "api-storage",
|
|
"from": "api",
|
|
"to": "storage",
|
|
"label": "URLs firmadas"
|
|
}
|
|
],
|
|
"cards": [
|
|
{
|
|
"dot": "cyan",
|
|
"title": "Entrada",
|
|
"items": [
|
|
"Un solo dominio público en el contenedor web: nginx sirve la PWA y hace proxy de /api a api:4000, así la cookie de sesión es first-party.",
|
|
"Los alumnos entran por un link de invitación de un solo uso; no tienen contraseña."
|
|
]
|
|
},
|
|
{
|
|
"dot": "rose",
|
|
"title": "Seguridad",
|
|
"items": [
|
|
"sessionAuthMiddleware exige sesión de Better Auth salvo la whitelist pública (isPublicApiRequest).",
|
|
"/student-portal usa cookie y middleware propios (studentSession); una sesión de alumno no llega a rutas del profe.",
|
|
"Los webhooks de MP, Stripe y WhatsApp son públicos y se autentican por firma."
|
|
]
|
|
},
|
|
{
|
|
"dot": "emerald",
|
|
"title": "Jobs en el mismo proceso",
|
|
"items": [
|
|
"server.ts arranca los crons de MP, pagos, WhatsApp, billing y app de alumnos junto a Bun.serve.",
|
|
"La conciliación de pagos es por polling a Mercado Pago, sin webhook."
|
|
]
|
|
}
|
|
]
|
|
} |