Domain APIs POC

Proof-of-concept Domain APIs demonstrating orchestration patterns for UK tax services.

Current: VPD Submission Returns

The VPD (Vaping Products Duty) Submission Returns Domain API orchestrates three backend services through a unified interface:

  • excise - VPD registrations, periods, duty calculations
  • customer - Trader/customer master data
  • tax-platform - Submission storage and retrieval

Quick Start

# Start all services
docker-compose up -d
 
# Verify mocks are running
curl http://localhost:4010/excise/vpd/registrations/VPD123456 | jq .
curl http://localhost:4011/customers/CUST789 | jq .
curl http://localhost:4012/submissions/vpd/ACK-2026-01-26-000123 | jq .
 
# Open API Explorer (via docs site)
open http://localhost:8080/explorer.html
 
# Open Grafana (observability)
open http://localhost:3000  # admin/admin
 
# Open Docs
open http://localhost:8080

Services

ServicePortDescription
excise-mock4010VPD registrations, periods, duty calculations
customer-mock4011Trader/customer master data
tax-platform-mock4012Submission storage and retrieval
docs8080Documentation + API Explorer
lgtm3000Grafana + Loki + Tempo + Mimir
localstack4566AWS LocalStack (API Gateway)

Directory Structure

domain-apis/
├── docker-compose.yml           # Full stack definition
├── specs/
│   └── vaping-duty/
│       ├── domain/              # Domain API specifications
│       │   ├── producer/        # Producer OAS (source of truth)
│       │   ├── platform/        # Platform OAS (generated)
│       │   └── fragments/       # Reusable OAS fragments
│       ├── mocks/               # Backend mock specifications
│       │   ├── excise-api.yaml
│       │   ├── customer-api.yaml
│       │   └── tax-platform-api.yaml
│       ├── tests/load/          # k6 load test scripts
│       └── README.md
├── docs/                        # Documentation site
├── tests/                       # Integration tests
└── tools/                       # Utility scripts

Backend Mock APIs

Excise Service (4010)

# Get registration
curl http://localhost:4010/excise/vpd/registrations/VPD123456
 
# Get period
curl http://localhost:4010/excise/vpd/periods/24A1
 
# Validate and calculate
curl -X POST http://localhost:4010/excise/vpd/validate-and-calculate \
  -H "Content-Type: application/json" \
  -d '{"vpdApprovalNumber":"VPD123456","periodKey":"24A1","submission":{}}'

Customer Service (4011)

curl http://localhost:4011/customers/CUST789

Tax Platform Service (4012)

# Store submission
curl -X POST http://localhost:4012/submissions/vpd \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: test-123" \
  -d '{"vpdApprovalNumber":"VPD123456","periodKey":"24A1","customerId":"CUST789","submission":{},"calculations":{},"warnings":[]}'
 
# Get by acknowledgement
curl http://localhost:4012/submissions/vpd/ACK-2026-01-26-000123

Test Data

ResourcePatternExample
VPD Approval NumberVPD[0-9]{6}VPD123456
Period Key[0-9]{2}[A-Z][0-9]24A1
Customer IDCUST[0-9]+CUST789
AcknowledgementACK-YYYY-MM-DD-NNNNNNACK-2026-01-26-000123

Load Testing

# Install k6
brew install k6
 
# Run smoke test against mocks
k6 run specs/vaping-duty/tests/load/smoke-test-mocks.js

Generate Documentation

# Install dependencies (first time)
npm install
 
# Generate Redoc documentation
./tools/generate-docs.sh

Documentation

1 item under this folder.