Skip to content

Commit ca70f36

Browse files
Initial commit: orderflow sample app
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit ca70f36

91 files changed

Lines changed: 13556 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# OS / editor
2+
.DS_Store
3+
.idea/
4+
.vscode/
5+
6+
# Secrets — never commit
7+
gh_token.txt
8+
*.pem
9+
*.key
10+
.env
11+
.env.*
12+
13+
# Logs
14+
*.log
15+
log*.txt
16+
cloud.log
17+
18+
# Archives / binaries
19+
*.zip
20+
*.tar
21+
*.tar.gz
22+
23+
# Temp / generated
24+
*-tmp.yaml
25+
*-tmp.yml
26+
mock.yaml
27+
12.txt
28+
29+
# Local Keploy runtime artifacts
30+
keploy/reports/
31+
keploy/logs/
32+
33+
# Vendored Istio release (download separately)
34+
orderflow-k8s/istio-*/

Makefile

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.PHONY: up down build logs producer consumer clean test-order test-shard1 test-shard2 check-s3 check-kafka check-pg1 check-pg2
2+
3+
## Start all services
4+
up:
5+
chmod +x scripts/init_localstack.sh
6+
docker-compose up --build
7+
8+
## Start in detached mode
9+
up-d:
10+
chmod +x scripts/init_localstack.sh
11+
docker-compose up --build -d
12+
13+
## Stop all services
14+
down:
15+
docker-compose down
16+
17+
## Stop and wipe volumes
18+
clean:
19+
docker-compose down -v
20+
21+
## View logs
22+
logs:
23+
docker-compose logs -f
24+
25+
## View only producer logs
26+
logs-producer:
27+
docker-compose logs -f producer
28+
29+
## View only consumer logs
30+
logs-consumer:
31+
docker-compose logs -f consumer
32+
33+
## Build images only
34+
build:
35+
docker-compose build
36+
37+
## Health check
38+
health:
39+
curl -s http://localhost:8080/health | jq .
40+
41+
## List all orders
42+
list-orders:
43+
curl -s http://localhost:8080/api/orders | jq .
44+
45+
## Place a test order (Shard 1 - user starts with A)
46+
test-shard1:
47+
curl -s -X POST http://localhost:8080/api/orders \
48+
-H "Content-Type: application/json" \
49+
-d '{"user_id":"alice","product_name":"Mechanical Keyboard","quantity":2,"price":149.99}' | jq .
50+
51+
## Place a test order (Shard 2 - user starts with Z)
52+
test-shard2:
53+
curl -s -X POST http://localhost:8080/api/orders \
54+
-H "Content-Type: application/json" \
55+
-d '{"user_id":"zara","product_name":"4K Monitor","quantity":1,"price":399.99}' | jq .
56+
57+
## Place 5 test orders across both shards
58+
test-bulk:
59+
@echo "--- Placing orders across both shards ---"
60+
curl -s -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" \
61+
-d '{"user_id":"alice","product_name":"Keyboard","quantity":1,"price":99.99}' | jq .shard
62+
curl -s -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" \
63+
-d '{"user_id":"bob","product_name":"Mouse","quantity":2,"price":49.99}' | jq .shard
64+
curl -s -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" \
65+
-d '{"user_id":"nancy","product_name":"Monitor","quantity":1,"price":299.99}' | jq .shard
66+
curl -s -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" \
67+
-d '{"user_id":"zara","product_name":"Webcam","quantity":3,"price":79.99}' | jq .shard
68+
curl -s -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" \
69+
-d '{"user_id":"omar","product_name":"Desk Mat","quantity":1,"price":39.99}' | jq .shard
70+
71+
## Check Postgres Shard 1
72+
check-pg1:
73+
docker exec -it orderflow-postgres_shard1-1 psql -U orderuser -d orders_shard1 \
74+
-c "SELECT id, user_id, product_name, quantity, price, status, created_at FROM orders ORDER BY created_at DESC LIMIT 10;"
75+
76+
## Check Postgres Shard 2
77+
check-pg2:
78+
docker exec -it orderflow-postgres_shard2-1 psql -U orderuser -d orders_shard2 \
79+
-c "SELECT id, user_id, product_name, quantity, price, status, created_at FROM orders ORDER BY created_at DESC LIMIT 10;"
80+
81+
## Check S3 receipts
82+
check-s3:
83+
aws --endpoint-url=http://localhost:4566 \
84+
--region us-east-1 \
85+
--no-sign-request \
86+
s3 ls s3://order-receipts/receipts/ --recursive
87+
88+
## Watch Kafka topic live
89+
watch-kafka:
90+
docker exec orderflow-kafka-1 kafka-console-consumer \
91+
--bootstrap-server localhost:9092 \
92+
--topic orders \
93+
--from-beginning \
94+
--property print.key=true \
95+
--property key.separator=""

0 commit comments

Comments
 (0)