gateway
Purpose and Production Relevance
gateway is a Go router/gateway service for an alternate or earlier edge architecture. It handles custom loaders, tracking collection, identity resolution, and Redis-backed config cache in its own model.
Production relevance: legacy/experimental context. Current internal docs explicitly say the Go gateway exists but is not part of the production tagging path; production tagging uses gtm-proxy.
Stack and Main Dependencies
- Go 1.24.
- Echo web framework.
- PostgreSQL via pgx.
- Redis.
- Google Pub/Sub.
- Viper configuration.
- Docker/testcontainers in dependencies.
Important files and folders:
gateway/cmdgateway/internalgateway/proxygateway/go.modgateway/docker-compose.yml
Business Responsibilities
The gateway was designed to:
- Serve custom GTM loader scripts.
- Proxy or capture
/collectand/g/collect. - Publish tagging events to Pub/Sub for async processing.
- Detect preview/debug and proxy synchronously.
- Resolve identity via
/api/i. - Serve capture config.
- Invalidate Redis route/config cache.
Technical Architecture and Source-Code Entry Points
Layering:
cmd: binary entry point.internal/core: business/domain logic.internal/adapter: adapters.internal/infrastructure: persistence, Pub/Sub, Redis, config.proxy: reverse proxy logic.
Key Data Flows and Service Integrations
Gateway architecture overlaps with gtm-proxy plus some identity/capture responsibilities:
- Browser request enters gateway.
- Gateway decides async event publish versus sync preview proxy.
- Gateway reads PostgreSQL/Redis route data.
- Gateway publishes Pub/Sub events for worker processing.
- Gateway writes/merges identity data.
Environment, Deploy, and Runtime Notes
Common commands:
cd gateway
go test ./...
go run cmd/gateway/main.go
docker compose up --build
Before using this project for new work, confirm whether the target behavior belongs in current gtm-proxy/gtm-fabric instead.
Debugging Checklist
- If testing historical routing, check Redis and PostgreSQL configuration.
- If Pub/Sub publish fails, check credentials and topic names.
- If identity resolution differs from current product behavior, compare against
gtm-fabricandnode-apiCRM capture docs. - Do not patch this service for production tagging issues unless deployment confirms it is active.
Tests or Validation Commands
cd gateway
go test ./...
Mastery Checklist
- Explain what this gateway tried to own.
- Explain why current docs prefer
gtm-proxyfor production edge routing. - Know how to mine this code for historical context without mixing architectures.