gateway profile. For production, you can break them out to separate instances for horizontal scaling and maximum uptime.
Architecture Overview
When scaled out, the gateway services run independently and connect back to the main Datawizz instance for configuration:Running the AI Gateway
The AI Gateway fetches its configuration (projects, endpoints, prompts) from the Datawizz API via Supabase. It caches configurations in-memory and uses Supabase Realtime for instant cache invalidation when configurations change in the dashboard.Docker Run
Environment Variables
Cache Invalidation
The gateway subscribes to Supabase Realtime for automatic cache invalidation. When you update a project, endpoint, or prompt in the Datawizz dashboard, all gateway instances invalidate their cached data within seconds. If the Realtime connection fails, the gateway continues operating normally and cached entries expire based on the TTL setting.Health Check
The gateway exposes a health endpoint at/health:
Running the Request Logger
The Request Logger batches inference logs and writes them to ClickHouse. It also forwards results to the Evaluator Runner for automated scoring.Running the Evaluator Runner
The Evaluator Runner executes custom evaluators on inference results.Updating the Main Instance
After deploying the gateway services externally, update the.env on the main Datawizz instance so the app knows where to find them:
gateway profile and restart the app:
If you had previously used the
gateway profile, stop and remove the local gateway containers: docker compose --profile gateway down.Horizontal Scaling
You can run multiple instances of the AI Gateway behind a load balancer for high availability. Each instance independently fetches and caches configuration from the Datawizz API, so no shared state is needed between gateway nodes. A typical setup:- Run 2+ AI Gateway containers across separate machines
- Place them behind a load balancer (e.g. AWS ALB, Nginx, Caddy)
- All gateway instances point to the same Request Logger (or a logger cluster)
- The Request Logger writes to ClickHouse