🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
218 lines
7.8 KiB
Markdown
218 lines
7.8 KiB
Markdown
# Vision General: ERP Core
|
|
|
|
## Resumen Ejecutivo
|
|
|
|
ERP Core es la **base generica reutilizable** que proporciona el 60-70% del codigo compartido para todas las verticales del ERP Suite. Es una adaptacion de los patrones de Odoo al stack TypeScript/Node.js/React.
|
|
|
|
---
|
|
|
|
## Proposito
|
|
|
|
### Problema que Resuelve
|
|
|
|
Desarrollar ERPs verticales desde cero es costoso y repetitivo. El 60-70% de la funcionalidad es comun:
|
|
- Autenticacion y usuarios
|
|
- Multi-tenancy
|
|
- Catalogos maestros
|
|
- Partners (clientes/proveedores)
|
|
- Productos e inventario
|
|
- Ventas y compras
|
|
- Contabilidad basica
|
|
|
|
### Solucion
|
|
|
|
ERP Core provee esta funcionalidad comun de forma:
|
|
- **Modular:** Cada modulo es independiente
|
|
- **Extensible:** Las verticales pueden extender sin modificar
|
|
- **Multi-tenant:** Aislamiento por tenant desde el diseno
|
|
- **Documentado:** Documentacion antes de desarrollo
|
|
|
|
---
|
|
|
|
## Objetivos
|
|
|
|
### Corto Plazo (3 meses)
|
|
1. Completar modulos core: Auth, Users, Roles, Tenants
|
|
2. Implementar Partners y Products
|
|
3. Establecer patrones de extension para verticales
|
|
|
|
### Mediano Plazo (6 meses)
|
|
1. Completar Sales, Purchases, Inventory
|
|
2. Implementar Financial basico
|
|
3. Primera vertical (Construccion) usando el core
|
|
|
|
### Largo Plazo (12 meses)
|
|
1. Todas las verticales usando el core
|
|
2. SaaS layer para autocontratacion
|
|
3. Marketplace de extensiones
|
|
|
|
---
|
|
|
|
## Arquitectura
|
|
|
|
### Modelo de Capas
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ FRONTEND │
|
|
│ React 18 + TypeScript + Tailwind + Zustand │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ API REST │
|
|
│ Express.js + TypeScript + Swagger │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ BACKEND │
|
|
│ Modulos: Auth | Users | Partners | Products | Sales... │
|
|
│ Services + Controllers + DTOs + Entities │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ DATABASE │
|
|
│ PostgreSQL 15+ con RLS (Row-Level Security) │
|
|
│ Schemas: core_auth | core_partners | core_products... │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
### Modelo de Extension
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ ERP CORE │
|
|
│ Modulos Genericos (MGN-001 a MGN-015) │
|
|
│ 60-70% funcionalidad comun │
|
|
└────────────────────────┬────────────────────────────────────┘
|
|
│ EXTIENDE
|
|
┌────────────────┼────────────────┐
|
|
↓ ↓ ↓
|
|
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
|
|
│ Construccion │ │Vidrio Templado│ │ Retail │
|
|
│ (MAI-*) │ │ (MVT-*) │ │ (MRT-*) │
|
|
│ 30-40% extra │ │ 30-40% extra │ │ 30-40% extra │
|
|
└───────────────┘ └───────────────┘ └───────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Modulos Core (MGN-*)
|
|
|
|
| Codigo | Modulo | Descripcion | Prioridad | Estado |
|
|
|--------|--------|-------------|-----------|--------|
|
|
| MGN-001 | auth | Autenticacion JWT, OAuth, sessions | P0 | En desarrollo |
|
|
| MGN-002 | users | Gestion de usuarios CRUD | P0 | En desarrollo |
|
|
| MGN-003 | roles | Roles y permisos (RBAC) | P0 | Planificado |
|
|
| MGN-004 | tenants | Multi-tenancy, aislamiento | P0 | Planificado |
|
|
| MGN-005 | catalogs | Catalogos maestros genericos | P1 | Planificado |
|
|
| MGN-006 | settings | Configuracion del sistema | P1 | Planificado |
|
|
| MGN-007 | audit | Auditoria y logs | P1 | Planificado |
|
|
| MGN-008 | notifications | Sistema de notificaciones | P2 | Planificado |
|
|
| MGN-009 | reports | Reportes genericos | P2 | Planificado |
|
|
| MGN-010 | financial | Contabilidad basica | P1 | Planificado |
|
|
| MGN-011 | inventory | Inventario basico | P1 | Planificado |
|
|
| MGN-012 | purchasing | Compras basicas | P1 | Planificado |
|
|
| MGN-013 | sales | Ventas basicas | P1 | Planificado |
|
|
| MGN-014 | crm | CRM basico | P2 | Planificado |
|
|
| MGN-015 | projects | Proyectos genericos | P2 | Planificado |
|
|
|
|
---
|
|
|
|
## Stack Tecnologico
|
|
|
|
### Backend
|
|
| Tecnologia | Version | Proposito |
|
|
|------------|---------|-----------|
|
|
| Node.js | 20+ | Runtime |
|
|
| Express.js | 4.x | Framework HTTP |
|
|
| TypeScript | 5.3+ | Lenguaje |
|
|
| TypeORM | 0.3.17 | ORM |
|
|
| JWT + bcryptjs | - | Autenticacion |
|
|
| Zod, class-validator | - | Validacion |
|
|
| Swagger | 3.x | Documentacion API |
|
|
| Jest | 29.x | Testing |
|
|
|
|
### Frontend
|
|
| Tecnologia | Version | Proposito |
|
|
|------------|---------|-----------|
|
|
| React | 18.x | Framework UI |
|
|
| Vite | 5.x | Build tool |
|
|
| TypeScript | 5.3+ | Lenguaje |
|
|
| Zustand | 4.x | State management |
|
|
| Tailwind CSS | 4.x | Styling |
|
|
| React Query | 5.x | Data fetching |
|
|
| React Hook Form | 7.x | Formularios |
|
|
|
|
### Database
|
|
| Tecnologia | Version | Proposito |
|
|
|------------|---------|-----------|
|
|
| PostgreSQL | 15+ | Motor BD |
|
|
| RLS | - | Row-Level Security |
|
|
| uuid-ossp | - | Generacion UUIDs |
|
|
| pg_trgm | - | Busqueda fuzzy |
|
|
|
|
---
|
|
|
|
## Principios de Diseno
|
|
|
|
### 1. Multi-Tenancy First
|
|
Toda tabla tiene `tenant_id`. Todo query filtra por tenant.
|
|
|
|
### 2. Documentation Driven
|
|
Documentar antes de desarrollar. La documentacion es el contrato.
|
|
|
|
### 3. Extension over Modification
|
|
Las verticales extienden, nunca modifican el core.
|
|
|
|
### 4. Patterns from Odoo
|
|
Adaptar patrones probados de Odoo al stack TypeScript.
|
|
|
|
### 5. Single Source of Truth
|
|
Un lugar para cada dato. Sincronizacion automatica.
|
|
|
|
---
|
|
|
|
## Entregables por Fase
|
|
|
|
### Fase 1: Foundation (Actual)
|
|
- [ ] MGN-001 Auth completo
|
|
- [ ] MGN-002 Users completo
|
|
- [ ] MGN-003 Roles completo
|
|
- [ ] MGN-004 Tenants completo
|
|
- [ ] Documentacion de todos los modulos
|
|
|
|
### Fase 2: Core Business
|
|
- [ ] MGN-005 Catalogs
|
|
- [ ] MGN-010 Financial basico
|
|
- [ ] MGN-011 Inventory
|
|
- [ ] MGN-012 Purchasing
|
|
- [ ] MGN-013 Sales
|
|
|
|
### Fase 3: Extended
|
|
- [ ] MGN-006 Settings
|
|
- [ ] MGN-007 Audit
|
|
- [ ] MGN-008 Notifications
|
|
- [ ] MGN-009 Reports
|
|
- [ ] MGN-014 CRM
|
|
- [ ] MGN-015 Projects
|
|
|
|
---
|
|
|
|
## Referencias
|
|
|
|
| Recurso | Path |
|
|
|---------|------|
|
|
| Directivas | `orchestration/directivas/` |
|
|
| Patrones Odoo | `orchestration/directivas/DIRECTIVA-PATRONES-ODOO.md` |
|
|
| Templates | `orchestration/templates/` |
|
|
| Catálogo central | `shared/catalog/` *(patrones reutilizables)* |
|
|
|
|
---
|
|
|
|
## Metricas de Exito
|
|
|
|
| Metrica | Objetivo |
|
|
|---------|----------|
|
|
| Cobertura de tests | >80% |
|
|
| Documentacion | 100% antes de desarrollo |
|
|
| Reutilizacion en verticales | >60% |
|
|
| Tiempo de setup nueva vertical | <1 semana |
|
|
|
|
---
|
|
|
|
*Ultima actualizacion: Diciembre 2025*
|