# Introduction: Logistics Complexity
VertS-app is an internal SaaS application designed specifically to orchestrate deep operational logistics. In the world of cargo and parcel management, maintaining control from the moment a pre-alert enters the system until the merchandise is delivered is a critical challenge that traditional software rarely solves in an integrated and agile way.
Daily operations include multiple actors: managed client companies, logistics providers with dynamic rates, and warehouse staff. The system had to consolidate all of this into a fast, highly reactive, and reliable dashboard.
The Challenge: Replace spreadsheets, decentralized emails, and manual processes with a centralized tool capable of managing multi-tenant architectures, complex pricing logic, strict parcel tracking, and financial reconciliation (invoices, supplier costs).
The Goal: Build a modular ERP with Next.js 14 using Supabase to enable real-time reporting, advanced role-based security (RLS), and a UX designed for fast flows like mass merchandise reception.
# Core Modules: The Ecosystem
The application is structured into secure, role-based modules accessible from the main dashboard. Each module resolves a specific operational friction:
# Architecture & Tech Stack
On the client side, the app leverages the Next.js App Router for fast, hybrid rendering. Interfaces are built with Tailwind CSS and Radix UI components (via Shadcn/UI), ensuring accessibility alongside a modern iterative design. Complex forms are cleanly managed with React Hook Form paired with Zod validations.
The backend heavily relies on Supabase (PostgreSQL). All core storage, authentication, and authorization logic operate at the database layer through Row Level Security (RLS). This radically simplifies the frontend by offloading data filtering: the database intrinsically knows who is asking and what they are allowed to read/write.
# Multi-tenant Security & RLS
Applications of this nature require strict data isolation across client companies and user tiers natively. We employ a relational schema where each entity rolls up to master accounts and every core table has strict native constraints.
Profiles & Roles
Auth Users -> Profiles Table
Integration atop native auth for bespoke role handling.
SecureRow Level Security
Policy: auth.uid() = user_id
All PostgreSQL queries filter rows natively by user/tenant.
UnbreakableStorage Buckets
File Level Policies
ID Images, Invoices, and PDFs are protected in RLS buckets.
PrivateBy leveraging native DB capabilities, the application bypasses common backend-layer injection vulnerabilities and scales authorization logically without rewriting API permission logic every time a new feature module is added.
A Glimpse into Server Actions
An example of how the application integrates fluidly natively into Next.js Server Components. Observe the secure auth checks and how the profile implicitly forces the database row insertions to protect the 'tenant' (empresa) boundaries without trusting the client.
# Infrastructure & Setup
Configuration, deployment, and contribution workflows are sharply standardized:
- Vercel Deployment: Edge-ready CI/CD integration. Zero-config pushes right from the repo.
- Database Flow: Migrations and schema pushes handled uniformly via Supabase CLI toolchains.
- Environment Vars: Isolated client vs server secrets via Anonymous Anon Keys and Service Roles.