Skip to content

Student Guide: Lightweight Profile

This guide is for the profile you will use most often:

  • lightweight-docker-compose.yml

Its goal is to give you a fast local environment with:

  • frontend (storefront and admin pages)
  • backend (REST, GraphQL, authentication)
  • warehouse-service (shipments, tracking, returns, suppliers and purchase orders)
  • payment-service (card payments with test cards)
  • notification-service (user webhooks and the customer's commerce emails)
  • delivery-service (last-mile courier deliveries and the delivery tracking micro-frontend)
  • llm-service (the LLM generate and chat API, in front of the mocked model)
  • PostgreSQL shared by the backend, warehouse-service, payment-service, notification-service and delivery-service
  • a gateway that serves the frontend, the APIs and the static product images
  • the documentation wiki (/docs/)
  • a mocked LLM

Every application service except the frontend is a small Rust binary.

The lightweight profile uses ollama-mock and expects the qwen3.5:2b request model.

Main Idea

Treat this as a single local web app served through one URL:

  • http://localhost:8081

Use that URL for:

  • frontend pages
  • backend API (/api/v1/...)
  • warehouse API (shipments, tracking, returns, suppliers, purchase orders), routed by the gateway
  • payment API (/api/v1/payments), routed by the gateway
  • notification API (/api/v1/webhooks, /api/v1/webhook-inboxes, /api/v1/notifications/emails), routed by the gateway
  • deliveries API (courier, order delivery tracking: /api/v1/deliveries, /api/v1/orders/{id}/delivery), routed by the gateway to delivery-service; in the frontend these are the /deliveries and /orders/:id/delivery pages
  • LLM generation and chat (/api/v1/ollama/generate, /api/v1/ollama/chat, /api/v1/ollama/chat/tools...), routed by the gateway to llm-service; other /api/v1/ollama/... paths are still served by the backend
  • Swagger UI and the OpenAPI documents
  • the documentation wiki (/docs/)
  • a read-only database UI, pgweb (/db/)
  • product images

Do not think in terms of “frontend on one port and backend on another port” for normal usage. The gateway on 8081 is the intended entrypoint; the backend, warehouse-service, payment-service, notification-service, delivery-service and llm-service are not published on host ports.

Two other host ports are published:

  • 11434 for the mocked LLM
  • 15432 for the database, on 127.0.0.1 only, for clients such as DBeaver (see Look Into The Database)

Make sure 8081, 11434 and 15432 are free before you start.

Lightweight Architecture

flowchart TB
    U[Browser] --> G[Gateway<br/>localhost:8081<br/>serves frontend + /images]
    G --> F[Frontend]
    G --> D[Docs wiki]
    G --> B[Backend]
    G --> W[warehouse-service]
    G --> PS[payment-service]
    G --> NS[notification-service]
    G --> DS[delivery-service]
    G -- "Ollama paths" --> L[llm-service]
    B -- "stock commands" --> W
    W -. "events + stock pushes" .-> B
    PS -. "events" .-> B
    NS -. "events" .-> B
    DS -. "events" .-> B
    L -- "users, prompts, products" --> B
    B --> P[(PostgreSQL)]
    W --> P
    PS --> P
    NS --> P
    DS --> P
    L --> O[Ollama Mock<br/>localhost:11434]

The gateway sends fulfilment paths (/api/v1/warehouse/..., returns, suppliers, purchase orders, order shipments and tracking) to warehouse-service, payment paths (/api/v1/payments, /api/v1/admin/payments, /api/v1/orders/{id}/payments) to payment-service, webhook and notification paths (/api/v1/webhooks, /api/v1/webhook-inboxes, /api/v1/notifications/, /api/v1/local/notifications/) to notification-service, delivery paths (/api/v1/deliveries, /api/v1/orders/{id}/delivery) and the tracking micro-frontend (/mfe/delivery/remote.js) to delivery-service, the four Ollama endpoints to llm-service and everything else under /api/v1/ to the backend. Every service accepts the same JWT from POST /api/v1/users/signin.

Behind the gateway the services also talk to each other:

  • warehouse-service owns the stock. The backend keeps a read copy of each product's quantity for product pages, search and the cart, but checkout, admin stock adjustments and new products go to warehouse-service synchronously. Without warehouse-service, checkout answers 503.
  • Events flow from the backend. warehouse-, payment-, notification- and delivery-service read the backend's commerce events (order paid, cancelled, shipped...) by polling its event feed every 5 seconds. That is why refunds, shipment cancellations, webhooks and restored stock appear a few seconds after the change, not at once.

Start The Profile

On Windows, use Docker Desktop with the WSL2 backend and clone the repository inside the WSL2 filesystem. See Windows and WSL2 for the setup and the known Windows issues.

From the awesome-localstack directory run:

docker compose -f lightweight-docker-compose.yml up -d

This profile has its own Compose project name (awesome-light), so switching from the full profile should normally work without orphan warnings.

Still, do not run the full profile and the lightweight profile at the same time. They use the same local ports.

The first start downloads the images and builds the documentation wiki image locally, so it takes a few minutes. After that the stack is usually ready within a minute.

Check That Containers Started

Run:

docker compose -f lightweight-docker-compose.yml ps -a

Long-running services, expected state Up:

  • backend (healthy)
  • frontend
  • gateway
  • ollama-mock
  • postgres (healthy, shared by the backend and four services)
  • warehouse-service (healthy, fulfilment, tracking, returns and purchasing)
  • payment-service (healthy, card payments)
  • notification-service (healthy, webhooks and commerce emails)
  • delivery-service (healthy, courier deliveries and the tracking micro-frontend)
  • llm-service (healthy, the LLM generate and chat API)
  • docs (healthy after about 30 seconds, the documentation wiki)
  • pgweb (healthy, the read-only database UI at /db/)

One-shot setup containers, expected state Exited (0):

  • postgres-roles creates the warehouse, payment, notification and delivery database roles
  • db-tester-role creates the read-only tester database login

That is 12 services Up and two Exited (0).

Exited (0) is correct for them. Without -a, docker compose ps hides them.

Your Data Is Temporary

PostgreSQL in this profile keeps its data in memory (tmpfs). Every time the postgres container is stopped or recreated, the database starts again from the seeded demo data: your registrations, orders and edits disappear.

That is intended for training: down followed by up -d gives you a clean environment.

URLs You Should Know

Main application URL:

  • http://localhost:8081/login

Useful lightweight URLs:

  • frontend login: http://localhost:8081/login
  • documentation wiki (how every service and flow works): http://localhost:8081/docs/
  • Swagger UI: http://localhost:8081/swagger-ui/index.html (definitions: "Backend", "Payment service", "Warehouse service", "Notification service" and "Delivery service")
  • backend OpenAPI JSON: http://localhost:8081/v3/api-docs
  • warehouse OpenAPI JSON: http://localhost:8081/warehouse/v3/api-docs
  • payment OpenAPI JSON: http://localhost:8081/payment/v3/api-docs
  • notification OpenAPI JSON: http://localhost:8081/notification/v3/api-docs
  • delivery OpenAPI JSON: http://localhost:8081/delivery/v3/api-docs
  • courier delivery of an order (signed in): http://localhost:8081/orders/{id}/delivery
  • your commerce emails (signed in): http://localhost:8081/api/v1/notifications/emails
  • commerce emails of everyone, as sent (lightweight only): http://localhost:8081/api/v1/local/notifications/outbox
  • GraphiQL: http://localhost:8081/api/v1/graphiql
  • database UI (pgweb, read-only): http://localhost:8081/db/
  • database for your own client: 127.0.0.1:15432 (testdb, tester / tester)
  • sample image through gateway: http://localhost:8081/images/iphone.png
  • mocked LLM generate endpoint: http://localhost:11434/api/generate

Training users:

Application password login (also for POST /api/v1/users/signin):

  • admin / LocalDemoAdmin123!
  • client / client
  • client2 / client2
  • client3 / client3
  • warehouse / warehouse (warehouse role)

SSO and the mocked Google/GitHub social login were removed from the stack on 2026-11-12, together with Keycloak; sign in with a password.

For everyday work, prefer 8081.

Verification Checklist

Follow these checks in order.

1. Frontend Loads

Open:

  • http://localhost:8081/login

Expected:

  • the login page loads
  • styling is present
  • images load

Sign in with one of the training users listed above before continuing.

2. Swagger Loads

Open:

  • http://localhost:8081/swagger-ui/index.html

Expected:

  • Swagger UI loads
  • API endpoints are listed under /api/v1/...

Important:

  • Swagger requests should go to http://localhost:8081/...
  • The "Select a definition" dropdown (top right) switches between "Backend", "Payment service" (card payments), "Warehouse service" (shipments, tracking, returns, suppliers, purchase orders), "Notification service" (webhooks and commerce emails) and "Delivery service" (courier deliveries). All use the same bearer token from POST /api/v1/users/signin; authorize again after switching definitions. The warehouse endpoints need the warehouse or admin user, or a client token for your own returns.

3. OpenAPI Docs Respond

Run:

curl -i http://localhost:8081/v3/api-docs
curl -i http://localhost:8081/warehouse/v3/api-docs
curl -i http://localhost:8081/payment/v3/api-docs
curl -i http://localhost:8081/notification/v3/api-docs
curl -i http://localhost:8081/delivery/v3/api-docs

Expected:

  • HTTP 200 for all five

4. API Sign-In Works

Run:

curl -i -X POST http://localhost:8081/api/v1/users/signin \
  -H 'Content-Type: application/json' \
  -d '{"username":"client","password":"client"}'

Expected:

  • HTTP 200 with a JSON body that contains the access token

5. Product Images Work

Run:

curl -i http://localhost:8081/images/iphone.png

Expected:

  • HTTP 200

6. Mocked LLM Responds

Run:

curl -i -X POST http://localhost:11434/api/generate \
  -H 'Content-Type: application/json' \
  -d '{"model":"qwen3.5:2b","prompt":"hello"}'

Expected:

  • HTTP 200

On Windows PowerShell use curl.exe instead of curl, because curl can be an alias for Invoke-WebRequest. Put the JSON bodies in a file and pass -d '@body.json' if PowerShell quoting gets in the way.

Minimal Smoke Test

If you want one short sequence:

docker compose -f lightweight-docker-compose.yml up -d
docker compose -f lightweight-docker-compose.yml ps -a
curl -i http://localhost:8081/login
curl -i http://localhost:8081/v3/api-docs
curl -i http://localhost:8081/warehouse/v3/api-docs
curl -i http://localhost:8081/payment/v3/api-docs
curl -i http://localhost:8081/notification/v3/api-docs
curl -i http://localhost:8081/images/iphone.png
curl -i -X POST http://localhost:11434/api/generate \
  -H 'Content-Type: application/json' \
  -d '{"model":"qwen3.5:2b","prompt":"hello"}'

These curl requests verify container and gateway availability only.

How To Read Failures

502 Bad Gateway

Usually means:

  • backend, warehouse-service, payment-service, notification-service, delivery-service or llm-service is still starting
  • they are ready within seconds once PostgreSQL is up

What to do:

docker compose -f lightweight-docker-compose.yml ps -a
docker compose -f lightweight-docker-compose.yml logs -f backend warehouse-service payment-service notification-service delivery-service llm-service gateway

Checkout Answers 503 Inventory service unavailable

Usually means the backend cannot reach warehouse-service, which owns the stock: it is still starting, restarting, or (in the chaos lab) cut off on purpose. Product pages and the cart keep working, because they read the backend's copy of the stock.

What to check:

docker compose -f lightweight-docker-compose.yml ps -a warehouse-service
docker compose -f lightweight-docker-compose.yml logs -f warehouse-service
scripts/chaos status   # only if you started the chaos lab

A Container Keeps Restarting

Usually means Docker does not have enough memory. Give Docker Desktop or Rancher Desktop at least 4 GB, then run:

docker compose -f lightweight-docker-compose.yml up -d
docker compose -f lightweight-docker-compose.yml logs -f postgres-roles warehouse-service payment-service notification-service delivery-service

port is already allocated

Another program already uses 8081, 11434 or 15432. A locally installed Ollama on 11434 is the most common case. Stop it, or find the owner:

lsof -i :11434

On Windows: netstat -ano | findstr 11434.

The database port moves with DB_HOST_PORT:

DB_HOST_PORT=25432 docker compose -f lightweight-docker-compose.yml up -d

Login Page Loads But Images Are Missing

Usually means one of these:

  • gateway is still starting
  • you are testing the wrong URL
  • browser cache is stale after changes

What to check:

docker compose -f lightweight-docker-compose.yml ps -a
curl -i http://localhost:8081/images/iphone.png

Swagger Loads But “Try it out” Fails

Usually means:

  • backend is still starting
  • Swagger is pointing to the wrong host

What to check:

curl -i http://localhost:8081/v3/api-docs
curl -i http://localhost:8081/warehouse/v3/api-docs

Both documents' servers[0].url should be http://localhost:8081, not http://localhost:4001 and not http://localhost. A 404 for the "Warehouse service" or "Payment service" definition means Swagger UI was opened on the backend port directly instead of through the gateway on 8081.

Mocked LLM Is Not Responding

What to check:

docker compose -f lightweight-docker-compose.yml ps -a
curl -i -X POST http://localhost:11434/api/generate \
  -H 'Content-Type: application/json' \
  -d '{"model":"qwen3.5:2b","prompt":"hello"}'
docker compose -f lightweight-docker-compose.yml logs -f ollama-mock llm-service

The mock on 11434 answers the raw Ollama API. The app's own LLM pages call /api/v1/ollama/... on 8081, which the gateway sends to llm-service; when the mock answers but the app does not, check llm-service.

You Switched Profiles And Docker Still Looks Confused

Usually this means:

  • a previous Compose run was interrupted

Fallback cleanup:

docker compose -f lightweight-docker-compose.yml down --remove-orphans
docker compose -f lightweight-docker-compose.yml up -d

Useful Log Commands

Backend, warehouse-service, payment-service and gateway:

docker compose -f lightweight-docker-compose.yml logs -f backend warehouse-service payment-service notification-service delivery-service llm-service gateway

All lightweight services:

docker compose -f lightweight-docker-compose.yml logs -f

The mocked LLM:

docker compose -f lightweight-docker-compose.yml logs -f ollama-mock

Commerce Features To Explore

Everything goes through http://localhost:8081 with a token from POST /api/v1/users/signin unless marked public. Swagger UI lists every parameter; the backend definition holds search, loyalty, gift cards, VAT, currencies and webhooks.

  • Product search: GET /api/v1/products/search?q=phone&category=Electronics&minPrice=100&maxPrice=900&minRating=4&inStock=true&sort=price_asc&page=0&size=10 returns results with facets. GET /api/v1/products without parameters is unchanged.
  • Shipment tracking: after the warehouse user ships an order without a tracking number, the simulated carrier advances it every two minutes (POST /api/v1/warehouse/shipments/{id}/carrier/advance skips ahead). Customers read GET /api/v1/orders/{id}/shipment/tracking; anyone can read GET /api/v1/tracking/{trackingNumber} without a token.
  • Payments: POST /api/v1/payments with an Idempotency-Key header and {orderId, card: {...}} pays a PENDING order. Test cards (any future expiry, any CVC): 4242 4242 4242 4242 succeeds, 4000 0000 0000 0002 is declined, 4000 0000 0000 9995 has insufficient funds, 4000 0000 0000 3220 needs 3-D Secure (POST /api/v1/payments/{id}/3ds with code 123456), 4000 0000 0000 0077 settles after 10 seconds. Full table: PAYMENT_SERVICE_CONTRACT.md. History: GET /api/v1/orders/{id}/payments; admins: GET /api/v1/admin/payments.
  • Loyalty points and gift cards: paid orders earn points; points and gift card balances can be applied at checkout and come back on refunds. See the loyalty and gift card sections of the backend definition in Swagger UI.
  • VAT and currencies: GET /api/v1/vat-rates, GET /api/v1/vat-rates/{country}, GET /api/v1/cart/tax-preview, GET /api/v1/currencies and GET /api/v1/currencies/convert (admins change rates under /api/v1/admin/vat-rates and /api/v1/admin/currencies).
  • Webhooks and the inbox: subscribe to order and shipment events under /api/v1/webhooks (served by notification-service). Without a public receiver, create a built-in inbox, subscribe with its inbox://<token> URL, send POST /api/v1/webhooks/{id}/test and read the signed request back through the API. Deliveries arrive up to 5 seconds after the change (they come from the event feed). Details: WEBHOOKS.md.
  • Stock reservations with a time limit: a new order holds its stock until reservationExpiresAt (30 minutes); unpaid orders are then cancelled with reason RESERVATION_EXPIRED and the stock returns. Admins can expire a hold at once with POST /api/v1/admin/orders/{id}/expire-reservation.
  • Stock owned by warehouse-service: checkout reserves stock in warehouse-service; a cancelled or expired order gets its stock back a few seconds later, once warehouse-service has processed the cancellation and pushed the new quantity to the backend. Tests that check the stock right after a cancel should poll for it. The stock history (GET /api/v1/admin/inventory/{productId}/movements) is read from warehouse-service.
  • Split shipments: an order whose products are stocked in different warehouses ships as several parcels; GET /api/v1/orders/{id}/shipments lists them with locationCode and parcelIndex.
  • Commerce emails: GET /api/v1/notifications/emails lists your payment, shipping, loyalty and gift card emails; account emails (password reset) stay in the backend.
  • Courier deliveries: every paid order gets a delivery in delivery-service (GET /api/v1/orders/{id}/delivery); a simulated courier moves it every 15 seconds after the warehouse ships. The order page links to Courier delivery status, a micro-frontend that delivery-service serves itself. Test controls (POST /api/v1/deliveries/{id}/courier/advance, a scripted outcome, pause) make it deterministic. Details: DELIVERY_SERVICE_CONTRACT.md.

The pinned images of every profile have all these features (see CONTAINER_RELEASES.md).

Look Into The Database

Checking what the UI or the API really stored is part of testing. The profile gives you two ways in:

  • pgweb, a database UI in the browser: http://localhost:8081/db/. It is read-only: browse tables, run SELECT queries, export results.
  • your own client (DBeaver, DataGrip, psql): host 127.0.0.1, port 15432, database testdb
  • tester / tester: reads every table, changes nothing (safe for exploring)
  • postgres / postgres: superuser, can change data (for preparing test data)

Each service keeps its tables in its own schema: public (backend: users, products, carts, orders), warehouse, payment, notification and delivery. In pgweb pick the schema in the table list on the left, or write it in the query, for example SELECT * FROM warehouse.shipments.

The port listens on 127.0.0.1 only and is 15432, not 5432, so a PostgreSQL of your own does not get in the way; DB_HOST_PORT=25432 docker compose ... up -d moves it. Without any client:

docker compose -f lightweight-docker-compose.yml exec postgres psql -U postgres -d testdb

The data is still temporary (see Your Data Is Temporary).

Client setup step by step, diagrams of the tables and ready-made queries that check totals, stock and the state of an order in every service: Database for testers.

Practise On Planted Bugs

The stack has a second mode for manual-testing practice: the same images with about fifty defects planted on purpose, across the shop, checkout, payments, the warehouse, deliveries, emails, webhooks and the AI assistant. Start it by adding the bug mode overlay:

docker compose -f lightweight-docker-compose.yml -f docker-compose.bugs.yml up -d

The shop then shows a Training mode badge next to the logo. Run up -d without the overlay to go back. Bug mode exists only on your laptop; the public sites never run it. Nothing in the documentation says which bugs are planted: finding them is the exercise. Details: Training stack with planted bugs.

Fault Injection (Chaos Lab)

To see how the services behave when a link between them breaks, start the same profile with the fault-injection lab. Nothing to install; one command line tool drives it:

scripts/chaos up                     # or: make chaos-up
scripts/chaos list                   # what you can break
scripts/chaos backend-down warehouse # warehouse-service loses the backend
scripts/chaos status                 # what is broken now
scripts/chaos heal                   # everything back to normal

The guided exercises are in the fault-injection lab guide:

  • a warehouse 503, an outbox backlog that drains, an event-feed consumer resuming from its cursor, a payment losing the race against an expiring reservation, a stalled database, following one request by X-Request-Id
  • checkout without the stock owner (warehouse-down, warehouse-slow), the stock copy catching up, the backend releasing a reservation whose answer was lost, and an orphaned stock reservation released by the reaper when that release is lost too
  • with the broker (scripts/chaos up lightweight broker): an event crossing the broker, a poison message in the dead-letter queue, a consumer that is down while its queue fills up, and the broker down for the backend

Add Jaeger traces with scripts/chaos up lightweight tracing (UI http://127.0.0.1:16686); the options combine, for example scripts/chaos up lightweight broker tracing.

Stop The Profile

docker compose -f lightweight-docker-compose.yml down

Because PostgreSQL runs in memory, down already discards all data. The profile creates no named volumes, so down --volumes is not needed (the monitoring overlay above is the exception).

Additional GraphQL and gRPC exercises

The backend serves GraphQL alongside REST. Use /api/v1/graphiql for schema exploration and queries with your normal JWT. Swagger continues to cover REST; it does not list GraphQL fields or native gRPC methods. The storefront starts in REST mode and offers a per-tab GraphQL selector.

Native gRPC is an optional local listener with four admin inventory operations, not a replacement for the entire backend. Enable it by adding the override file to the lightweight Compose command:

docker compose -f lightweight-docker-compose.yml -f docker-compose.grpc.yml up -d

The listener is published on 127.0.0.1:9091. See the classroom runbook and gRPC setup. Follow the protocol testing lab for equivalent stock adjustments, partial-error assertions, native status codes, and safe traffic monitoring.