Warehouse Service
The Warehouse service manages inventory, stock levels, storage locations, and stock transfers. It provides real-time stock data to the Webshop and handles physical warehouse operations.
Architecture
Webshop Service ──┐
Tenant Frontend ──┤──▶ Warehouse Backend (Laravel 12)
CRM Service ──────┘ │
├──▶ PostgreSQL (warehouse schema)
├──▶ Redis (cache)
└──▶ RabbitMQ (stock events)
Key Features
Inventory Management
- Real-time stock levels per product and variant
- Multi-location warehouse support
- Safety stock thresholds and alerts
- Batch and serial number tracking
Stock Operations
- Receiving — Inbound stock from suppliers
- Transfers — Move stock between locations
- Adjustments — Manual stock corrections with reason codes
- Reservations — Hold stock for pending orders
Integration with Webshop
- Automatic stock reservation on order creation
- Stock release on order cancellation
- Real-time availability check for product pages
API Endpoints
Base URL: https://{tenant}.vecton.hu/api/warehouse (production) | http://localhost:8011/api (dev)
| Method | Endpoint | Description |
|---|---|---|
| GET | /stock | List stock levels (filterable by product, location) |
| GET | /stock/{productId} | Get stock for specific product |
| POST | /stock/receive | Record inbound stock |
| POST | /stock/transfer | Transfer between locations |
| POST | /stock/adjust | Manual stock adjustment |
| POST | /stock/reserve | Reserve stock for an order |
| POST | /stock/release | Release reserved stock |
| GET | /locations | List warehouse locations |
| POST | /locations | Create warehouse location |
| GET | /movements | Stock movement history |
Events
| Event | Trigger | Consumers |
|---|---|---|
stock.received | New stock received | Analytics, Webhook |
stock.transferred | Stock moved between locations | Analytics |
stock.adjusted | Manual adjustment | Analytics, Webhook |
stock.low | Stock below safety threshold | CRM (alerts), Webhook |
stock.reserved | Stock reserved for order | Analytics |
Database Schema
| Table | Description |
|---|---|
stock_items | Current stock levels per product/location |
stock_movements | History of all stock changes |
locations | Warehouse locations |
reservations | Active stock reservations |
suppliers | Supplier information |
receiving_orders | Inbound receiving records |
Configuration
| Variable | Description | Default |
|---|---|---|
APP_URL | Service base URL | http://localhost:8011 |
DB_SCHEMA | Database schema | warehouse |
LOW_STOCK_THRESHOLD | Default safety stock level | 10 |
Development
cd tenant/tenant-backend-warehouse
composer install
php artisan migrate --seed
php artisan serve --port=8011