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 <noreply@anthropic.com>
This commit is contained in:
Adrian Flores Cortes 2026-01-25 09:51:22 -06:00
commit 2f76d541d2
3 changed files with 143 additions and 0 deletions

54
.env.example Normal file
View File

@ -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

60
package.json Normal file
View File

@ -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"
}

29
tsconfig.json Normal file
View File

@ -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"]
}