## 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>
174 lines
5.6 KiB
Plaintext
174 lines
5.6 KiB
Plaintext
# =============================================================================
|
|
# Horux Strategy - Variables de Entorno
|
|
# =============================================================================
|
|
# Copia este archivo a .env y configura los valores segun tu entorno.
|
|
#
|
|
# IMPORTANTE: Nunca subas el archivo .env a control de versiones.
|
|
# Contiene secretos y credenciales sensibles.
|
|
# =============================================================================
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Entorno
|
|
# -----------------------------------------------------------------------------
|
|
NODE_ENV=development
|
|
APP_NAME=HoruxStrategy
|
|
APP_VERSION=0.1.0
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# URLs de la aplicacion
|
|
# -----------------------------------------------------------------------------
|
|
# URL base del frontend (Next.js)
|
|
APP_URL=http://localhost:3000
|
|
|
|
# URL base del API (Express)
|
|
API_URL=http://localhost:4000
|
|
|
|
# Puerto del servidor API
|
|
API_PORT=4000
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Base de datos PostgreSQL
|
|
# -----------------------------------------------------------------------------
|
|
# Formato: postgresql://usuario:password@host:puerto/database
|
|
DATABASE_URL=postgresql://horux:horux_secret_2024@localhost:5432/horux_strategy
|
|
|
|
# Configuracion individual (alternativa a DATABASE_URL)
|
|
POSTGRES_HOST=localhost
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_USER=horux
|
|
POSTGRES_PASSWORD=horux_secret_2024
|
|
POSTGRES_DB=horux_strategy
|
|
|
|
# Usuario de aplicacion (con permisos limitados)
|
|
POSTGRES_APP_USER=horux_app
|
|
POSTGRES_APP_PASSWORD=horux_app_secret
|
|
|
|
# Pool de conexiones
|
|
DATABASE_POOL_MIN=2
|
|
DATABASE_POOL_MAX=10
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Redis
|
|
# -----------------------------------------------------------------------------
|
|
# Formato: redis://[:password@]host:puerto[/database]
|
|
REDIS_URL=redis://localhost:6379/0
|
|
|
|
# Configuracion individual
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=
|
|
REDIS_DB=0
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# MinIO (Almacenamiento S3-compatible)
|
|
# -----------------------------------------------------------------------------
|
|
MINIO_ENDPOINT=localhost
|
|
MINIO_PORT=9000
|
|
MINIO_USE_SSL=false
|
|
MINIO_ACCESS_KEY=horux_minio
|
|
MINIO_SECRET_KEY=horux_minio_secret
|
|
|
|
# Nombres de buckets
|
|
MINIO_BUCKET_REPORTS=horux-reports
|
|
MINIO_BUCKET_ATTACHMENTS=horux-attachments
|
|
MINIO_BUCKET_EXPORTS=horux-exports
|
|
|
|
# Configuracion de consola MinIO
|
|
MINIO_CONSOLE_PORT=9001
|
|
MINIO_ROOT_USER=horux_minio
|
|
MINIO_ROOT_PASSWORD=horux_minio_secret
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Autenticacion JWT
|
|
# -----------------------------------------------------------------------------
|
|
# Secreto para tokens de acceso (genera uno seguro en produccion)
|
|
# Puedes generar uno con: openssl rand -base64 64
|
|
JWT_SECRET=horux_jwt_secret_change_in_production_abc123xyz
|
|
|
|
# Secreto para refresh tokens (diferente al de acceso)
|
|
JWT_REFRESH_SECRET=horux_refresh_secret_change_in_production_xyz789abc
|
|
|
|
# Tiempo de expiracion de tokens
|
|
JWT_ACCESS_EXPIRES_IN=15m
|
|
JWT_REFRESH_EXPIRES_IN=7d
|
|
|
|
# Algoritmo de firma
|
|
JWT_ALGORITHM=HS256
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# DeepSeek AI (Asistente financiero)
|
|
# -----------------------------------------------------------------------------
|
|
# API Key de DeepSeek para el CFO digital
|
|
DEEPSEEK_API_KEY=your_deepseek_api_key_here
|
|
DEEPSEEK_BASE_URL=https://api.deepseek.com
|
|
DEEPSEEK_MODEL=deepseek-chat
|
|
|
|
# Configuracion de rate limiting para AI
|
|
AI_RATE_LIMIT_REQUESTS=100
|
|
AI_RATE_LIMIT_WINDOW_MS=60000
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Email (SMTP)
|
|
# -----------------------------------------------------------------------------
|
|
# En desarrollo usamos Mailhog (no envia emails reales)
|
|
SMTP_HOST=localhost
|
|
SMTP_PORT=1025
|
|
SMTP_SECURE=false
|
|
SMTP_USER=
|
|
SMTP_PASSWORD=
|
|
|
|
# Configuracion de emails
|
|
EMAIL_FROM_NAME=Horux Strategy
|
|
EMAIL_FROM_ADDRESS=noreply@horuxstrategy.com
|
|
|
|
# URL de Mailhog UI (solo desarrollo)
|
|
MAILHOG_UI_PORT=8025
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Seguridad
|
|
# -----------------------------------------------------------------------------
|
|
# Secreto para encriptar datos sensibles
|
|
ENCRYPTION_KEY=32_character_encryption_key_here
|
|
|
|
# Configuracion de CORS
|
|
CORS_ORIGIN=http://localhost:3000
|
|
|
|
# Rate limiting global
|
|
RATE_LIMIT_WINDOW_MS=900000
|
|
RATE_LIMIT_MAX_REQUESTS=100
|
|
|
|
# Configuracion de cookies
|
|
COOKIE_SECURE=false
|
|
COOKIE_SAME_SITE=lax
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Logging
|
|
# -----------------------------------------------------------------------------
|
|
LOG_LEVEL=debug
|
|
LOG_FORMAT=pretty
|
|
|
|
# Sentry (opcional - para monitoreo de errores)
|
|
SENTRY_DSN=
|
|
SENTRY_ENVIRONMENT=development
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Feature Flags (desarrollo)
|
|
# -----------------------------------------------------------------------------
|
|
FEATURE_AI_ASSISTANT=true
|
|
FEATURE_MULTI_COMPANY=true
|
|
FEATURE_SAT_INTEGRATION=false
|
|
FEATURE_BANKING_INTEGRATION=false
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Integraciones externas (para futuro)
|
|
# -----------------------------------------------------------------------------
|
|
# SAT (Servicio de Administracion Tributaria)
|
|
SAT_API_URL=
|
|
SAT_CERTIFICATE_PATH=
|
|
SAT_PRIVATE_KEY_PATH=
|
|
|
|
# Bancos (Open Banking)
|
|
BANKING_API_URL=
|
|
BANKING_CLIENT_ID=
|
|
BANKING_CLIENT_SECRET=
|