From 2f76d541d25bd67ae71fcc3d5e29067a97b7c371 Mon Sep 17 00:00:00 2001 From: Adrian Flores Cortes Date: Sun, 25 Jan 2026 09:51:22 -0600 Subject: [PATCH] feat: Initial backend structure for ERP Transportistas - NestJS 10.x configuration - TypeScript setup with path aliases - Environment configuration template - Integration config for GPS, PAC, Maps Co-Authored-By: Claude Opus 4.5 --- .env.example | 54 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ tsconfig.json | 29 +++++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 .env.example create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6da9c9e --- /dev/null +++ b/.env.example @@ -0,0 +1,54 @@ +# ============================================================================= +# ERP Transportistas - Variables de Entorno +# ============================================================================= + +# Server +NODE_ENV=development +PORT=3014 +API_PREFIX=/api/v1 + +# Database +DB_HOST=localhost +DB_PORT=5432 +DB_NAME=erp_transportistas_db +DB_USER=erp_admin +DB_PASSWORD=erp_dev_2026 + +# Redis +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_DB=10 + +# JWT +JWT_SECRET=your-super-secret-jwt-key-change-in-production +JWT_EXPIRES_IN=24h +JWT_REFRESH_EXPIRES_IN=7d + +# Logging +LOG_LEVEL=debug + +# CORS +CORS_ORIGIN=http://localhost:5174,http://localhost:3000 + +# ============================================================================= +# Integraciones Transporte +# ============================================================================= + +# PAC (Proveedor de Timbrado CFDI) +PAC_URL=https://api.pac-ejemplo.com +PAC_USER=usuario_pac +PAC_PASSWORD=password_pac +PAC_RFC=RFC_EMPRESA + +# GPS/Telematica +GPS_PROVIDER_URL=https://api.gps-provider.com +GPS_API_KEY=your-gps-api-key + +# Mapas (Google Maps / HERE / OpenRouteService) +MAPS_API_KEY=your-maps-api-key +MAPS_PROVIDER=google # google | here | openroute + +# WhatsApp Business +WHATSAPP_API_URL=https://graph.facebook.com +WHATSAPP_TOKEN=your-whatsapp-token +WHATSAPP_PHONE_ID=your-phone-id diff --git a/package.json b/package.json new file mode 100644 index 0000000..a5f3517 --- /dev/null +++ b/package.json @@ -0,0 +1,60 @@ +{ + "name": "@erp-transportistas/backend", + "version": "1.0.0", + "description": "Backend API para ERP Transportistas - Vertical de transporte de carga y logistica", + "main": "dist/index.js", + "scripts": { + "dev": "tsx watch src/index.ts", + "build": "tsc", + "start": "node dist/index.js", + "lint": "eslint src --ext .ts", + "lint:fix": "eslint src --ext .ts --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "express": "^4.18.2", + "typeorm": "^0.3.28", + "pg": "^8.11.3", + "ioredis": "^5.8.2", + "jsonwebtoken": "^9.0.2", + "bcryptjs": "^2.4.3", + "helmet": "^7.1.0", + "cors": "^2.8.5", + "compression": "^1.7.4", + "morgan": "^1.10.0", + "swagger-ui-express": "^5.0.1", + "class-validator": "^0.14.0", + "class-transformer": "^0.5.1", + "uuid": "^9.0.0", + "date-fns": "^2.30.0", + "xml2js": "^0.6.2" + }, + "devDependencies": { + "@types/express": "^4.17.21", + "@types/node": "^20.10.0", + "@types/jsonwebtoken": "^9.0.5", + "@types/bcryptjs": "^2.4.6", + "@types/cors": "^2.8.17", + "@types/compression": "^1.7.5", + "@types/morgan": "^1.9.9", + "@types/swagger-ui-express": "^4.1.6", + "@types/uuid": "^9.0.7", + "@types/xml2js": "^0.4.14", + "typescript": "^5.3.2", + "tsx": "^4.6.0", + "eslint": "^8.54.0", + "@typescript-eslint/eslint-plugin": "^6.12.0", + "@typescript-eslint/parser": "^6.12.0", + "jest": "^29.7.0", + "@types/jest": "^29.5.10", + "ts-jest": "^29.1.1" + }, + "engines": { + "node": ">=20.0.0" + }, + "author": "ISEM", + "license": "PROPRIETARY" +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..261ede9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2022"], + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "baseUrl": "./src", + "paths": { + "@config/*": ["config/*"], + "@modules/*": ["modules/*"], + "@shared/*": ["shared/*"], + "@routes/*": ["routes/*"] + } + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "**/*.test.ts"] +}