HomeWorkLaboratoryCertificationsBlogLet's Talk

© 2026 Juan Villegas. All rights reserved.

Solutions Architect

    Back

    Multi-Branch Purchase Management — API

    API — business engine

    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.

    Code

    Tech Stack

    Backend

    NestJSMongoose

    Database

    MongoDB

    Infrastructure

    DockerTraefik

    What it protects in production

    • Administrative server access restricted to a private network, never directly exposed to the Internet.
    • Remote access protected with separate layers: distinct identity by role and active defense against brute force attempts.
    • Firewall with default deny policy, only what is strictly necessary enabled.

    Infrastructure in production

    • Complete production infrastructure managed by the developer, from the domain to the VPS, with periodic server maintenance approximately every two months.

    How it's deployed

    Offline-first PWA (Next.js)
    Traefik (reverse proxy + automatic TLS)
    Docker container (NestJS API)
    MongoDB
    React Flow
    Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
    Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
    ShareLinkedIn

    Need something similar?

    Let's talk about your project.

    Let's talk