workspace-v1/04-fase-proyectos/erp-suite/PLANEACION/00-TAREAS.md
Adrian Flores Cortes 967ab360bb Initial commit: Workspace v1 with 3-layer architecture
Structure:
- control-plane/: Registries, SIMCO directives, CI/CD templates
- projects/: Gamilit, ERP-Suite, Trading-Platform, Betting-Analytics
- shared/: Libs catalog, knowledge-base

Key features:
- Centralized port, domain, database, and service registries
- 23 SIMCO directives + 6 fundamental principles
- NEXUS agent profiles with delegation rules
- Validation scripts for workspace integrity
- Dockerfiles for all services
- Path aliases for quick reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:35:19 -06:00

9.3 KiB

ERP SUITE - TAREAS DE IMPLEMENTACION

Proyecto: ERP Suite (Multi-Vertical) Fase: 4.2 - Migracion de ERP Suite Estado: Planificado


RESUMEN DE TAREAS

Grupo Tareas Esfuerzo
T4.2.1 Estructura Base 5 3 horas
T4.2.2 ERP Core 6 4 horas
T4.2.3 Vertical Construccion 5 3 horas
T4.2.4 Vertical Mecanicas 5 3 horas
T4.2.5 Docker Compose 4 4 horas
T4.2.6 Validacion 4 3 horas
TOTAL 29 20 horas

T4.2.1 ESTRUCTURA BASE

T4.2.1.1 Crear estructura de carpetas

mkdir -p erp-suite/{apps/{erp-core/{backend,frontend,database},verticales/{construccion,mecanicas-diesel,vidrio-templado,retail,clinicas}/{backend,frontend,database}},docker,orchestration,docs,.github/workflows}

T4.2.1.2 Crear package.json root

{
  "name": "erp-suite",
  "version": "1.0.0",
  "private": true,
  "workspaces": [
    "apps/erp-core/backend",
    "apps/erp-core/frontend",
    "apps/verticales/*/backend",
    "apps/verticales/*/frontend"
  ],
  "scripts": {
    "dev:core": "npm -w apps/erp-core/backend run dev",
    "dev:construccion": "npm -w apps/verticales/construccion/backend run dev",
    "dev:mecanicas": "npm -w apps/verticales/mecanicas-diesel/backend run dev",
    "build:all": "npm run build --workspaces",
    "test:all": "npm run test --workspaces"
  }
}

T4.2.1.3 - T4.2.1.5 README, .gitignore, documentacion


T4.2.2 ERP CORE

T4.2.2.1 Crear service.descriptor.yml para Core Backend

# apps/erp-core/backend/service.descriptor.yml
service:
  name: "erp-core-api"
  type: "backend"
  runtime: "node"
  version: "1.0.0"
  description: "API core del ERP Suite - Autenticacion, tenants, configuracion"
  owner_agent: "NEXUS-BACKEND"

repository:
  name: "erp-suite"
  path: "apps/erp-core/backend"
  main_branch: "main"

ports:
  internal: 3010
  registry_ref: "projects.erp_suite.api"
  protocol: "http"

domains:
  registry_ref: "erp"
  overrides:
    local: "api.erp.localhost"

database:
  registry_ref: "erp_core"
  role: "runtime"
  schemas:
    - "public"
    - "auth"
    - "config"
    - "tenants"

environments:
  deployed_to: ["local", "development", "production"]
  default: "local"

healthcheck:
  path: "/health"
  interval: "30s"

dependencies:
  services: []
  databases: ["erp_core_db"]
  external: []

ci:
  pipeline: "node-backend-standard"
  tests: true
  lint: true
  build: true
  docker: true
  docker_image: "erp-core-api"

T4.2.2.2 Crear service.descriptor.yml para Core Frontend

T4.2.2.3 Migrar codigo Core Backend

cp -r workspace/projects/erp-suite/apps/erp-core/backend/* erp-suite/apps/erp-core/backend/

T4.2.2.4 Migrar codigo Core Frontend

T4.2.2.5 Migrar Database Scripts Core

T4.2.2.6 Actualizar imports y paths


T4.2.3 VERTICAL CONSTRUCCION

T4.2.3.1 Crear service.descriptor.yml

# apps/verticales/construccion/backend/service.descriptor.yml
service:
  name: "erp-construccion-api"
  type: "backend"
  runtime: "node"
  version: "1.0.0"
  description: "API del ERP Construccion - Vertical especializada"
  owner_agent: "NEXUS-BACKEND"

repository:
  name: "erp-suite"
  path: "apps/verticales/construccion/backend"
  main_branch: "main"

ports:
  internal: 3012
  registry_ref: "projects.erp_construccion.api"
  protocol: "http"

domains:
  registry_ref: "erp_construccion"
  overrides:
    local: "api.construccion.erp.localhost"

database:
  registry_ref: "erp_construccion"
  role: "runtime"
  schemas:
    - "public"
    - "construction"
    - "hr"
    - "hse"
    - "estimates"

healthcheck:
  path: "/health"

dependencies:
  services:
    - name: "erp-core-api"
      required: true
      healthcheck: "http://erp-core-api:3010/health"
  databases: ["erp_construccion_db"]

ci:
  pipeline: "node-backend-standard"
  docker: true
  docker_image: "erp-construccion-api"

T4.2.3.2 - T4.2.3.5 Migrar codigo, database, actualizar paths


T4.2.4 VERTICAL MECANICAS

T4.2.4.1 Crear service.descriptor.yml

# apps/verticales/mecanicas-diesel/backend/service.descriptor.yml
service:
  name: "erp-mecanicas-api"
  type: "backend"
  runtime: "node"
  version: "1.0.0"
  description: "API del ERP Mecanicas Diesel"
  owner_agent: "NEXUS-BACKEND"

ports:
  internal: 3014
  registry_ref: "projects.erp_mecanicas.api"

database:
  registry_ref: "erp_mecanicas"
  schemas:
    - "public"
    - "workshop"
    - "inventory"
    - "customers"

dependencies:
  services:
    - name: "erp-core-api"
      required: true

T4.2.4.2 - T4.2.4.5 Migrar codigo, database, actualizar paths


T4.2.5 DOCKER COMPOSE

T4.2.5.1 Crear docker-compose.yml (Core)

# docker/docker-compose.yml - ERP Core Services
version: "3.8"

x-logging: &default-logging
  driver: "json-file"
  options:
    max-size: "10m"
    max-file: "3"

services:
  erp-core-api:
    build:
      context: ../apps/erp-core/backend
    container_name: erp-core-api
    expose:
      - "3010"
    environment:
      - NODE_ENV=${NODE_ENV:-development}
      - DATABASE_URL=${CORE_DATABASE_URL}
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3010/health"]
      interval: 30s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.erp-core-api.rule=Host(`api.erp.localhost`)"
      - "traefik.http.services.erp-core-api.loadbalancer.server.port=3010"
    networks:
      - erp_core_${ENV:-local}
      - infra_shared
    logging:
      <<: *default-logging

  erp-core-web:
    build:
      context: ../apps/erp-core/frontend
    container_name: erp-core-web
    expose:
      - "3011"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.erp-core-web.rule=Host(`erp.localhost`)"
    networks:
      - erp_core_${ENV:-local}
      - infra_shared

networks:
  erp_core_${ENV:-local}:
    external: true
  infra_shared:
    external: true

T4.2.5.2 Crear docker-compose.construccion.yml

# docker/docker-compose.construccion.yml
version: "3.8"

services:
  construccion-api:
    build:
      context: ../apps/verticales/construccion/backend
    container_name: erp-construccion-api
    expose:
      - "3012"
    environment:
      - NODE_ENV=${NODE_ENV:-development}
      - DATABASE_URL=${CONSTRUCCION_DATABASE_URL}
      - CORE_API_URL=http://erp-core-api:3010
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.construccion-api.rule=Host(`api.construccion.erp.localhost`)"
      - "traefik.http.services.construccion-api.loadbalancer.server.port=3012"
    networks:
      - erp_construccion_${ENV:-local}
      - erp_core_${ENV:-local}  # Para comunicarse con core
      - infra_shared
    depends_on:
      - erp-core-api

  construccion-web:
    build:
      context: ../apps/verticales/construccion/frontend
    container_name: erp-construccion-web
    expose:
      - "3013"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.construccion-web.rule=Host(`construccion.erp.localhost`)"
    networks:
      - erp_construccion_${ENV:-local}
      - infra_shared

networks:
  erp_construccion_${ENV:-local}:
    external: true
  erp_core_${ENV:-local}:
    external: true
  infra_shared:
    external: true

T4.2.5.3 Crear docker-compose.mecanicas.yml

Similar a construccion pero con puertos 3014, 3015.

T4.2.5.4 Crear .env.example

# .env.example - ERP Suite
NODE_ENV=development
ENV=local

# Core Database
CORE_DATABASE_URL=postgresql://erp_app:password@postgres:5432/erp_core_db

# Construccion Database
CONSTRUCCION_DATABASE_URL=postgresql://erp_app:password@postgres:5432/erp_construccion_db

# Mecanicas Database
MECANICAS_DATABASE_URL=postgresql://erp_app:password@postgres:5432/erp_mecanicas_db

# JWT (compartido)
JWT_SECRET=your-secret-key

T4.2.6 VALIDACION

T4.2.6.1 Validar Service Descriptors

for desc in apps/*/backend/service.descriptor.yml apps/verticales/*/backend/service.descriptor.yml; do
    echo "Validando $desc"
    python3 -c "import yaml; yaml.safe_load(open('$desc'))"
done

T4.2.6.2 Validar Builds

# Core
cd apps/erp-core/backend && npm install && npm run build

# Verticales
cd apps/verticales/construccion/backend && npm install && npm run build
cd apps/verticales/mecanicas-diesel/backend && npm install && npm run build

T4.2.6.3 Validar Docker

# Validar compose files
docker-compose -f docker-compose.yml config
docker-compose -f docker-compose.yml -f docker-compose.construccion.yml config
docker-compose -f docker-compose.yml -f docker-compose.mecanicas.yml config

T4.2.6.4 Probar Integracion

# Levantar core
docker-compose up -d

# Levantar construccion
docker-compose -f docker-compose.yml -f docker-compose.construccion.yml up -d

# Verificar health
curl http://api.erp.localhost/health
curl http://api.construccion.erp.localhost/health

CRONOGRAMA SUGERIDO

DIA 1 (5 horas):
- T4.2.1 Estructura base
- T4.2.2 ERP Core completo

DIA 2 (6 horas):
- T4.2.3 Vertical Construccion
- T4.2.4 Vertical Mecanicas

DIA 3 (5 horas):
- T4.2.5 Docker Compose

DIA 4 (4 horas):
- T4.2.6 Validacion
- Documentacion
- Fixes

DEPENDENCIAS

T4.2.1 (Estructura)
    |
    v
T4.2.2 (Core)
    |
    +-> T4.2.3 (Construccion)
    +-> T4.2.4 (Mecanicas)
    |
    v
T4.2.5 (Docker)
    |
    v
T4.2.6 (Validacion)

Documento generado por: Tech-Leader