feat: Implement Phase 1 & 2 - Full monorepo architecture

## Backend API (apps/api)
- Express.js server with TypeScript
- JWT authentication with access/refresh tokens
- Multi-tenant middleware (schema per tenant)
- Complete CRUD routes: auth, cfdis, transactions, contacts, categories, metrics, alerts
- SAT integration: CFDI 4.0 XML parser, FIEL authentication
- Metrics engine: 50+ financial metrics (Core, Startup, Enterprise)
- Rate limiting, CORS, Helmet security

## Frontend Web (apps/web)
- Next.js 14 with App Router
- Authentication pages: login, register, forgot-password
- Dashboard layout with Sidebar and Header
- Dashboard pages: overview, cash-flow, revenue, expenses, metrics
- Zustand stores for auth and UI state
- Theme support with flash prevention

## Database Package (packages/database)
- PostgreSQL migrations with multi-tenant architecture
- Public schema: plans, tenants, users, sessions, subscriptions
- Tenant schema: sat_credentials, cfdis, transactions, contacts, accounts, alerts
- Tenant management functions
- Seed data for plans and super admin

## Shared Package (packages/shared)
- TypeScript types: auth, tenant, financial, metrics, reports
- Zod validation schemas for all entities
- Utility functions for formatting

## UI Package (packages/ui)
- Chart components: LineChart, BarChart, AreaChart, PieChart
- Data components: DataTable, MetricCard, KPICard, AlertBadge
- PeriodSelector and Skeleton components

## Infrastructure
- Docker Compose: PostgreSQL 15, Redis 7, MinIO, Mailhog
- Makefile with 25+ development commands
- Development scripts: dev-setup.sh, dev-down.sh
- Complete .env.example template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 11:05:24 +00:00
parent c1321c3f0c
commit a9b1994c48
110 changed files with 40788 additions and 0 deletions

82
docker/minio/init.sh Normal file
View File

@@ -0,0 +1,82 @@
#!/bin/sh
# =============================================================================
# Horux Strategy - Script de Inicializacion MinIO
# =============================================================================
# Este script crea los buckets necesarios para el almacenamiento de archivos
# en MinIO (compatible con S3).
#
# Buckets creados:
# - horux-reports: Reportes financieros generados (PDF, Excel)
# - horux-attachments: Adjuntos de documentos (facturas, comprobantes)
# - horux-exports: Exportaciones de datos (CSV, JSON)
# =============================================================================
set -e
echo "============================================="
echo "Horux Strategy - Inicializando MinIO"
echo "============================================="
# Esperar a que MinIO este completamente listo
echo "[1/5] Esperando a que MinIO este listo..."
sleep 5
# Configurar el cliente mc para conectarse a MinIO
echo "[2/5] Configurando cliente MinIO..."
mc alias set horux http://minio:9000 "${MINIO_ROOT_USER}" "${MINIO_ROOT_PASSWORD}"
# Verificar conexion
echo "[3/5] Verificando conexion..."
mc admin info horux
# Crear buckets
echo "[4/5] Creando buckets..."
# Bucket para reportes financieros
# Almacena: PDFs de estados financieros, reportes de KPIs, dashboards exportados
if ! mc ls horux/horux-reports > /dev/null 2>&1; then
mc mb horux/horux-reports
echo " - Bucket 'horux-reports' creado"
else
echo " - Bucket 'horux-reports' ya existe"
fi
# Bucket para adjuntos de documentos
# Almacena: Facturas escaneadas, XMLs del SAT, comprobantes bancarios
if ! mc ls horux/horux-attachments > /dev/null 2>&1; then
mc mb horux/horux-attachments
echo " - Bucket 'horux-attachments' creado"
else
echo " - Bucket 'horux-attachments' ya existe"
fi
# Bucket para exportaciones de datos
# Almacena: Exports de datos en CSV/JSON, backups de configuracion
if ! mc ls horux/horux-exports > /dev/null 2>&1; then
mc mb horux/horux-exports
echo " - Bucket 'horux-exports' creado"
else
echo " - Bucket 'horux-exports' ya existe"
fi
# Configurar politicas de acceso (opcional)
echo "[5/5] Configurando politicas de acceso..."
# Politica de retencion para reportes (30 dias minimo)
# mc ilm add horux/horux-reports --expire-days 365
# Los attachments pueden ser de solo lectura para usuarios
# mc anonymous set download horux/horux-attachments
echo "============================================="
echo "MinIO inicializado correctamente!"
echo "============================================="
echo "Buckets disponibles:"
mc ls horux
echo "============================================="
echo ""
echo "Acceso a la consola web:"
echo " URL: http://localhost:9001"
echo " Usuario: ${MINIO_ROOT_USER}"
echo " Password: ${MINIO_ROOT_PASSWORD}"
echo "============================================="