How jhongo201/tienda_laravel works
1. Overall shape
- This is a Laravel 11 e-commerce monolith built around a server-rendered UI with Livewire 3 + Volt for interactivity.
- The app is organized as a domain-oriented backend under app/Domains/, while HTTP controllers, Livewire components, views, jobs, and listeners orchestrate user flows around those domains.
2. Presentation layer
- The main entry points are Blade pages in resources/views/ plus Livewire components in app/Livewire/.
- Public shopping interactions are handled by components like ProductCatalog, CartDrawer, and CheckoutForm, with Blade partials providing the layout and page structure.
- This is not a separate SPA; Livewire keeps most stateful UI behavior on the Laravel side.
3. Public commerce flow
- Browsing starts at home/shop/product routes and flows into the cart and checkout pages.
- The cart and checkout screens are the main conversion boundary: product selection becomes cart state, cart state becomes an order draft, and the order draft becomes a payment request.
4. Domain decomposition
- Core business logic is split into bounded domains:
- Cart: Cart, CartItem, CartService
- Product: Product, Category, ProductVariant, ProductService, StockService
- Order: Order, OrderItem, Address, OrderStatus, OrderService
- Payment: Payment, WebhookLog, WompiService, ProcessWompiWebhook
- Coupon: Coupon, CouponValidator
- Shipping: ShippingZone
- These domains are the main architecture boundaries and are where persistence and business rules converge.
5. Checkout and order lifecycle
- The checkout flow likely pulls from cart, validates coupon and shipping, creates an order with items/address, and then creates a payment record.
- OrderStatus and the OrderPaid event indicate a state machine-like lifecycle where payment confirmation advances the order from pending to paid and downstream actions are triggered.
6. Payment integration with Wompi
- Wompi is the external payment boundary.
- WompiService encapsulates the provider-specific interaction, while WompiController and the webhook route handle the redirect/return and asynchronous provider callback.
- ProcessWompiWebhook runs on the queue, which means payment confirmation is processed asynchronously rather than inline with the HTTP request.
- WebhookLog suggests webhook payloads are persisted for audit/replay/debugging.
7. Asynchronous and event-driven work
- The app uses the database queue for background processing.
- Two explicit jobs show important async responsibilities:
- ExpirePendingOrders for order cleanup/timeouts
- SendAbandonedCartEmails for re-engagement
- Domain events and listeners connect the workflow:
- OrderPaid event
- SendOrderConfirmation
- MergeGuestCart
- This creates a clear split between immediate user actions and deferred side effects.
8. Authentication, roles, and admin boundary
- Auth is provided by Laravel Breeze, while authorization is driven by Spatie Laravel Permission.
- The admin area is separated in app/Http/Controllers/Admin/ and admin Livewire components under app/Livewire/Admin/.
- Admin functions cover product, category, order, shipping, coupon, and user management, so the diagram should show a distinct privileged back-office path from the public store.
9. Persistence and data model
- Migrations reveal the main tables: users, categories, products, product variants, shipping zones, coupons, addresses, carts, cart items, orders, order items, payments, webhook logs, and coupon usages.
- The app is designed for a relational database, with PostgreSQL recommended and SQLite supported for lightweight development.
- Session, cache, and queue are all configured to use the database, which means application state is intentionally kept inside the same persistence boundary.
10. Media, ops, and observability
- The presence of Spatie Media Library and Backup in config/migrations implies support for managed media assets and backups, though they are not the primary commerce flow.
- Laravel Telescope is included for debugging/inspection.
- Vite and Tailwind handle the frontend asset pipeline; they affect deployment/runtime because the app needs both the PHP server and the Vite build/dev process.
11. Testing and quality
- The repo includes feature tests for auth, cart, order, payment, and profile behavior, which map closely to the main user journeys.
- Pest is the test runner, so the test suite is centered on end-to-end business scenarios rather than isolated units.
12. Key architecture view to draw
- A useful diagram would show:
- Public users interacting with Livewire/Blade UI
- UI calling controllers/components
- Controllers/components invoking domain services/models
- Domain services persisting into relational DB tables
- Checkout handing off to Wompi
- Wompi callbacks entering through webhooks
- Webhooks processed by queued jobs, emitting events/listeners, and updating orders/payments
- Admin users entering through a separate role-protected back office
Main entry points: Livewire Livewire UI · migrations Persistence · Payment Payments · Order Orders
Components 18
Public store
Customer-facing pages, Livewire components, and checkout entry points.
- Routes · Web and auth route entry points for the application.
routes/web.php - Storefront · Server-rendered public pages for home, shop, cart, checkout, and orders.
resources/views - Livewire UI · Public Livewire components for product browsing, cart, and checkout.
app/Livewire - Mail & views · Email templates and shared view components used by order and cart flows.
resources/views/emails
Domain core
Business rules and persistence boundaries for commerce flows.
- Cart · Cart aggregate and service for session/cart state and line items.
app/Domains/Cart - Catalog · Products, categories, variants, stock, and catalog services.
app/Domains/Product - Orders · Orders, order items, addresses, status, and order service.
app/Domains/Order - Payments · Payment records, webhook logs, Wompi integration, and webhook job.
app/Domains/Payment - Coupons · Coupon model and validation rules for checkout discounts.
app/Domains/Coupon - Shipping · Shipping zone model used during checkout and fulfillment.
app/Domains/Shipping
Back office
Privileged admin controllers and Livewire screens.
- Admin HTTP · Back-office controllers for dashboard, products, categories, orders, shipping, and users.
app/Http/Controllers/Admin - Admin Livewire · Admin Livewire forms and tables for managing catalog and orders.
app/Livewire/Admin
Platform
Framework configuration, async processing, data layer, and integrations.
- Queue jobs · Background jobs for expiring pending orders and abandoned cart emails.
app/Jobs - Events · Order-paid event and listeners that trigger side effects like confirmations and guest-cart merging.
app/Listeners - Wompi entry · Wompi controller and webhook controller that receive provider callbacks and return flow.
app/Http/Controllers/WompiController.php - Persistence · Eloquent models and migrations for users, catalog, carts, orders, payments, and webhooks.
database/migrations - App config · Database, queue, session, auth, permission, media, telescope, and service configuration.
config - Feature tests · End-to-end tests covering auth, cart, order, payment, and profile journeys.
tests/Feature
Connections 24
- Routes → Storefront: renders · Routes deliver the server-rendered storefront pages.
- Routes → Livewire UI: mounts · Public routes mount Livewire components for interactive pages.
- Livewire UI → Cart: uses · Cart drawer and checkout UI read and mutate cart state.
- Livewire UI → Catalog: browses · Product catalog UI queries catalog data and stock.
- Livewire UI → Orders: creates · Checkout UI converts cart state into orders.
- Livewire UI → Coupons: validates · Checkout applies coupon rules during purchase flow.
- Livewire UI → Shipping: prices · Checkout uses shipping zones to shape fulfillment cost.
- Cart → Persistence: persists · Cart state is stored in relational tables.
- Catalog → Persistence: persists · Catalog entities and stock are stored in the database.
- Orders → Persistence: persists · Orders, items, addresses, and status live in relational storage.
- Payments → Persistence: persists · Payments and webhook logs are recorded for reconciliation.
- Payments → Wompi entry: receives · Webhook and return flows enter through the payment boundary.
- Wompi entry → Queue jobs: queues · Webhook processing is delegated to the database queue.
- Queue jobs → Payments: processes · Webhook jobs update payment state asynchronously.
- Payments → Orders: confirms · Successful payment advances order lifecycle.
- Events → Orders: reacts · Order-paid events trigger order confirmation and guest-cart merge side effects.
- Admin HTTP → Admin Livewire: orchestrates · Back-office controllers and Livewire screens cooperate for admin workflows.
- Admin HTTP → Persistence: manages · Admin operations act on the same persisted commerce data.
- Admin Livewire → Persistence: edits · Admin forms and tables update catalog and order records.
- App config → Queue jobs: configures · Queue, session, and database drivers support async work.
- App config → Wompi entry: wires · Services configuration connects the payment provider boundary.
- Mail & views → Events: renders · Listeners trigger order confirmation and related emails.
- Feature tests → Livewire UI: covers · Feature tests exercise the public commerce journeys.
- Feature tests → Payments: covers · Feature tests cover payment and webhook behavior.