How josue-leon/davivienda works
Project Type and Purpose
• This is a full-stack, multi-container application for a “Billetera Virtual” (Digital Wallet).
• It consists of three cooperating services:
• cliente-app: a React/Vite web client
• servidor-client: a NestJS API Gateway/business-logic service
• servidor-database: a NestJS data/persistence service backed by MySQL via Prisma
File Structure
• Top-level:
• cliente-app/… — front-end React SPA
• servidor-client/… — NestJS service exposing business-logic endpoints
• servidor-database/… — NestJS service exposing raw data/persistence endpoints
• docker-compose.yml — orchestrates all three containers plus MySQL & phpMyAdmin
• Each NestJS service uses controllers, DTOs, entities, global error handling, guards, and services.
• The database layer adds modules, repositories, Prisma context/unit-of-work, and migrations/seed.
README Insights
• Ports:
• 3000: Servidor-database’s Swagger/OpenAPI UI
• 3001: Servidor-client’s Swagger/OpenAPI UI
• 5173: cliente-app web UI
• 33060: MySQL
• 8081: phpMyAdmin
• Stack: React 19, NestJS + Fastify, Prisma + MySQL, Docker Compose, OpenAPI Generator, Postman
Main Components and Interactions
a. Frontend (cliente-app)
• Serves UI pages (Home, ConsultarSaldo, Pagar, etc.)
• Calls servidor-client via VITE_API_BASE_URL + API key
b. API Gateway / Business Service (servidor-client)
• Exposes high-level endpoints (e.g., /clientes, /billetera, /pagar)
• Implements authentication guard (API-Key)
• Delegates persistence calls to servidor-database via HTTP (using generated OpenAPI client)
c. Data / Persistence Service (servidor-database)
• Exposes low-level CRUD endpoints directly interacting with MySQL via Prisma
• Implements repositories, unit-of-work, custom validators, global error filters
d. Database (MySQL)
• Stores cliente, transacción, sesiónCompra, saldo tables
• Accessed by Prisma through servidor-database
e. Supporting Tools
• phpMyAdmin for DB inspection
• Swagger/OpenAPI for API docs on both NestJS services
• Postman collections for manual testing
Architectural Patterns & Design Principles
• Layered Microservice Architecture: three independently deployable containers
• API-First Design: both NestJS services have OpenAPI/Swagger and generated API clients
• Dependency Injection & Inversion (NestJS modules, services, controllers)
• Repository + Unit-of-Work Pattern in the database layer
• Separation of Concerns: UI vs business logic vs data access