Multi-Branch Purchase Management — API
NestJS + MongoDB backend of the multi-branch purchasing system for a hardware store in Mexico: business engine with order state flow, deliberate denormalization of the data model, and automatic Excel reports by email. It also includes the real hardening of the production server where it runs: VPN, restrictive firewall, and brute force protection.
Infrastructure & Backend
The Challenge
Centralize the purchasing flow to suppliers (creation, partial receipt, reporting) in a single reliable API, with data that a historical order retains as it was at the time of creation, not as it is today.
The Solution
Order as the central entity with a state flow (pending → partial receipt via PATCH /review → completed/cancelled), automatic invoice code generation, deliberate denormalization of the data model, and Excel report generation with automatic email sending.
Related project
Gestión de Compras Multisucursal
Role in the project
Solutions Architect and Full Stack Dev.