🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
96 lines
3.1 KiB
Markdown
96 lines
3.1 KiB
Markdown
---
|
|
id: "EPIC-IAI-004"
|
|
title: "EPIC IAI-004 - Multi-Tenancy"
|
|
type: "Epic Document"
|
|
epic: "IAI-004"
|
|
status: "Planned"
|
|
story_points: 40
|
|
priority: "Alta"
|
|
project: "inmobiliaria-analytics"
|
|
created_date: "2026-01-04"
|
|
updated_date: "2026-01-04"
|
|
---
|
|
|
|
# EPIC IAI-004: Sistema Multi-Tenant
|
|
|
|
## Vision
|
|
|
|
Arquitectura multi-tenant para soportar multiples organizaciones (agencias inmobiliarias) en una sola instancia de la aplicacion, con aislamiento de datos mediante Row-Level Security (RLS).
|
|
|
|
---
|
|
|
|
## Alcance
|
|
|
|
### Incluye
|
|
|
|
- Modelo de tenant/organizacion
|
|
- Row-Level Security (RLS) en PostgreSQL
|
|
- Onboarding de nuevos tenants
|
|
- Administracion de tenant
|
|
- Branding por tenant (white-label basico)
|
|
|
|
### No Incluye
|
|
|
|
- Facturacion por tenant (ver IAI-005)
|
|
- Despliegue multi-region
|
|
|
|
---
|
|
|
|
## Arquitectura
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ APLICACION (Single Instance) │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ │
|
|
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
│ │ Tenant A│ │ Tenant B│ │ Tenant C│ │
|
|
│ │ (RLS) │ │ (RLS) │ │ (RLS) │ │
|
|
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
|
│ │ │ │ │
|
|
│ └─────────────┼─────────────┘ │
|
|
│ │ │
|
|
│ ┌───────▼───────┐ │
|
|
│ │ PostgreSQL │ │
|
|
│ │ (RLS) │ │
|
|
│ └───────────────┘ │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Dependencias
|
|
|
|
### Depende de
|
|
|
|
- IAI-001: Fundamentos (auth, usuarios)
|
|
- IAI-003: Usuarios (modelo base)
|
|
|
|
### Bloquea a
|
|
|
|
- IAI-005: Pagos (facturacion por tenant)
|
|
- IAI-006: Portales (portales por tenant)
|
|
|
|
---
|
|
|
|
## Story Points Estimados
|
|
|
|
| Tipo | Cantidad | SP |
|
|
|------|----------|-----|
|
|
| User Stories | 5 | 40 |
|
|
| Total | - | 40 |
|
|
|
|
---
|
|
|
|
## Riesgos
|
|
|
|
| Riesgo | Probabilidad | Impacto | Mitigacion |
|
|
|--------|--------------|---------|------------|
|
|
| Data leakage entre tenants | Baja | Critico | RLS exhaustivo, testing |
|
|
| Performance con muchos tenants | Media | Alto | Indices, particionamiento |
|
|
|
|
---
|
|
|
|
**Estado:** Planned
|
|
**Sprint:** -
|