Skip to main content

Webshop Service

The Webshop service is the core commerce engine for each tenant. It manages product catalogs, shopping carts, orders, payments, and customer-facing store functionality.

Architecture

  Tenant Frontend


Webshop Backend (Laravel 12)

├──▶ PostgreSQL (webshop schema)
├──▶ Redis (cache, sessions)
├──▶ RabbitMQ (order events)
├──▶ S3 (product images)
├──▶ Warehouse Service (stock checks)
└──▶ CRM Service (customer data)

Key Features

Product Management

  • Product CRUD with variants (size, color, etc.)
  • Category hierarchy with unlimited nesting
  • Product images stored in S3 (private and public buckets)
  • Price management with currency support
  • Stock levels synced with Warehouse service

Shopping Cart

  • Session-based cart for anonymous users
  • Persistent cart for authenticated users
  • Cart item validation against current stock
  • Automatic price recalculation

Order Processing

  • Order creation from cart with validation
  • Order status workflow: pending → confirmed → processing → shipped → delivered
  • Order history and tracking
  • Invoice generation

Payment Integration

  • Extensible payment provider interface
  • Payment status tracking and webhooks
  • Refund processing

API Endpoints

Base URL: https://{tenant}.vecton.hu/api/webshop (production) | http://localhost:8010/api (dev)

Products

MethodEndpointDescription
GET/productsList products (paginated, filterable)
GET/products/{id}Get product details
POST/productsCreate product
PUT/products/{id}Update product
DELETE/products/{id}Delete product
GET/products/{id}/variantsList product variants

Categories

MethodEndpointDescription
GET/categoriesList categories (tree structure)
POST/categoriesCreate category
PUT/categories/{id}Update category
DELETE/categories/{id}Delete category

Cart

MethodEndpointDescription
GET/cartGet current cart
POST/cart/itemsAdd item to cart
PUT/cart/items/{id}Update cart item quantity
DELETE/cart/items/{id}Remove item from cart

Orders

MethodEndpointDescription
GET/ordersList orders (paginated)
POST/ordersCreate order from cart
GET/orders/{id}Get order details
PUT/orders/{id}/statusUpdate order status

Events

The Webshop publishes these events via RabbitMQ:

EventTriggerConsumers
order.createdNew order placedWarehouse, Analytics, Webhook
order.status_changedOrder status updateCRM, Analytics, Webhook
product.createdNew product addedAnalytics
product.updatedProduct modifiedWebhook
product.stock_changedStock level changeAnalytics

Database Schema

Key tables in the webshop database:

TableDescription
productsProduct catalog
product_variantsSize, color, and other variants
categoriesCategory tree (nested set)
product_categoriesProduct-category pivot
cartsShopping carts
cart_itemsItems in carts
ordersOrder records
order_itemsItems in orders
paymentsPayment records

Configuration

VariableDescriptionDefault
APP_URLService base URLhttp://localhost:8010
DB_SCHEMADatabase schemawebshop
WAREHOUSE_API_URLWarehouse service URLhttp://localhost:8011/api
CRM_API_URLCRM service URLhttp://localhost:8012/api
FILESYSTEM_DISKStorage drivers3

Development

cd tenant/tenant-backend-webshop

# Install dependencies
composer install

# Run migrations
php artisan migrate

# Seed test data
php artisan db:seed

# Start server
php artisan serve --port=8010