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
| Method | Endpoint | Description |
|---|---|---|
| GET | /products | List products (paginated, filterable) |
| GET | /products/{id} | Get product details |
| POST | /products | Create product |
| PUT | /products/{id} | Update product |
| DELETE | /products/{id} | Delete product |
| GET | /products/{id}/variants | List product variants |
Categories
| Method | Endpoint | Description |
|---|---|---|
| GET | /categories | List categories (tree structure) |
| POST | /categories | Create category |
| PUT | /categories/{id} | Update category |
| DELETE | /categories/{id} | Delete category |
Cart
| Method | Endpoint | Description |
|---|---|---|
| GET | /cart | Get current cart |
| POST | /cart/items | Add item to cart |
| PUT | /cart/items/{id} | Update cart item quantity |
| DELETE | /cart/items/{id} | Remove item from cart |
Orders
| Method | Endpoint | Description |
|---|---|---|
| GET | /orders | List orders (paginated) |
| POST | /orders | Create order from cart |
| GET | /orders/{id} | Get order details |
| PUT | /orders/{id}/status | Update order status |
Events
The Webshop publishes these events via RabbitMQ:
| Event | Trigger | Consumers |
|---|---|---|
order.created | New order placed | Warehouse, Analytics, Webhook |
order.status_changed | Order status update | CRM, Analytics, Webhook |
product.created | New product added | Analytics |
product.updated | Product modified | Webhook |
product.stock_changed | Stock level change | Analytics |
Database Schema
Key tables in the webshop database:
| Table | Description |
|---|---|
products | Product catalog |
product_variants | Size, color, and other variants |
categories | Category tree (nested set) |
product_categories | Product-category pivot |
carts | Shopping carts |
cart_items | Items in carts |
orders | Order records |
order_items | Items in orders |
payments | Payment records |
Configuration
| Variable | Description | Default |
|---|---|---|
APP_URL | Service base URL | http://localhost:8010 |
DB_SCHEMA | Database schema | webshop |
WAREHOUSE_API_URL | Warehouse service URL | http://localhost:8011/api |
CRM_API_URL | CRM service URL | http://localhost:8012/api |
FILESYSTEM_DISK | Storage driver | s3 |
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