- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8 - Cambios en backend y frontend Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
593 lines
16 KiB
YAML
593 lines
16 KiB
YAML
# =============================================================================
|
|
# ENVIRONMENT-INVENTORY.yml - MICHANGARRITO
|
|
# =============================================================================
|
|
# Inventario Completo de Entorno de Desarrollo y Produccion
|
|
# Generado por: @PERFIL_DEVENV
|
|
# =============================================================================
|
|
|
|
version: "1.0.0"
|
|
fecha_creacion: "2026-01-04"
|
|
fecha_actualizacion: "2026-01-05"
|
|
responsable: "@PERFIL_DEVENV"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# IDENTIFICACION DEL PROYECTO
|
|
# -----------------------------------------------------------------------------
|
|
|
|
proyecto:
|
|
nombre: "MiChangarrito"
|
|
alias: "michangarrito"
|
|
codigo: "MCH"
|
|
nivel: "NIVEL_2A"
|
|
tipo: "saas-standalone"
|
|
estado: "desarrollo-activo"
|
|
descripcion: "POS inteligente para micro-negocios con asistente IA via WhatsApp"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# HERRAMIENTAS Y RUNTIME
|
|
# -----------------------------------------------------------------------------
|
|
|
|
herramientas:
|
|
runtime:
|
|
node:
|
|
version: "20.x"
|
|
version_minima: "18.x"
|
|
requerido: true
|
|
notas: "LTS para NestJS, React y React Native"
|
|
python:
|
|
version: "3.11"
|
|
requerido: false
|
|
notas: "Solo si se usa Ollama local o scripts de ML"
|
|
|
|
package_managers:
|
|
npm:
|
|
version: "10.x"
|
|
requerido: true
|
|
pnpm:
|
|
version: "8.x"
|
|
requerido: false
|
|
notas: "Alternativa para monorepo"
|
|
|
|
mobile:
|
|
expo:
|
|
version: "50.x"
|
|
requerido: true
|
|
notas: "Managed workflow para React Native"
|
|
eas_cli:
|
|
version: "latest"
|
|
requerido: true
|
|
notas: "Para builds y submissions"
|
|
|
|
build_tools:
|
|
- nombre: "Vite"
|
|
version: "5.x"
|
|
uso: "Web dashboard build"
|
|
- nombre: "TypeScript"
|
|
version: "5.x"
|
|
uso: "Compilacion"
|
|
- nombre: "NestJS CLI"
|
|
version: "10.x"
|
|
uso: "Backend scaffolding"
|
|
- nombre: "Expo CLI"
|
|
version: "latest"
|
|
uso: "Mobile development"
|
|
|
|
linters:
|
|
- nombre: "ESLint"
|
|
version: "8.x"
|
|
config: ".eslintrc.js"
|
|
- nombre: "Prettier"
|
|
version: "3.x"
|
|
config: ".prettierrc"
|
|
|
|
testing:
|
|
- nombre: "Jest"
|
|
version: "29.x"
|
|
tipo: "unit backend"
|
|
- nombre: "Vitest"
|
|
version: "1.x"
|
|
tipo: "unit web"
|
|
- nombre: "Detox"
|
|
version: "20.x"
|
|
tipo: "e2e mobile"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# SERVICIOS Y PUERTOS
|
|
# -----------------------------------------------------------------------------
|
|
|
|
servicios:
|
|
web:
|
|
nombre: "michangarrito-web"
|
|
framework: "React"
|
|
version: "18.x"
|
|
puerto: 3140
|
|
comando_dev: "npm run dev"
|
|
ubicacion: "apps/web/"
|
|
url_local: "http://localhost:3140"
|
|
|
|
backend:
|
|
nombre: "michangarrito-backend"
|
|
framework: "NestJS"
|
|
version: "10.x"
|
|
puerto: 3141
|
|
comando_dev: "npm run start:dev"
|
|
ubicacion: "apps/backend/"
|
|
url_local: "http://localhost:3141"
|
|
api_prefix: "/api/v1"
|
|
swagger_url: "http://localhost:3141/api/docs"
|
|
|
|
mcp_server:
|
|
nombre: "michangarrito-mcp"
|
|
framework: "Custom MCP"
|
|
puerto: 3142
|
|
comando_dev: "npm run dev"
|
|
ubicacion: "apps/mcp-server/"
|
|
url_local: "http://localhost:3142"
|
|
descripcion: "Gateway LLM con herramientas MCP"
|
|
|
|
whatsapp_service:
|
|
nombre: "michangarrito-whatsapp"
|
|
framework: "NestJS"
|
|
puerto: 3143
|
|
comando_dev: "npm run start:dev"
|
|
ubicacion: "apps/whatsapp-service/"
|
|
url_local: "http://localhost:3143"
|
|
webhook_path: "/webhook/whatsapp"
|
|
|
|
mobile:
|
|
nombre: "michangarrito-mobile"
|
|
framework: "React Native (Expo)"
|
|
puerto_metro: 8081
|
|
comando_dev: "npx expo start"
|
|
ubicacion: "apps/mobile/"
|
|
expo_dev_client: true
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# BASE DE DATOS
|
|
# -----------------------------------------------------------------------------
|
|
|
|
base_de_datos:
|
|
principal:
|
|
engine: "PostgreSQL"
|
|
version: "15"
|
|
|
|
ambientes:
|
|
development:
|
|
host: "localhost"
|
|
puerto: 5432 # Instancia compartida del workspace
|
|
nombre: "michangarrito_dev"
|
|
usuario: "michangarrito_dev"
|
|
password: "MCh_dev_2025_secure"
|
|
ssl: false
|
|
pool_size: 10
|
|
conexion: "postgresql://michangarrito_dev:MCh_dev_2025_secure@localhost:5432/michangarrito_dev"
|
|
estado: "ACTIVO"
|
|
|
|
test:
|
|
host: "localhost"
|
|
puerto: 5432 # Instancia compartida del workspace
|
|
nombre: "michangarrito_test"
|
|
usuario: "michangarrito_dev"
|
|
ssl: false
|
|
pool_size: 5
|
|
|
|
staging:
|
|
host: "${DB_HOST}"
|
|
puerto: 5432
|
|
nombre: "michangarrito_staging"
|
|
usuario: "michangarrito_staging"
|
|
ssl: true
|
|
pool_size: 20
|
|
|
|
production:
|
|
host: "${DB_HOST}"
|
|
puerto: 5432
|
|
nombre: "michangarrito_prod"
|
|
usuario: "michangarrito_prod"
|
|
ssl: true
|
|
pool_size: 100
|
|
|
|
schemas:
|
|
- nombre: "public"
|
|
descripcion: "Tenants y configuracion global"
|
|
tablas: ["tenants"]
|
|
estado: "CREADO"
|
|
- nombre: "auth"
|
|
descripcion: "Usuarios, roles, permisos"
|
|
tablas: ["users", "roles", "permissions", "user_roles", "role_permissions"]
|
|
estado: "CREADO"
|
|
- nombre: "catalog"
|
|
descripcion: "Productos, categorias, templates"
|
|
tablas: ["categories", "products"]
|
|
estado: "CREADO"
|
|
- nombre: "sales"
|
|
descripcion: "Ventas, pagos, cortes de caja"
|
|
tablas: ["sales", "sale_items", "payments", "cash_registers", "cash_movements"]
|
|
estado: "CREADO"
|
|
- nombre: "inventory"
|
|
descripcion: "Stock, movimientos, alertas"
|
|
tablas: ["inventory_movements", "stock_alerts"]
|
|
estado: "CREADO"
|
|
- nombre: "customers"
|
|
descripcion: "Clientes, fiados, pedidos"
|
|
tablas: ["customers", "fiados", "fiado_payments"]
|
|
estado: "CREADO"
|
|
- nombre: "orders"
|
|
descripcion: "Pedidos de WhatsApp"
|
|
tablas: ["orders", "order_items"]
|
|
estado: "CREADO"
|
|
- nombre: "subscriptions"
|
|
descripcion: "Planes, suscripciones, tokens"
|
|
tablas: ["plans", "subscriptions", "token_balances", "token_usage"]
|
|
estado: "CREADO"
|
|
- nombre: "messaging"
|
|
descripcion: "WhatsApp, sesiones, mensajes"
|
|
tablas: ["conversations", "messages", "notifications"]
|
|
estado: "CREADO"
|
|
|
|
redis:
|
|
ambientes:
|
|
development:
|
|
host: "localhost"
|
|
puerto: 6379 # Instancia compartida del workspace
|
|
database: 8 # DB number asignado a MiChangarrito
|
|
conexion: "redis://localhost:6379/8"
|
|
|
|
production:
|
|
host: "${REDIS_HOST}"
|
|
puerto: 6379
|
|
password_ref: "REDIS_PASSWORD"
|
|
|
|
uso:
|
|
- "Sesiones de usuario"
|
|
- "Cache de productos y precios"
|
|
- "Rate limiting"
|
|
- "Bull queues (jobs)"
|
|
- "Pub/Sub para real-time"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# VARIABLES DE ENTORNO - DESARROLLO
|
|
# -----------------------------------------------------------------------------
|
|
|
|
variables_entorno:
|
|
archivos:
|
|
ejemplo: ".env.example"
|
|
desarrollo: ".env"
|
|
produccion: ".env.production"
|
|
|
|
development:
|
|
# Aplicacion
|
|
- nombre: "NODE_ENV"
|
|
valor: "development"
|
|
- nombre: "APP_NAME"
|
|
valor: "michangarrito"
|
|
|
|
# Puertos
|
|
- nombre: "WEB_PORT"
|
|
valor: "3140"
|
|
- nombre: "BACKEND_PORT"
|
|
valor: "3141"
|
|
- nombre: "MCP_PORT"
|
|
valor: "3142"
|
|
- nombre: "WHATSAPP_PORT"
|
|
valor: "3143"
|
|
|
|
# Base de datos
|
|
- nombre: "DB_HOST"
|
|
valor: "localhost"
|
|
- nombre: "DB_PORT"
|
|
valor: "5432" # Instancia compartida del workspace
|
|
- nombre: "DB_NAME"
|
|
valor: "michangarrito_dev"
|
|
- nombre: "DB_USER"
|
|
valor: "michangarrito_dev"
|
|
- nombre: "DB_PASSWORD"
|
|
valor: ""
|
|
sensible: true
|
|
generacion: "openssl rand -base64 32"
|
|
- nombre: "DATABASE_URL"
|
|
valor: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
|
|
sensible: true
|
|
|
|
# Redis (instancia compartida, DB 8 para MiChangarrito)
|
|
- nombre: "REDIS_HOST"
|
|
valor: "localhost"
|
|
- nombre: "REDIS_PORT"
|
|
valor: "6379" # Instancia compartida del workspace
|
|
- nombre: "REDIS_DB"
|
|
valor: "8" # Database number asignado a MiChangarrito
|
|
- nombre: "REDIS_URL"
|
|
valor: "redis://localhost:6379/8"
|
|
|
|
# JWT
|
|
- nombre: "JWT_SECRET"
|
|
valor: ""
|
|
sensible: true
|
|
generacion: "openssl rand -base64 64"
|
|
- nombre: "JWT_EXPIRES_IN"
|
|
valor: "7d"
|
|
|
|
# WhatsApp Meta API
|
|
- nombre: "WHATSAPP_VERIFY_TOKEN"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "WHATSAPP_ACCESS_TOKEN"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "WHATSAPP_PHONE_NUMBER_ID"
|
|
valor: ""
|
|
- nombre: "WHATSAPP_BUSINESS_ACCOUNT_ID"
|
|
valor: ""
|
|
|
|
# LLM (Agnostico)
|
|
- nombre: "LLM_PROVIDER"
|
|
valor: "openrouter"
|
|
descripcion: "openrouter, openai, anthropic, ollama"
|
|
- nombre: "LLM_API_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "LLM_MODEL"
|
|
valor: "anthropic/claude-3-haiku"
|
|
- nombre: "LLM_BASE_URL"
|
|
valor: "https://openrouter.ai/api/v1"
|
|
|
|
# Stripe
|
|
- nombre: "STRIPE_SECRET_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "STRIPE_WEBHOOK_SECRET"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "STRIPE_PUBLISHABLE_KEY"
|
|
valor: ""
|
|
|
|
# Mercado Pago
|
|
- nombre: "MERCADOPAGO_ACCESS_TOKEN"
|
|
valor: ""
|
|
sensible: true
|
|
|
|
# Clip
|
|
- nombre: "CLIP_API_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
|
|
# Firebase (Push Notifications)
|
|
- nombre: "FIREBASE_PROJECT_ID"
|
|
valor: ""
|
|
- nombre: "FIREBASE_PRIVATE_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
|
|
# Storage
|
|
- nombre: "STORAGE_TYPE"
|
|
valor: "local"
|
|
- nombre: "STORAGE_PATH"
|
|
valor: "./uploads"
|
|
|
|
# OCR/Transcription
|
|
- nombre: "GOOGLE_VISION_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
- nombre: "OPENAI_API_KEY"
|
|
valor: ""
|
|
sensible: true
|
|
descripcion: "Para Whisper transcription"
|
|
|
|
# CORS
|
|
- nombre: "FRONTEND_URL"
|
|
valor: "http://localhost:3140"
|
|
- nombre: "ALLOWED_ORIGINS"
|
|
valor: "http://localhost:3140,http://localhost:3141,exp://localhost:8081"
|
|
|
|
# Logging
|
|
- nombre: "LOG_LEVEL"
|
|
valor: "debug"
|
|
- nombre: "LOG_FORMAT"
|
|
valor: "pretty"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# DOCKER
|
|
# -----------------------------------------------------------------------------
|
|
|
|
docker:
|
|
compose_file: "docker-compose.yml"
|
|
|
|
services:
|
|
- nombre: "db"
|
|
imagen: "postgres:15-alpine"
|
|
puerto_host: 5432 # Usa instancia compartida del workspace
|
|
puerto_container: 5432
|
|
variables:
|
|
POSTGRES_DB: "michangarrito_dev"
|
|
POSTGRES_USER: "michangarrito_dev"
|
|
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
|
|
|
- nombre: "redis"
|
|
imagen: "redis:7-alpine"
|
|
puerto_host: 6379 # Usa instancia compartida del workspace
|
|
puerto_container: 6379
|
|
|
|
- nombre: "mailhog"
|
|
imagen: "mailhog/mailhog"
|
|
puerto_smtp: 1025
|
|
puerto_web: 8025
|
|
|
|
volumes:
|
|
- "postgres_data"
|
|
- "redis_data"
|
|
- "uploads_data"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# SCRIPTS DE DESARROLLO
|
|
# -----------------------------------------------------------------------------
|
|
|
|
scripts:
|
|
setup:
|
|
pasos:
|
|
- "npm install"
|
|
- "cp .env.example .env"
|
|
- "docker-compose up -d db redis"
|
|
- "npm run db:create"
|
|
- "npm run migration:run"
|
|
- "npm run seed"
|
|
|
|
desarrollo:
|
|
backend: "cd apps/backend && npm run start:dev"
|
|
web: "cd apps/web && npm run dev"
|
|
mobile: "cd apps/mobile && npx expo start"
|
|
mcp: "cd apps/mcp-server && npm run dev"
|
|
whatsapp: "cd apps/whatsapp-service && npm run start:dev"
|
|
all: "npm run dev:all"
|
|
|
|
build:
|
|
backend: "cd apps/backend && npm run build"
|
|
web: "cd apps/web && npm run build"
|
|
mobile_android: "cd apps/mobile && eas build -p android"
|
|
mobile_ios: "cd apps/mobile && eas build -p ios"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# INSTRUCCIONES DE SETUP
|
|
# -----------------------------------------------------------------------------
|
|
|
|
setup_instrucciones: |
|
|
## Setup MiChangarrito - Entorno de Desarrollo
|
|
|
|
### Prerequisitos
|
|
- Node.js 20.x
|
|
- Docker y Docker Compose
|
|
- Expo CLI: npm install -g expo-cli eas-cli
|
|
- Cuenta de Expo (para builds mobile)
|
|
|
|
### Setup Rápido
|
|
|
|
```bash
|
|
# 1. Clonar y entrar
|
|
git clone <repo>
|
|
cd michangarrito
|
|
|
|
# 2. Instalar dependencias
|
|
npm install
|
|
|
|
# 3. Configurar ambiente
|
|
cp .env.example .env
|
|
# Editar .env con tus credenciales
|
|
|
|
# 4. Levantar infraestructura
|
|
docker-compose up -d
|
|
|
|
# 5. Preparar base de datos
|
|
npm run db:setup
|
|
|
|
# 6. Iniciar desarrollo
|
|
npm run dev:all
|
|
```
|
|
|
|
### URLs Desarrollo
|
|
- Web: http://localhost:3140
|
|
- API: http://localhost:3141/api/docs
|
|
- MCP: http://localhost:3142
|
|
- WhatsApp Webhook: http://localhost:3143/webhook/whatsapp
|
|
- Mobile: exp://localhost:8081
|
|
|
|
### Credenciales Externas Necesarias
|
|
- Meta WhatsApp Business API (obtener de Meta Business)
|
|
- Stripe (modo test inicialmente)
|
|
- OpenRouter / OpenAI API Key
|
|
- Firebase (para push notifications)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# ESTADO DE COMPONENTES (2026-01-05)
|
|
# -----------------------------------------------------------------------------
|
|
|
|
componentes_creados:
|
|
database:
|
|
estado: "COMPLETADO"
|
|
descripcion: "29 tablas en 9 schemas"
|
|
archivos:
|
|
schemas: "database/schemas/*.sql"
|
|
seeds: "database/seeds/*.sql"
|
|
tablas_totales: 29
|
|
|
|
backend:
|
|
estado: "COMPLETADO"
|
|
framework: "NestJS 10.x"
|
|
puerto: 3141
|
|
ubicacion: "apps/backend/"
|
|
modulos:
|
|
- nombre: "AuthModule"
|
|
descripcion: "JWT authentication, bcrypt hashing"
|
|
- nombre: "UsersModule"
|
|
descripcion: "User management"
|
|
- nombre: "ProductsModule"
|
|
descripcion: "Product CRUD, categories"
|
|
- nombre: "SalesModule"
|
|
descripcion: "Point of sale operations"
|
|
- nombre: "CustomersModule"
|
|
descripcion: "Customer management, fiado"
|
|
- nombre: "InventoryModule"
|
|
descripcion: "Stock movements, alerts"
|
|
- nombre: "OrdersModule"
|
|
descripcion: "WhatsApp orders management"
|
|
- nombre: "SubscriptionsModule"
|
|
descripcion: "Plans, tokens, billing"
|
|
- nombre: "MessagingModule"
|
|
descripcion: "Conversations, messages"
|
|
|
|
whatsapp_service:
|
|
estado: "COMPLETADO"
|
|
framework: "NestJS 10.x"
|
|
puerto: 3143
|
|
ubicacion: "apps/whatsapp-service/"
|
|
capacidades:
|
|
- "Meta Cloud API integration"
|
|
- "Text, interactive, template messages"
|
|
- "Webhook verification & processing"
|
|
- "LLM-powered message processing"
|
|
- "Business-specific actions (orders, fiado)"
|
|
|
|
mcp_server:
|
|
estado: "COMPLETADO"
|
|
framework: "MCP SDK"
|
|
ubicacion: "apps/mcp-server/"
|
|
tools:
|
|
- "list_products, get_product_details, check_availability"
|
|
- "create_order, get_order_status, update_order_status"
|
|
- "get_fiado_balance, create_fiado, register_payment"
|
|
- "get_customer_info, register_customer"
|
|
- "check_stock, get_low_stock, record_movement"
|
|
|
|
frontend:
|
|
estado: "COMPLETADO"
|
|
framework: "React 18 + Vite + TailwindCSS 4"
|
|
puerto: 3140
|
|
ubicacion: "apps/frontend/"
|
|
paginas:
|
|
- "Dashboard - Stats, recent orders, low stock alerts"
|
|
- "Products - Product catalog with filters"
|
|
- "Orders - Order management with status flow"
|
|
- "Customers - Customer list with stats"
|
|
- "Fiado - Credit management, payments"
|
|
- "Inventory - Stock control, movements"
|
|
- "Settings - Business config, WhatsApp, notifications"
|
|
|
|
mobile:
|
|
estado: "PENDIENTE"
|
|
framework: "React Native (Expo)"
|
|
ubicacion: "apps/mobile/"
|
|
notas: "Por implementar"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# REFERENCIAS
|
|
# -----------------------------------------------------------------------------
|
|
|
|
referencias:
|
|
perfil_devenv: "orchestration/agents/perfiles/PERFIL-DEVENV.md"
|
|
inventario_master: "orchestration/inventarios/DEVENV-MASTER-INVENTORY.yml"
|
|
inventario_puertos: "orchestration/inventarios/DEVENV-PORTS-INVENTORY.yml"
|
|
contexto_proyecto: "orchestration/00-guidelines/CONTEXTO-PROYECTO.md"
|
|
vision_proyecto: "docs/00-vision-general/VISION-PROYECTO.md"
|
|
|
|
# =============================================================================
|
|
# FIN DE INVENTARIO
|
|
# =============================================================================
|