How ghosyy/proyecto-arqui_grieta_del_invocadol works
This repository implements an ecommerce backend split across a FastAPI broker and NestJS product and order services. The main workflow authenticates a user at the broker, routes requests to domain services, and lets the order service check product prices and stock, request stock deductions, and persist an order with its line items. Other supported capabilities include product catalog and inventory administration, order lookup and cancellation, JWT authentication, and user administration. The services use PostgreSQL; broker proxy destinations and cross-service calls are only partially evidenced by the sampled files.
Main entry points: pedidos.service.ts Order workflow · productos.controller.ts Product endpoints · main.py Broker app · auth.py Authentication routes
Components 21
Broker and identity
- Broker app
broker/main.py - Authentication routes
broker/app/routes/auth.py - Admin routes
broker/app/routes/admin.py - Service proxy
broker/app/routes/proxy.py - Token checks
broker/app/dependencies.py - JWT tokens
broker/app/tokens.py - Password hashing
broker/app/passwords.py - Broker settings
broker/app/config.py
Product catalog
- Product endpoints
ms-productos/src/productos/productos.controller.ts - Catalog and stock
ms-productos/src/productos/productos.service.ts - Product DTOs
ms-productos/src/productos/dto - Product entity
ms-productos/src/productos/producto.entity.ts - Product DB setup
ms-productos/src/app.module.ts
Order management
- Order endpoints
ms-pedidos/src/pedidos/pedidos.controller.ts - Order workflow
ms-pedidos/src/pedidos/pedidos.service.ts - Order DTOs
ms-pedidos/src/pedidos/dto - Order header
ms-pedidos/src/pedidos/pedido.entity.ts - Order lines
ms-pedidos/src/pedidos/detalle-pedido.entity.ts
Persistence
- Broker user data
broker/app/db.py - Orders database
ms-pedidos/src/pedidos/pedido.entity.ts
Other components
- API client
Connections 30
- API client → Broker app: sends requests
broker/main.py - Broker app → Authentication routes: registers routes
broker/main.py - Broker app → Admin routes: registers routes
broker/main.py - Broker app → Service proxy: registers routes
broker/main.py - Broker app → Broker user data: initializes users
broker/main.py - Authentication routes → Broker user data: looks up users
broker/app/routes/auth.py - Authentication routes → Password hashing: verifies passwords
broker/app/routes/auth.py - Authentication routes → JWT tokens: creates tokens
broker/app/routes/auth.py - Authentication routes → Token checks: checks identity
broker/app/routes/auth.py - Token checks → JWT tokens: reads tokens
broker/app/dependencies.py - Token checks → Broker user data: checks user status
broker/app/dependencies.py - Admin routes → Token checks: guards admin routes
broker/app/routes/admin.py - Admin routes → Broker user data: manages users
broker/app/routes/admin.py - Service proxy → Broker settings: uses destinations
broker/app/routes/proxy.py - Service proxy → Product endpoints: forwards requests
- Service proxy → Order endpoints: forwards requests
- Product endpoints → Catalog and stock: dispatches operations
ms-productos/src/productos/productos.controller.ts - Product endpoints → Product DTOs: accepts DTOs
ms-productos/src/productos/productos.controller.ts - Catalog and stock → Product entity: uses entity
ms-productos/src/productos/productos.service.ts - Catalog and stock → Product DTOs: uses DTOs
ms-productos/src/productos/productos.service.ts - Product DB setup → Product endpoints: loads module
ms-productos/src/app.module.ts - Order endpoints → Order workflow: dispatches operations
ms-pedidos/src/pedidos/pedidos.controller.ts - Order endpoints → Order DTOs: accepts DTOs
ms-pedidos/src/pedidos/pedidos.controller.ts - Order workflow → Product endpoints: checks products
ms-pedidos/src/pedidos/pedidos.service.ts - Order workflow → Product endpoints: requests stock deduction
ms-pedidos/src/pedidos/pedidos.service.ts - Order workflow → Order header: creates and saves
ms-pedidos/src/pedidos/pedidos.service.ts - Order workflow → Order lines: creates details
ms-pedidos/src/pedidos/pedidos.service.ts - Order workflow → Order DTOs: uses DTOs
ms-pedidos/src/pedidos/pedidos.service.ts - Order header → Order lines: has details
ms-pedidos/src/pedidos/pedido.entity.ts - Order workflow → Orders database: persists orders
ms-pedidos/src/pedidos/pedidos.service.ts