System Overview
Table of Contents
- Business Objective
- The Three Pillars
- Complete Functional Scope
- User Roles and Permissions (RBAC)
- Backend API Modules
- Admin Panel Modules
- Frontend Features (Web Store)
- Technology Stack
- System Architecture
Business Objective
This is an Enterprise-grade e-commerce platform designed to manage both physical (POS) and online sales for multi-branch retail businesses. The system is a complete ecosystem of three integrated applications functioning as a Web-based Mini-ERP.
Key Business Problems Solved
| Problem | Implemented Solution |
|---|---|
| Stock overselling | Atomic database transactions + reservation system with configurable TTL |
| Abandoned carts blocking inventory | Cron Job that releases expired reservations and auto-cancels PENDING sales |
| Cart price fraud | Backend recalculates ALL prices, discounts, taxes and shipping from scratch. The frontend is a "lying client" |
| Physical vs online sales inconsistency | "Physical Priority" system: POS sales can override online reservations |
| International operation | Multi-currency engine with automatic Geo-IP, local currency pricing and exchange rate snapshots per transaction |
| Traceability and auditing | Immutable log of every stock movement, every admin action and every system error |
| Scalability | Validated for 100+ concurrent users, 500+ active carts, with concurrency control and idempotency |
The Three Pillars
1. Backend API (Node.js + Express + PostgreSQL)
Central REST API server handling all business logic, database operations, external integrations and real-time WebSocket communications.
- 42 specialized services (sale, stock, currency, discount, event, backup, etc.)
- 32 REST endpoint controllers
- Automated Cron Jobs (backups, expired reservation cleanup)
- WebSocket (Socket.IO) for real-time chat and notifications
2. Admin Panel (Next.js + React + TypeScript)
Complete administrative dashboard with 31 pages for staff to manage the entire platform without needing a programmer.
3. Customer Web / Frontend (Next.js + TailwindCSS)
Customer-facing e-commerce application with 21 pages, premium design with advanced animations, and complete shopping experience.
Complete Functional Scope
🏢 Multi-Branch Management
- ✅ Support for multiple physical branches with independent inventory per branch.
- ✅ Branches are created, edited and deactivated from the admin panel.
- ✅ Each employee can be assigned to a specific branch.
- ✅ POS sales are processed in the context of the operator's active branch.
- ✅ Dashboard and reports filterable by branch.
💱 Multi-Currency & Internationalization
- ✅ Dynamic currency engine: Support for 20+ currencies (ARS, USD, EUR, MXN, BRL, CLP, COP, GBP, etc.).
- ✅ Automatic Geo-IP detection: Uses headers to determine visitor currency.
- ✅ Conversion rule: Local client → configured base currency. Foreign client → USD automatically.
- ✅ Configurable exchange rates:
exchangeRateToBasedefined per currency from the admin panel. - ✅ Smart PriceService: First looks for a manual price per currency (
ProductPrice), if none exists, convertsbasePriceusing the exchange rate. - ✅ Immutable snapshot: When creating a sale, a "photograph" of the exact exchange rate at the time of transaction is saved. If the dollar changes tomorrow, historical accounting is never altered.
- ✅ Conditional taxes: Only applied if the buyer is from the country of origin (validated by IP).
📊 Audit & Action Logging
- ✅ AuditService: Centralized log of ALL administrative actions: who, what, when, from which IP and technical diff of changes.
- ✅ Error logging (
ErrorLog): Every server error is saved with severity (CRITICAL, HIGH, MEDIUM, LOW), stack trace, JSON context and reference to affected user. - ✅ Immutable StockMovement: Every stock movement (sale, purchase, transfer, manual adjustment) is logged with type, quantity, resulting stock and responsible user.
- ✅ Exploration panel: Integrated search with filters by administrator, action type and date range.
🚨 Alert System
- ✅ Paginated list of server technical errors (ErrorLog).
- ✅ Filters by severity (CRITICAL, HIGH, MEDIUM, LOW) and date range.
- ✅ Detail dialog with stack trace and JSON context visualization.
- ✅ "Resolve" action for incident tracking.
- ✅ Low stock and critical stock alerts (configurable thresholds).
🔔 Notification System
- ✅ Real-time notifications via WebSocket (Socket.IO).
- ✅ Notification center in admin panel with bell icon, unread badge and history.
- ✅ Email notifications: Order confirmation, password reset, welcome.
- ✅ InAppNotificationService: Persistent database notifications with read states.
👥 Role System (RBAC)
- ✅ 4 hierarchical roles: SUPER_ADMIN > ADMIN > EMPLOYEE > CLIENT.
- ✅ Granular access control on every backend endpoint (
authorizemiddleware). - ✅ SUPER_ADMIN: Full access, system configuration, cannot be deleted.
- ✅ ADMIN: Manages products, sales, stock, discounts, suppliers. Cannot create other ADMINs.
- ✅ EMPLOYEE: Operates POS, views inventory, handles chat. Cannot modify products or prices.
- ✅ CLIENT: Browses, shops, manages profile and favorites. No admin panel access.
📦 Product Management with Variants
- ✅ Product-SKU model: Each base product can have multiple variants (SKUs) with attribute combinations (size, color, material, etc.).
- ✅ Each SKU has its own stock, price, barcode and internal code.
- ✅ Dynamic variant options (
VariantOption): Free-form name and value (e.g.: "Color: Red", "Size: 42"). - ✅ Visibility flags:
isTrending,isRecommended,isNewfor featured sections. - ✅ Differentiation between physical and digital products.
- ✅ Multiple image uploads via Cloudinary.
- ✅ Hierarchical categories (parent-child) with SEO metadata.
📊 Stock Management
- ✅ Inventory per branch (
BranchInventory): Each SKU has independent stock per branch. - ✅ Manual stock adjustments with automatic
StockMovementlogging. - ✅ Physical Priority: POS sales can override online purchase reservations.
- ✅ Web safety stock: When stock drops to a certain level, the product is hidden from the frontend to prioritize in-store sales.
- ✅ Low and critical stock alerts with configurable thresholds.
- ✅ Configurable overselling prevention.
🔄 Inter-Branch Stock Transfers
- ✅ Create transfer with source and destination branch.
- ✅ Add items (SKU + quantity).
- ✅ Status flow: PENDING → COMPLETED.
- ✅ Automatic stock adjustment in both branches upon receipt.
- ✅
StockMovementlogged asTRANSFER_OUTandTRANSFER_IN. - ✅ Full audit trail for each transfer.
📈 Dashboard & Reports
- ✅ Real-time dashboard: KPIs (Gross revenue, order count, average ticket).
- ✅ Interactive charts with Recharts (sales by day/week/month).
- ✅ Low stock alerts visible on dashboard.
- ✅ Exportable reports: Sales by date/branch/employee, top-selling products, inventory valuation, movement history.
- ✅ PDF and CSV export of tables and data.
- ✅ Employee performance (number of sales processed).
🏭 Suppliers, Purchase Orders & Payments
- ✅ Supplier CRUD: Name, email, phone, address, notes.
- ✅ SKU-Supplier linking: Each SKU can have an assigned supplier with cost price (
SupplierSKU). - ✅ Purchase orders: Create PO with supplier selection → add items (SKU + quantity + cost) → flow PENDING → PAID → RECEIVED.
- ✅ Merchandise reception: When marking a PO as received, stock is automatically incremented in the selected branch with
StockMovementtypePURCHASE. - ✅ Supplier payments: Partial or full payment tracking with pending balance.
- ✅ Purchase and payment history per supplier.
🛒 Advanced Sales Management
- ✅ Point of Sale (POS): Search by name/barcode scanner, variant selection, automatic discounts, multiple payment methods.
- ✅ Multi-step online checkout: Identification → Delivery (shipping or pickup) → Payment (MercadoPago, Stripe, PayPal) → Confirmation.
- ✅ Idempotency: Prevents duplicate sales by checking if a similar sale was created recently.
- ✅ Controlled concurrency: Atomic Prisma transactions (
$transaction) for stock reservations. The system deducts stock within the same transaction that creates the sale, eliminating race conditions. - ✅ TTL reservations: Stock is temporarily reserved; if payment is not completed,
StockCleanupServicereleases units automatically. - ✅ Automatic cleanup:
cleanupAbandonedSales()finds PENDING sales older than 1 hour and cancels them, releasing reservations and reverting stock. - ✅ Status flow: PENDING → CONFIRMED → SHIPPED → DELIVERED / CANCELLED.
- ✅ Shipping status updates (PREPARING, SHIPPED, DELIVERED).
🧾 Invoice & Ticket Printing
- ✅ PDF invoice generation with PDFKit: Includes business data, detailed items, discounts, taxes and totals.
- ✅ 80mm thermal ticket: Optimized format for point-of-sale thermal printers.
- ✅ Invoice download from customer purchase history and admin panel.
- ✅ Automatic invoice generation on sale confirmation (configurable).
📱 QR & Barcode
- ✅ QR code per product (
qrfield in Product model). - ✅ Barcode per SKU (
barcodefield in SKU model). - ✅ Bulk PDF export:
code-exportcontroller generates a PDF with label grid (3x7 = 21 per page) usingbwip-js. - ✅ Support for QR Code and Code128 formats.
- ✅ Filters: export all, by category or by manual selection.
👤 Advanced User Management
- ✅ List users with role filter, search and pagination.
- ✅ Change user roles (requires permissions).
- ✅ Suspend/reactivate accounts.
- ✅ View user purchase history.
- ✅ Assign users to branches.
- ✅ Side panel user details without losing context.
🏷️ Advanced Product & Category Management
- ✅ Complete product form with images, variants (SKUs), prices, stock per branch.
- ✅ Hierarchical categories with parent-child relationships (tree).
- ✅ Icon assignment and SEO metadata per category.
- ✅ Visibility flags: trending, recommended, new.
- ✅ Bulk stock operations.
🎫 Coupons & Discounts
- ✅ Coupons: Alphanumeric code (e.g.: "SUMMER2026"), PERCENTAGE or FIXED type, with restrictions: minimum amount, max uses per customer, total max uses, expiration date.
- ✅ Discounts: By product, by category, global, by payment method, by minimum quantity, by minimum amount.
- ✅ Priority system: Product > Category > Global.
- ✅ Stackable vs non-stackable: Control whether discounts combine.
- ✅ Overlap protection: System validates that total discount sum doesn't exceed 100%.
🎪 Event System
- ✅ Temporary events with start and end dates that override standard system configuration.
- ✅ An event can modify: which payment methods are enabled, which shipping methods, whether coupons are accepted, whether points apply, whether taxes are collected.
- ✅ Custom visual content: Each event can have its own hero banners, marquee text, secondary ads and promotional messages.
- ✅ Event-specific discounts: Discounts linked to an event have priority over standard discounts.
- ✅ Single active event rule: Only one event can be active at a time (others are automatically deactivated).
🚚 Shipping by City/State
- ✅ Configurable shipping zones: Create zones (e.g.: "Downtown", "South Zone", "Interior") with base cost.
- ✅ Optional weight-based pricing levels.
- ✅ Configurable free shipping threshold.
- ✅ Enable/disable shipping globally.
- ✅ Zone selection at checkout with automatic cost calculation.
💳 Payment Gateways
- ✅ Payment Factory Pattern:
PaymentFactorydynamically delegates toMercadoPagoStrategy,PayPalStrategyorStripeStrategy. - ✅ Enable/disable each gateway from panel configuration.
- ✅ Secure webhooks: Endpoints reacting to asynchronous notifications from gateways to mutate states automatically.
- ✅ Support for cash, card and bank transfer payments.
- ✅ Currency association management per gateway from the Gateways settings page.
💬 Comments & Reviews Management
- ✅ Customers can leave product reviews with rating scores.
- ✅ Comment management panel in admin.
- ✅ Comment moderation.
⭐ Loyalty Points System
- ✅ Configurable earn rate: How many points are earned per currency unit spent.
- ✅ Configurable redemption rate: Monetary value of 1 point.
- ✅ Checkout redemption: Customers can use points as partial or full discount.
- ✅ Automatic granting:
processPostPaymentActionsgrants points only after the sale is fully paid. - ✅ Points movement history visible in customer profile.
- ✅ Global toggles to enable/disable the entire system.
📐 Measurement Unit System
- ✅
measurementUnitfield on Product model: supports "UNIT", "KG", "METER", "LITER" and more. - ✅
allowFractionalflag for products sold by weight or measure (allows quantities like 0.5, 1.75). - ✅ Customizable units from system configuration.
🎨 Web Content Editing (CMS)
- ✅ Promotional banners: Hero banner management with images and text.
- ✅ Secondary ads: Configurable advertising slots.
- ✅ Marquee text: Customizable scrolling ribbon at the top of the web store.
- ✅ Store logo: Corporate logo upload and management.
- ✅ Blog: SEO-friendly articles with full editor, managed from admin panel.
- ✅ Business hours: Standardized for each day of the week.
💬 Real-Time Chat System
- ✅ Customer-admin chat: Bidirectional WebSocket (Socket.IO) between frontend and admin panel.
- ✅ Zendesk-style CX Inbox: Administrators and employees see an inbox of incoming chats with history.
- ✅ Presence detection: System detects if an administrator or employee is online. If nobody is available, the automatic bot responds.
- ✅ Manageable auto-responses: Auto-responses of the chatbot can be configured from the panel (triggers, responses, priorities).
📝 Blog Management
- ✅ Blog article CRUD from admin panel.
- ✅ Public blog on frontend with magazine-style design.
- ✅ SEO-friendly: titles, meta descriptions, friendly URLs.
📥 Table & PDF Downloads
- ✅ Table export: CSV data download from admin panel listings.
- ✅ PDF generation: Invoices, tickets, sales reports, barcode/QR labels.
- ✅ Report export: Financial, inventory, stock movements.
💾 Automatic Database Backups
- ✅ BackupService: Extracts all database tables to JSON format and compresses into a ZIP file.
- ✅ Configurable Cron Job: Runs daily at 02:00 AM and checks configured frequency (DAILY, WEEKLY, MONTHLY).
- ✅ Manual backup: Endpoint to generate and download a backup ZIP on demand.
- ✅ Enable/disable automatic backups from system configuration.
⚙️ System Configuration
- ✅ Business identity: Name, email, phone, address, social media.
- ✅ Business hours per day of the week.
- ✅ Measurement units: Customizable ("Kg", "Mts", "Packs", etc.).
- ✅ Payment methods: Enable/disable cash, card, transfer, MercadoPago, PayPal, Stripe.
- ✅ Base currency and USD exchange rate.
- ✅ Taxes: Configurable global rate (e.g.: 21%).
- ✅ Shipping: Enable/disable, free shipping threshold, shipping zones.
- ✅ Loyalty points: Enable/disable, earn and redemption rates.
- ✅ Branches: Enable/disable multi-branch support.
- ✅ Stock control: Low and critical stock thresholds, overselling prevention, web safety stock.
- ✅ Maintenance mode: Global switch that blocks public store access with custom page.
🛒 Point of Sale (POS) - Concurrency System
- ✅ Atomic transactions:
prisma.$transaction()ensures stock reservation and sale creation occur in the same database transaction, eliminating race conditions. - ✅ Idempotency:
findRecentDuplicate()checks if an identical sale was created in the last few minutes, preventing duplicates from double-clicks or repeated submissions. - ✅ Physical Priority: POS sales can force stock deduction even if there are online reservations, ensuring a cashier can never be blocked from selling.
- ✅ TTL reservations: Stock is temporarily reserved; if payment isn't completed,
StockCleanupServiceautomatically releases the units. - ✅ Automatic cleanup:
cleanupAbandonedSales()finds PENDING sales older than 1 hour and cancels them, releasing reservations and reverting stock. - ✅ Bidirectional validation: Even though the frontend sends prices, the backend ignores them and recalculates everything (prices, discounts, taxes, shipping) from scratch, eliminating any possibility of fraud.
User Roles and Permissions (RBAC)
| Role | Access | Main Capabilities |
|---|---|---|
| SUPER_ADMIN | Full | System configuration, all user management, audit logs, security. Cannot be deleted. |
| ADMIN | High | Products, sales, stock, discounts, suppliers, reports. Cannot create other ADMINs. |
| EMPLOYEE | Limited | POS, view inventory, handle chat. Cannot modify products or prices. |
| CLIENT | Basic | Browse, shop, profile, favorites, points. No admin panel access. |
Permission Matrix
| Module | SUPER_ADMIN | ADMIN | EMPLOYEE | CLIENT |
|---|---|---|---|---|
| Dashboard | ✅ | ✅ | ✅ | ❌ |
| Products / Categories | ✅ | ✅ | ❌ | ❌ |
| Sales (History) | ✅ | ✅ | ✅ | ❌ |
| Point of Sale (POS) | ✅ | ✅ | ✅ | ❌ |
| Inventory / Stock | ✅ | ✅ | ❌ | ❌ |
| Transfers | ✅ | ✅ | ❌ | ❌ |
| Purchases | ✅ | ✅ | ❌ | ❌ |
| Suppliers / Payments | ✅ | ✅ | ❌ | ❌ |
| Discounts / Coupons | ✅ | ✅ | ❌ | ❌ |
| Promotional Events | ✅ | ✅ | ❌ | ❌ |
| Shipping | ✅ | ✅ | ❌ | ❌ |
| Users | ✅ | ✅ | ❌ | ❌ |
| Reports | ✅ | ✅ | ❌ | ❌ |
| Web Content (CMS) | ✅ | ✅ | ✅ | ❌ |
| Chat / Support | ✅ | ✅ | ✅ | ❌ |
| System Alerts | ✅ | ✅ | ❌ | ❌ |
| Audit | ✅ | ✅ | ❌ | ❌ |
| Currencies / Gateways | ✅ | ❌ | ❌ | ❌ |
| General Settings | ✅ | ❌ | ❌ | ❌ |
Backend API Modules
Core Services (42 services)
| Service | Purpose |
|---|---|
sale.service.js | Complete sales processing (1198 lines): idempotency, reservations, checkout, cleanup |
price.service.js | Multi-currency price resolution (manual → automatic conversion) |
currency.service.js | Multi-currency engine with Geo-IP (20+ currencies) |
discount.service.js | Discount engine with priorities and stacking rules |
event.service.js | Temporary events that override system configuration |
stock-movement.service.js | Immutable stock movement log |
stock-transfer.service.js | Inter-branch transfers |
stock-cleanup.service.js | Expired reservation cleanup |
payment.service.js + strategies | Factory Pattern for MercadoPago, PayPal, Stripe |
payment-webhook.service.js | Asynchronous gateway webhook processing |
invoice.service.js | PDF invoice generation |
backup.service.js | Full database ZIP backups |
audit.service.js | Administrative action logging |
logger.service.js | Error logging with severity levels |
blog.service.js | Blog article management |
chat.service.js | Real-time chat system |
in-app-notification.service.js | Persistent DB notifications |
notification.service.js | Email notifications |
coupon.service.js | Coupon management and validation |
shipping.service.js | Zone-based shipping cost calculation |
purchase.service.js | Supplier purchase orders |
supplier.service.js | Supplier management |
supplier-payment.service.js | Supplier payments |
report.service.js | Report generation |
cart.service.js | Server-side cart management |
branch.service.js | Branch management |
upload.service.js | Cloudinary file uploads |
category.service.js | Hierarchical categories |
product.service.js | Product CRUD |
sku.service.js | Variant management (SKUs) |
comment.service.js | Reviews and comments |
user.service.js | User management |
auth.service.js | JWT authentication with refresh tokens |
Special Controllers
| Controller | Purpose |
|---|---|
code-export.controller.js | Bulk QR and barcode export to PDF (bwip-js) |
webhook.controller.js | MercadoPago/Stripe/PayPal webhook reception |
auto-response.controller.js | Chatbot auto-response CRUD |
system.controller.js | Health checks and system status |
Cron Jobs
| Cron | Frequency | Function |
|---|---|---|
backup.cron.js | Daily 02:00 AM | Checks config (DAILY/WEEKLY/MONTHLY) and executes backup ZIP |
| Stock Cleanup | Periodic | Releases expired reservations and cancels abandoned sales |
Admin Panel Modules
31 Pages Organized by Section
Operations
/management- Dashboard with real-time KPIs/sales- Point of Sale (POS) with search and scanner/management/sales- Sales history with filters and details/management/stock-control- Inventory control per branch/management/transfers- Inter-branch stock transfers/management/purchases- Supplier purchase orders/management/supplier-payments- Supplier payments
Catalog
/management/products- Product listing and management/management/products/[id]- Product detail and editing with SKUs/management/categories- Hierarchical category tree/management/suppliers- Supplier management
Commercial
/management/discounts- Discount engine with rules/management/coupons- Coupon management/management/events- Temporary promotional events/management/shipping- Shipping zones and costs
Management
/management/users- User and role administration/management/comments- Comment moderation/management/reports- Reports and exports
Content (CMS)
/management/content- Banners, ads, marquee/management/content/blog- Blog articles/management/content/bot- Chatbot auto-responses/management/content/chat- Real-time support (CX Inbox)
System
/management/settings- General business configuration/management/settings/branches- Branch management/management/settings/currencies- Currencies and exchange rates/management/settings/gateways- Payment gateways/management/system/alerts- System alerts and errors/management/system/audit- Audit log
Frontend Features (Web Store)
Design & Visual Experience
- 🎨 Premium design moving away from traditional minimalism, with gradients, glassmorphism and vibrant colors.
- ✨ Advanced animations with Framer Motion in transitions, hover effects and micro-interactions.
- 🎵 Ambient music player integrated into the experience.
- 📱 Mobile-First design completely responsive.
Pages & Features (21 pages)
Home (/)
- Animated Hero banner with promotional slider.
- Product sections: Trending, New Arrivals, Recommended.
- Featured reviews.
- Navigation with real-time search.
Catalog (/products)
- Advanced filtering: By category (tree), price range, attributes (size, color), search.
- Sorting: lowest price, highest price, newest.
- Responsive grid with entrance animations.
Product Detail (/products/[slug])
- Image gallery with zoom.
- Variant selector (color, size) with real-time stock.
- Dynamic pricing with discount if applicable.
- Related products.
Favorites (/favorites)
- Add/remove favorite products.
- Persistent wishlist.
User Profile (/profile)
- Profile data: Personal information editing.
- My purchases: Order history with statuses and PDF invoice download.
- Points history: Loyalty points movements with current balance.
- Comments and reviews: Published review history.
Cart (/cart)
- Real-time synchronization with backend to prevent fraud and inconsistencies.
- Redeem loyalty points as discount.
- Apply discount coupons.
- Select shipping type (pickup or home delivery with zone).
- Select payment type (Stripe, PayPal, MercadoPago).
- Stock verification before proceeding to checkout.
Checkout (/checkout)
- Multi-step flow: Identification → Delivery → Payment → Confirmation.
- Result pages:
/checkout/success,/checkout/failure,/checkout/pending.
Real-Time Chat
- Floating chat widget with Zendesk-style support.
- Smart detection: if an admin/employee is online, it connects; otherwise, the bot responds.
- Contextualization: sends the agent what the customer has in their cart.
Notifications
- In-app notification system with history.
- Real-time order status updates.
Blog (/blog)
- Article listing with magazine-style design.
- Individual article pages (
/blog/[slug]).
FAQ (/faq)
- Frequently asked questions with interactive accordions.
- Common question search.
Contact (/contact)
- Nearest branch locator: Uses the user's real-time geolocation to compare coordinates with branches and display the nearest one.
- Contact form.
About (/about)
- Business institutional page.
Authentication
- Login with email and password.
- New user registration.
- Password recovery: Email sending with reset link.
Maintenance Mode & Errors
- Automatic maintenance mode if unable to connect to the API or network.
- User-friendly error notification system (non-technical).
- Error pages with consistent visual design.
Technology Stack
Backend API
| Technology | Purpose |
|---|---|
| Node.js 20+ | Runtime environment |
| Express.js 5 | Web framework |
| PostgreSQL 13+ | Relational database |
| Prisma 7 | ORM and query builder |
| Socket.IO 4 | Real-time communication |
| MercadoPago SDK | LATAM payment gateway |
| Stripe SDK | Global payment gateway |
| PayPal SDK | Global payment gateway |
| PDFKit | PDF invoice generation |
| bwip-js | QR and barcode generation |
| Cloudinary | Cloud image storage |
| Nodemailer | Transactional email sending |
| node-cron | Scheduled tasks (backups, cleanup) |
| Archiver | ZIP compression for backups |
Frontend & Admin
| Technology | Purpose |
|---|---|
| Next.js 16 | React framework (App Router) |
| React 19 | UI library |
| TypeScript 5 | Statically typed JavaScript |
| TailwindCSS 4 | CSS framework |
| Zustand 5 | Client state management |
| TanStack Query 5 | Server state (cache, sync) |
| shadcn/ui | Pre-built UI components |
| Recharts | Interactive charts (dashboard) |
| Framer Motion | Advanced animations |
| react-to-print | Thermal ticket printing |
| Zod | Schema validation |
| React Hook Form | Form management |
System Architecture
flowchart TB
subgraph Presentation["Presentation Layer"]
AdminPanel["Admin Panel<br/>(Next.js 16 + React 19)"]
FrontendWeb["Customer Web<br/>(Next.js + TailwindCSS)"]
end
subgraph Application["Application Layer (42 Services)"]
API["Express.js API<br/>Port 8000"]
Socket["Socket.IO Server<br/>Real-Time"]
Cron["Cron Jobs<br/>(Backups, Cleanup)"]
end
subgraph Data["Data Layer"]
PostgreSQL[("PostgreSQL<br/>30+ Tables")]
end
subgraph External["External Services"]
Cloudinary["Cloudinary<br/>(Images)"]
MercadoPago["MercadoPago<br/>(LATAM Payments)"]
Stripe["Stripe<br/>(Global Payments)"]
PayPal["PayPal<br/>(Global Payments)"]
SMTP["SMTP Server<br/>(Emails)"]
end
AdminPanel <-->|REST API + WS| API
FrontendWeb <-->|REST API + WS| API
API <-->|Prisma ORM| PostgreSQL
API -->|Upload Images| Cloudinary
API -->|Process Payments| MercadoPago
API -->|Process Payments| Stripe
API -->|Process Payments| PayPal
API -->|Send Emails| SMTP
Cron -->|Backup ZIP| PostgreSQLNext Steps
For detailed information on specific aspects, see:
- Architecture - Design patterns, middleware pipeline.
- Admin Panel - Complete admin panel guide.
- Frontend Web - Store documentation.
- API Reference - Documented REST endpoints.
- Data Model - Database schema and relationships.
- Authentication & Security - JWT, RBAC, security measures.
- Flows & Diagrams - Sequence diagrams.
- Deployment - Production guide.
Last Updated: March 3, 2026. Status: ✅ COMPLETE, SECURE AND PRODUCTION-READY.