Gate Docs

Auth proxy. Add API key auth, session login, rate limiting, and access logs to any service.

Overview

Auth proxy. Add API key auth, session login, rate limiting, and access logs to any service. License: Apache 2.0. Default port: 8780.

Part of the Stockyard family of developer tools. See the product page →

Install

curl -fsSL https://stockyard.dev/gate/install.sh | sh

Or download a release binary from GitHub Releases.

Quickstart

# Install
curl -fsSL https://stockyard.dev/gate/install.sh | sh

# Run
GATE_UPSTREAM=http://localhost:3000 GATE_ADMIN_KEY=secret gate

# Create an API key
curl -s -X POST http://localhost:8780/gate/api/keys \
  -H 'Authorization: Bearer secret' \
  -H 'Content-Type: application/json' \
  -d '{"name":"alice"}'
# Save the key — it's only shown once

# Access the upstream using the key
curl -H 'Authorization: Bearer sk-gate-...' http://localhost:8780/your/path

Environment Variables

Variable Description Default
PORTHTTP listen port8780
DATA_DIRSQLite data directory./data
GATE_UPSTREAMUpstream service URLhttp://localhost:3000
GATE_ADMIN_KEYAdmin API keyrequired
GATE_RPMRate limit (requests per minute, 0 = off)60
GATE_CORS_ORIGINSAllowed CORS origins (comma-separated or *)

API Reference

POST/gate/login
Session login (username + password → cookie)
POST/gate/logout
Clear session cookie
GET/gate/api/keys
List API keys (admin)
POST/gate/api/keys
Create API key (admin)
DELETE/gate/api/keys/{id}
Delete API key (admin)
GET/gate/api/users
List users (admin)
POST/gate/api/users
Create user (admin)
GET/gate/api/logs
Access log (admin)
GET/gate/api/stats
Usage stats (admin)
GET/gate/health
Health check
*/*
All other requests proxied to upstream (requires auth)
Note — Admin endpoints require Authorization: Bearer <admin-key>. The admin key is set via the environment variable for this tool.

Deployment

Run the binary directly or use the provided Dockerfile. Set DATA_DIR to a persistent volume path. The binary is statically linked with no external dependencies.

docker build -t gate .
docker run -e FENCE_ADMIN_KEY=secret -v /data:/data -p 8780:8780 gate

When to use Stockyard instead

If you're building LLM-powered applications and need request tracing, cost tracking across 16 providers, model routing, prompt management, and team collaboration tools — Stockyard is the full platform. It includes capabilities from across the focused tools family in one binary.