Skip to main content

Modular monolith

The Baxela backend is a modular monolith: a single Laravel deployment whose codebase is partitioned into bounded, self-contained modules managed with nwidart/laravel-modules.

You get microservice-style separation — each module owns its domain logic, database tables, routes, and events — without distributed-systems overhead. Modules live in apps/backend/Modules/, one folder per module.

Modules at a glance​

ModuleResponsibility
AuthAuthentication and authorization
CartShopping carts and cart items
CatalogProducts, variants, options, images, categories
ContactStorefront contact-form messages and admin inbox
ContentCMS pages and the blog (posts, categories, comments)
CoreShared contracts, gateways, DTOs, countries, idempotency
DiscountCoupons and automatic product promotions
InventoryProduct stock levels
MediaMedia uploads
MenuNavigation menus and nested links
NotificationDatabase/email/web-push notifications, realtime broadcast
OrderOrders, order items, order addresses
PaymentPayments behind a pluggable gateway-driver registry
SettingSystem settings
ShippingShipping methods, zones, rates, shipments
SupportCustomer support tickets
UserCustomers/users

See Backend / Modules for the per-module reference: tables, emitted/listened events, and dependencies.

How modules interact​

  • Events — the primary coupling point. A module publishes domain events (for example OrderCreatedEvent) and other modules react through listeners. See Events.
  • Gateways & contracts — the Core module hosts shared interfaces, events, gateway contracts, and DTOs. A module consumes another module's data only through a gateway defined in Core (e.g. Shipping calls OrderGatewayInterface::markAsShipped), never by reaching into another module's internals.
  • Table prefixes — each module's tables are prefixed with the module name (catalog_products, order_orders, shipping_rates, …), keeping the single database physically partitioned by module.

Interactive dependency graph​

The real coupling between modules is mapped in an auto-generated, interactive graph that ships in the main repository: docs/module-dependency-graph.html. View it rendered on htmlpreview.

It aggregates imports, calls, references, and inheritance across the backend modules, the admin feature areas, and the storefront parts. Hover any module for its coupling stats, drag to rearrange, filter by app, and raise the minimum-reference threshold to surface only the strongest links. The graph is a snapshot regenerated after each version release with python3 scripts/generate-module-graph.py, so it stays in sync with the module list on this page.

Database ERD​

Every module's database schema is diagrammed in the Database ERD reference: one Mermaid diagram per module with tables, columns, keys, and indexes. Solid lines are enforced database foreign keys; dashed lines are Eloquent relations the database does not constrain (mostly cross-module references); loose *_id columns that have neither are listed per page.

The pages are generated from the live schema with php artisan erd:generate in the platform repository and pulled into this site with pnpm sync:erd, so they describe the database exactly as deployed.

Extending the platform​

Baxela is built to be extended via:

  1. Events & listeners — subscribe to existing domain events.
  2. Module overrides — replace module behavior where the module system allows it.
  3. Custom modules — add your own module with its own tables and events; nothing in the core assumes it exists.