Nevada Inventory System
How I Designed a Multi-Tenant SaaS from Scratch
7,749
Tests
97%
Coverage
80+
Permissions
17
Report Types
The Problem
Businesses managing inventory across multiple warehouses relied on spreadsheets and disconnected tools. They needed real-time visibility, traceability, and role-based access — all in one platform that could scale.
The Approach
I started by mapping the domain: warehouses, products, stock movements, organizations. Each concept became a bounded context. The architecture had to support multi-tenancy from day one — not bolted on later.
Key Decisions
Why Hexagonal Architecture?
The business logic needed to be completely isolated from infrastructure concerns. By using ports and adapters, the domain layer doesn't know about HTTP, databases, or external APIs. This made testing straightforward and refactoring safe.
Why DDD + Screaming Architecture?
The folder structure screams 'inventory management', not 'NestJS app'. Modules are organized by domain concept (products, warehouses, movements), not by technical layer. Any developer opening the codebase immediately understands what it does.
Multi-Tenant Data Isolation
Every query filters by organization. Every endpoint validates tenant ownership. The RBAC system with 80+ granular permissions ensures users only access what they should — down to individual warehouse operations.
VTEX Integration
The system syncs with VTEX for e-commerce order management. Products, orders, and fulfillment flow bidirectionally. This required careful idempotency design to handle retries and webhook failures.
The Build
The backend uses NestJS 11 with Prisma 7 and PostgreSQL. Redis handles caching and rate limiting. The frontend is built with Next.js 16, React 19, and Tailwind CSS 4, following the same hexagonal principles with a BFF (Backend for Frontend) pattern. The system generates 17 types of reports in PDF, Excel, and CSV formats.
The Result
A production SaaS platform with a real paying client, designed to handle 50+ warehouses and 100,000+ products. The backend has 7,749 tests with 97% coverage — not as vanity, but as the confidence to ship features without fear.