# Template SaaS - Mapa de Documentacion **Proyecto:** template-saas **Tipo:** Template Base Multi-Tenant **Fecha:** 2026-01-07 **Estado:** DDL y Backend 100%, Documentacion de modulos pendiente --- ## Estructura de Documentacion ``` docs/ ├── _MAP.md <- ESTE ARCHIVO ├── 00-vision-general/ │ ├── README.md <- Indice de vision │ └── VISION.md <- Vision estrategica [PENDIENTE] │ ├── 01-modulos/ │ ├── _MAP.md <- Indice de modulos [PENDIENTE] │ ├── SAAS-001-auth/ │ │ ├── README.md │ │ ├── ESPECIFICACION.md │ │ ├── FLUJOS.md │ │ ├── IMPLEMENTACION.md │ │ └── TESTS.md │ ├── SAAS-002-tenants/ │ ├── SAAS-003-users/ │ ├── SAAS-004-billing/ │ ├── SAAS-005-plans/ │ ├── SAAS-006-onboarding/ │ ├── SAAS-007-notifications/ │ ├── SAAS-008-feature-flags/ │ ├── SAAS-009-audit/ │ ├── SAAS-010-ai-integration/ │ ├── SAAS-011-portal-user/ │ └── SAAS-012-portal-admin/ │ ├── 02-integraciones/ │ ├── _MAP.md <- Indice de integraciones [PENDIENTE] │ ├── INT-001-STRIPE/ │ │ ├── README.md │ │ ├── ESPECIFICACION.md │ │ ├── WEBHOOKS.md │ │ └── MIGRACION.md │ ├── INT-002-OAUTH/ │ ├── INT-003-EMAIL/ │ ├── INT-004-PUSH/ │ └── INT-005-STORAGE/ │ └── 97-adr/ ├── _MAP.md <- Indice de ADRs [PENDIENTE] ├── ADR-001-multi-tenancy.md ├── ADR-002-billing-model.md ├── ADR-003-portal-architecture.md ├── ADR-004-ai-integration.md └── ADR-005-feature-flags.md ``` --- ## Modulos SaaS ### Modulos Core (Autenticacion y Tenants) | Modulo | Codigo | Estado | Descripcion | |--------|--------|--------|-------------| | Auth | SAAS-001 | Implementado | JWT, OAuth, MFA | | Tenants | SAAS-002 | Implementado | Gestion multi-tenant | | Users | SAAS-003 | Implementado | Usuarios con RBAC | ### Modulos Billing | Modulo | Codigo | Estado | Descripcion | |--------|--------|--------|-------------| | Billing | SAAS-004 | Implementado | Suscripciones Stripe | | Plans | SAAS-005 | Implementado | Planes y limites | ### Modulos Experiencia | Modulo | Codigo | Estado | Descripcion | |--------|--------|--------|-------------| | Onboarding | SAAS-006 | Implementado | Flujo de registro | | Notifications | SAAS-007 | Implementado | Email, push, in-app | | Feature Flags | SAAS-008 | Implementado | Toggles por plan/tenant | | Audit | SAAS-009 | Implementado | Auditoria de acciones | ### Modulos Avanzados | Modulo | Codigo | Estado | Descripcion | |--------|--------|--------|-------------| | AI Integration | SAAS-010 | Implementado | Wrapper multi-proveedor LLM | | Portal User | SAAS-011 | Implementado | Portal usuario final | | Portal Admin | SAAS-012 | Implementado | Portal admin de tenant | --- ## Integraciones Externas | Integracion | Codigo | Estado | Proposito | |-------------|--------|--------|-----------| | Stripe | INT-001 | Implementado | Pagos y suscripciones | | OAuth | INT-002 | Implementado | Google, GitHub, etc. | | Email | INT-003 | Pendiente | SendGrid, SES | | Push | INT-004 | Pendiente | FCM, OneSignal | | Storage | INT-005 | Pendiente | S3, GCS | --- ## Schemas de Base de Datos | Schema | Tablas | Descripcion | |--------|--------|-------------| | auth | 5 | Autenticacion y sesiones | | tenants | 3 | Multi-tenancy | | users | 4 | Usuarios y perfiles | | rbac | 4 | Roles y permisos | | billing | 5 | Suscripciones y pagos | | plans | 3 | Planes y limites | | notifications | 3 | Notificaciones | | feature_flags | 2 | Feature toggles | | audit | 1 | Logs de auditoria | **Total:** 9 schemas, 27 tablas --- ## Portales | Portal | Ruta | Descripcion | |--------|------|-------------| | User | / | Portal usuario final | | Admin | /admin | Portal admin de tenant | | Superadmin | /superadmin | Portal superadmin | --- ## Arquitectura Multi-Tenant ```yaml estrategia: "Row-Level Security (RLS)" aislamiento: "Por tenant_id en cada tabla" contexto: - JWT claims contienen tenant_id - Middleware inyecta tenant context - RLS policies validan automaticamente ``` --- ## Modelo de Billing ```yaml planes: - Free: $0/mes, limitaciones - Basic: $29/mes - Pro: $99/mes - Enterprise: Custom ciclos: - Monthly - Yearly (20% descuento) trial: 14 dias metered_billing: opcional ``` --- ## AI Integration ```yaml wrapper: "Agnostico multi-proveedor" proveedores_soportados: - Claude (Anthropic) - GPT-4 (OpenAI) - Gemini (Google) features: - Token counting - Cost tracking - Rate limiting por tenant ``` --- ## ADRs (Decisiones Arquitectonicas) | ADR | Titulo | Estado | |-----|--------|--------| | ADR-001 | Multi-tenancy con RLS | Pendiente | | ADR-002 | Modelo de Billing Stripe | Pendiente | | ADR-003 | Arquitectura de Portales | Pendiente | | ADR-004 | Integracion IA Agnostica | Pendiente | | ADR-005 | Feature Flags por Tenant | Pendiente | --- ## Navegacion Rapida ### Por Componente Tecnico - **Database:** Ver orchestration/inventarios/DATABASE_INVENTORY.yml - **Backend:** Ver orchestration/inventarios/BACKEND_INVENTORY.yml - **Frontend:** Ver orchestration/inventarios/FRONTEND_INVENTORY.yml ### Por Estado - **Implementado:** Schemas, Backend modules - **Pendiente:** Documentacion de modulos, Integraciones --- ## Referencias - [CONTEXTO-PROYECTO.md](../orchestration/00-guidelines/CONTEXTO-PROYECTO.md) - [PROXIMA-ACCION.md](../orchestration/PROXIMA-ACCION.md) - [CONTEXT-MAP.yml](../orchestration/CONTEXT-MAP.yml) - [PROJECT-STATUS.md](../orchestration/PROJECT-STATUS.md) --- **Ultima actualizacion:** 2026-01-07 **Version:** 1.0.0