- Add FIEL controller with upload, status, and delete endpoints
- Add SAT controller with sync start, status, history, and retry
- Add admin endpoints for cron job info and manual execution
- Register new routes in app.ts
- All endpoints protected with authentication middleware
Endpoints added:
- POST /api/fiel/upload
- GET /api/fiel/status
- DELETE /api/fiel
- POST /api/sat/sync
- GET /api/sat/sync/status
- GET /api/sat/sync/history
- GET /api/sat/sync/:id
- POST /api/sat/sync/:id/retry
- GET /api/sat/cron
- POST /api/sat/cron/run
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sat-sync.job.ts with scheduled daily sync at 3:00 AM
- Automatic detection of tenants with active FIEL
- Initial sync (10 years) for new tenants, daily for existing
- Concurrent processing with configurable batch size
- Integration with app startup for production environment
- Install node-cron dependency
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sat.service.ts as the main orchestrator that coordinates:
- FIEL credential retrieval and token management
- SAT download request workflow
- Package processing and CFDI storage
- Progress tracking and job management
- Support for initial sync (10 years history) and daily sync
- Automatic token refresh during long-running syncs
- Month-by-month processing to avoid SAT limits
- Raw SQL queries for multi-tenant schema isolation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sat-parser.service.ts for processing SAT packages:
- Extract XML files from ZIP packages
- Parse CFDI 4.0 XML structure with proper namespace handling
- Extract fiscal data: UUID, amounts, taxes, dates, RFC info
- Map SAT types (I/E/T/P/N) to application types
- Handle IVA and ISR retention calculations
- Install @nodecfdi/cfdi-core dependency
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sat-auth.service.ts for SAML token authentication with SAT
using FIEL credentials and SOAP protocol
- Add sat-download.service.ts with full download workflow:
- Request CFDI download (emitted/received)
- Verify request status with polling support
- Download ZIP packages when ready
- Helper functions for status checking
- Install fast-xml-parser and adm-zip dependencies
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sat-crypto.service.ts with AES-256-GCM encryption for secure
credential storage using JWT_SECRET as key derivation source
- Add fiel.service.ts with complete FIEL lifecycle management:
- Upload and validate FIEL credentials (.cer/.key files)
- Verify certificate is FIEL (not CSD) and not expired
- Store encrypted credentials in database
- Retrieve and decrypt credentials for SAT sync operations
- Install @nodecfdi/credentials for FIEL/CSD handling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Detailed implementation plan with 9 phases:
1. Database models and migrations
2. Cryptography and FIEL services
3. SAT communication services
4. CFDI XML parser
5. Main orchestrator service
6. Scheduled cron job
7. API endpoints
8. Frontend components
9. Testing and validation
Includes:
- 16 new files to create
- 5 files to modify
- Dependencies list
- Implementation order
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Design document for automatic CFDI synchronization with SAT:
- FIEL (e.firma) authentication
- Download emitted and received CFDIs
- Daily automated sync at 3:00 AM
- Initial extraction of last 10 years
- Encrypted credential storage (AES-256-GCM)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add systemd unit files for automatic service startup:
- horux-api.service: API server on port 4000
- horux-web.service: Web frontend on port 3000
Services are configured to:
- Start automatically on boot
- Restart on failure
- Depend on PostgreSQL
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add company logo to login page and all sidebar variants
- Configure Next.js rewrites to proxy /api/* to backend
- Enable external access via Cloudflare Zero Trust tunnel
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Backend:
- Add batch insert using multi-row INSERT with ON CONFLICT
- Process in batches of 500 records for optimal DB performance
- Return detailed batch results (inserted, duplicates, errors)
Frontend:
- Parse files in chunks of 500 to prevent memory issues
- Upload in batches of 200 CFDIs per request
- Add detailed progress bar with real-time stats
- Show upload statistics (loaded, duplicates, errors)
- Add cancel functionality during upload
- Refresh data after upload completes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add bulk XML CFDI upload support (up to 300MB)
- Add period selector component for month/year navigation
- Fix session persistence on page refresh (Zustand hydration)
- Fix income/expense classification based on tenant RFC
- Fix IVA calculation from XML (correct Impuestos element)
- Add error handling to reportes page
- Support multiple CORS origins
- Update reportes service with proper Decimal/BigInt handling
- Add RFC to tenant view store for proper CFDI classification
- Update README with changelog and new features
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tenants API endpoints (list, get, create)
- Add tenant middleware override via X-View-Tenant header
- Add TenantSelector dropdown component in header
- Add tenant view store with persistence
- Add Clientes management page
- Update all navigation layouts with Clientes link for admins
Admins can now:
- View list of all clients
- Create new clients with automatic schema setup
- Switch between viewing different clients' data
- See which client they are currently viewing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Each theme now has a unique layout:
- Light: Standard fixed sidebar
- Vibrant: Horizontal top navigation
- Corporate: Compact sidebar (expands on hover)
- Dark: Floating sidebar with glass effect
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tabs.tsx component
- Add select.tsx component
- Add formatCurrency utility function
- Export new components from index
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add apps/api/src/utils/errors.ts with AppError class
- Fix seed.ts timestamp casting for calendario_fiscal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add navigation items for Reportes, Calendario, Alertas, Usuarios
- Add calendario_fiscal table creation in seed
- Insert demo fiscal events for all 12 months
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- API client with token refresh interceptor
- Auth API functions (login, register, logout, getMe)
- Auth store with Zustand persistence
- Auth layout with centered card design
- Login page with form validation
- Register page with company and user data
- Environment example file
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add complete authentication infrastructure including:
- Password hashing utilities with bcrypt
- JWT token generation and verification
- Auth service with register, login, refresh, and logout
- Auth controller with Zod validation
- Auth middleware for route protection
- Auth routes mounted at /api/auth
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Detailed step-by-step plan covering:
- Monorepo setup with Turborepo + pnpm
- Shared package with types and constants
- Express API with JWT authentication
- Prisma with PostgreSQL multi-tenant (schema per tenant)
- Next.js 14 frontend
- 4-theme system (Light, Vibrant, Corporate, Dark)
- Login/Register pages with auth store
- Demo data seed
- Docker Compose configuration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Complete design document with architecture, data models, and API specs
- Database schema (Prisma) for multi-tenant PostgreSQL
- README with project overview and plans
- Support for 4 visual themes (Light, Vibrant, Corporate, Dark)
- Comprehensive module specifications:
- Dashboard with KPIs
- CFDI management
- IVA/ISR tax control
- Bank reconciliation
- Fiscal calendar
- User management with roles
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>