Skip to content

Lock down public entry point, fix gateway proxy and Redis idempotency bugs - #9

Merged
devinder-dev merged 1 commit into
mainfrom
fix-exam-criteria
Jun 21, 2026
Merged

devinder-dev merged 1 commit into
mainfrom
fix-exam-criteria

Conversation

@devinder-dev

Copy link
Copy Markdown
Owner

Summary

  • Single public entry point: nginx is now the only published port (80). postgres/redis/rabbitmq/gateway no longer expose host ports in docker-compose.yml; a docker-compose.dev.yml override (not auto-merged) restores them for local debugging.
  • Fixed a real bug: the gateway proxy was completely broken — @fastify/http-proxy's underlying undici Pool isn't compatible with Bun's fetch implementation, so every proxied request threw. Replaced with a native fetch()-based proxy.
  • Fixed a second real bug: RedisIdempotency read REDIS_URL into a module-level constant at import time instead of inside the constructor, so it could lock in the wrong Redis URL depending on import order in tests.
  • Added pure unit tests for order total calculation and retry backoff math.
  • Rewrote README to match the current system and document the single public entry point.

Test plan

  • bun run typecheck clean
  • bun run test green across all packages (order, kitchen, notification, menu, shared, e2e)
  • docker compose up --build then verified via docker compose ps that only nginx publishes a port
  • Full order flow verified through nginx alone (menu read, place order, status check, 404)
  • docker-compose.dev.yml override verified to restore infra ports without exposing the gateway
  • Snyk code scan: 0 issues

…tency bugs

- nginx is now the sole published port (80); postgres/redis/rabbitmq/gateway
  no longer expose host ports in docker-compose.yml. docker-compose.dev.yml
  adds them back for local debugging only (not auto-merged).
- Replace @fastify/http-proxy with a native fetch()-based proxy in the
  gateway: the plugin's underlying undici Pool usage isn't compatible with
  Bun's runtime and broke every proxied request.
- Move RedisIdempotency's REDIS_URL read into the constructor instead of a
  module-level constant, so it picks up env vars set after the shared
  package's barrel is first imported (was silently connecting to the wrong
  Redis URL in some test orderings).
- Add pure unit tests for order total calculation and retry backoff math.
- Rewrite README to match the current system and document the single
  public entry point.
@devinder-dev
devinder-dev merged commit 909b507 into main Jun 21, 2026
1 check passed
@devinder-dev
devinder-dev deleted the fix-exam-criteria branch June 21, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant