|
| 1 | +# Copilot Instructions for aks-store-demo |
| 2 | + |
| 3 | +## Architecture |
| 4 | + |
| 5 | +This is a polyglot microservices demo app for Azure Kubernetes Service (AKS). Services communicate via RabbitMQ (order queue) and persist data in DocumentDB (MongoDB-compatible). |
| 6 | + |
| 7 | +**Services and their tech stacks:** |
| 8 | + |
| 9 | +| Service | Language/Framework | Port | Purpose | |
| 10 | +|---------|-------------------|------|---------| |
| 11 | +| order-service | Node.js / Fastify | 3000 | Accepts orders, publishes to RabbitMQ | |
| 12 | +| makeline-service | Go / Gin | 3001 | Consumes orders from queue, marks complete | |
| 13 | +| product-service | Rust / Actix-web | 3002 | CRUD for product catalog | |
| 14 | +| store-front | Vue 3 / Vite / TypeScript | 8080 | Customer-facing web app | |
| 15 | +| store-admin | Vue 3 / Vite / TypeScript | 8081 | Employee web app for order/product management | |
| 16 | +| ai-service | Python / FastAPI | 5001 | Generative AI for product descriptions/images | |
| 17 | +| virtual-customer | Rust | - | Simulates order creation | |
| 18 | +| virtual-worker | Rust | - | Simulates order completion | |
| 19 | + |
| 20 | +**Infrastructure dependencies:** RabbitMQ (message queue), DocumentDB/MongoDB (persistence). Azure Service Bus and Cosmos DB are supported as cloud alternatives. |
| 21 | + |
| 22 | +**Data flow:** store-front -> order-service -> RabbitMQ -> makeline-service -> DocumentDB. The product-service reads/writes products directly to DocumentDB. |
| 23 | + |
| 24 | +## Build & Run |
| 25 | + |
| 26 | +### Full stack (Docker Compose) |
| 27 | + |
| 28 | +```bash |
| 29 | +docker compose up --build |
| 30 | +``` |
| 31 | + |
| 32 | +### Individual services |
| 33 | + |
| 34 | +Each service has its own `Dockerfile` and most have a `docker-compose.yml` in their directory for isolated development. |
| 35 | + |
| 36 | +```bash |
| 37 | +# order-service |
| 38 | +cd src/order-service && npm install && npm run dev |
| 39 | + |
| 40 | +# makeline-service |
| 41 | +cd src/makeline-service && go run . |
| 42 | + |
| 43 | +# product-service |
| 44 | +cd src/product-service && cargo run |
| 45 | + |
| 46 | +# store-front or store-admin |
| 47 | +cd src/store-front && npm install && npm run dev |
| 48 | + |
| 49 | +# ai-service |
| 50 | +cd src/ai-service && pip install -r requirements.txt && uvicorn main:app --reload --port 5001 |
| 51 | +``` |
| 52 | + |
| 53 | +### Build all container images |
| 54 | + |
| 55 | +```bash |
| 56 | +make build # builds all service images |
| 57 | +``` |
| 58 | + |
| 59 | +## Testing |
| 60 | + |
| 61 | +### Vue frontends (store-front, store-admin) |
| 62 | + |
| 63 | +```bash |
| 64 | +cd src/store-front |
| 65 | +npm run test:unit # Vitest unit tests |
| 66 | +npm run test:e2e # Playwright e2e tests |
| 67 | +npm run lint # oxlint + eslint (with --fix) |
| 68 | +npm run type-check # vue-tsc |
| 69 | +``` |
| 70 | + |
| 71 | +### order-service |
| 72 | + |
| 73 | +```bash |
| 74 | +cd src/order-service |
| 75 | +npm test # tap test runner |
| 76 | +``` |
| 77 | + |
| 78 | +### product-service |
| 79 | + |
| 80 | +```bash |
| 81 | +cd src/product-service |
| 82 | +cargo test |
| 83 | +``` |
| 84 | + |
| 85 | +### ai-service |
| 86 | + |
| 87 | +```bash |
| 88 | +cd src/ai-service |
| 89 | +pytest |
| 90 | +pylint main.py routers/ |
| 91 | +``` |
| 92 | + |
| 93 | +### End-to-end tests (root-level) |
| 94 | + |
| 95 | +```bash |
| 96 | +cd tests |
| 97 | +npm install |
| 98 | +npx playwright test # all e2e tests |
| 99 | +npx playwright test e2e/store-front/basic.spec.ts # single test file |
| 100 | +npx playwright test --headed # with browser UI |
| 101 | +``` |
| 102 | + |
| 103 | +These tests require the app to be running and need configuration via environment variables (see `tests/TEST_CONFIG.md`). |
| 104 | + |
| 105 | +## Deployment |
| 106 | + |
| 107 | +### Azure Developer CLI (azd) |
| 108 | + |
| 109 | +```bash |
| 110 | +azd up # provisions infrastructure and deploys |
| 111 | +``` |
| 112 | + |
| 113 | +Infrastructure is defined in `infra/terraform` (default) or `infra/bicep`. The `azure.yaml` file configures the azd workflow with hooks in `azd-hooks/`. |
| 114 | + |
| 115 | +### Kubernetes manifests |
| 116 | + |
| 117 | +- `aks-store-quickstart.yaml` - minimal deployment |
| 118 | +- `aks-store-all-in-one.yaml` - full deployment with all services |
| 119 | +- `charts/aks-store-demo/` - Helm chart |
| 120 | +- `kustomize/` - Kustomize overlays |
| 121 | + |
| 122 | +### Makefile targets |
| 123 | + |
| 124 | +```bash |
| 125 | +make local # build images, load into kind, deploy via kustomize |
| 126 | +make azure # provision Azure resources and deploy |
| 127 | +make help # list all targets |
| 128 | +``` |
| 129 | + |
| 130 | +## Conventions |
| 131 | + |
| 132 | +- Each service is fully self-contained in `src/<service-name>/` with its own Dockerfile, dependencies, and README. |
| 133 | +- Vue frontends use Composition API with `<script setup>`, Pinia for state, and Vue Router. |
| 134 | +- Vue frontends use a two-tier linting pipeline: oxlint (fast, correctness rules) then eslint. |
| 135 | +- Prettier is configured at root (`.prettierrc.json`) and used by both Vue apps. |
| 136 | +- HTTP test files (`test-*.http`) exist in each backend service directory for manual API testing. |
| 137 | +- Environment variables configure service connections (see `.env` files and docker-compose). |
| 138 | +- The `ai-service` is optional; the app functions without it. |
0 commit comments