Skip to main content

Deployment options

GaiterGuard supports two installation modes:

Docker (recommended)

Production-ready deployment with PostgreSQL, backend, and frontend in containers.

Local development

Run backend and frontend with hot reload for active development and testing.

Docker installation

Prerequisites: Docker 20.10+ and Docker Compose 2.0+

1. Clone the repository

2. Configure environment variables

Copy the example environment file:
Edit backend/.env with your production values:
Security best practices:
  • Use openssl rand -hex 32 to generate JWT_SECRET and ENCRYPTION_SECRET
  • Set ENCRYPTION_SECRET to at least 32 characters for AES-256-GCM
  • Never commit .env files to version control
  • Rotate secrets regularly in production

3. Start all services

Launch the full stack with Docker Compose:
For detached mode (runs in background):

4. Verify services

Check that all containers are healthy:
The backend automatically runs database migrations on startup via bun run db:migrate. Check logs if you see “relation does not exist” errors.

5. Docker Compose reference

The docker-compose.yaml defines three services:
The database uses a persistent volume (pgdata) to retain data across container restarts.
The backend waits for PostgreSQL to be healthy before starting. Runs migrations automatically.
The frontend is served as a static build via vite preview. Update VITE_API_URL if deploying to a different domain.

Local development

Prerequisites: Bun v1.x, PostgreSQL 16+

1. Install Bun

If you don’t have Bun installed:

2. Set up PostgreSQL

Start a local PostgreSQL instance:

3. Install dependencies

This is a monorepo with backend/ and frontend/ workspaces:

4. Configure backend environment

Create backend/.env:
backend/.env
Bun automatically loads .env files — no need for dotenv packages.

5. Run database migrations

Apply the Drizzle schema to PostgreSQL:
This runs drizzle-kit push to sync your schema with the database. You’ll see output like:
If you modify backend/src/db/schema.ts, run bun run db:generate to generate migrations, then bun run db:migrate to apply them.

6. Start the backend

Run the backend server with hot reload:
The server starts at http://localhost:3000 with hot module replacement. Changes to src/ files auto-reload. Available backend scripts (from backend/package.json):

7. Start the frontend

In a separate terminal:
The Vite dev server starts at http://localhost:5173 with HMR (hot module replacement). Available frontend scripts (from frontend/package.json):

8. Verify local setup

Test the backend health endpoint:
Expected response:
Open the frontend at http://localhost:5173 and create a test account.

Environment variables reference

Database

Server

JWT Authentication

Encryption

LLM Risk Assessment

You can use any OpenAI-compatible API (OpenAI, Azure OpenAI, Together AI, Ollama with openai-compat mode). Just change LLM_BASE_URL and LLM_API_KEY.

Risk & Approval


Production deployment

1

Use managed PostgreSQL

Instead of the db container, use a managed PostgreSQL service (AWS RDS, Google Cloud SQL, Supabase) with automated backups and replication.
2

Deploy backend with health checks

Deploy the backend container to Kubernetes, ECS, or Fly.io. Configure health checks on GET /health.
3

Serve frontend via CDN

Build the frontend (bun run build) and serve static files via Cloudflare, Vercel, or S3 + CloudFront.
4

Use HTTPS everywhere

Terminate TLS at a load balancer (ALB, Cloudflare). Never expose unencrypted API endpoints.
5

Set up secret management

Store JWT_SECRET, ENCRYPTION_SECRET, and LLM_API_KEY in AWS Secrets Manager, HashiCorp Vault, or your platform’s secret store.

Security checklist

  • Rotate JWT_SECRET monthly (invalidates all sessions)
  • Rotate ENCRYPTION_SECRET with data re-encryption migration
  • Use short-lived LLM_API_KEY with scoped permissions
  • Run backend and database in a private VPC
  • Expose only the backend API via load balancer
  • Block direct database access from the internet
  • Log all approval actions (who approved what, when)
  • Alert on failed LLM risk assessments (fallback to method heuristics)
  • Monitor RISK_THRESHOLD hit rate (tune if too many/few approvals)
  • Limit dashboard access to authorized personnel
  • Use SSO/SAML for user authentication in production
  • Audit who creates and revokes agent keys

Troubleshooting

Error: ECONNREFUSED or relation does not existFix:
  1. Verify PostgreSQL is running: docker compose ps or pg_isready
  2. Check DATABASE_URL matches your PostgreSQL credentials
  3. Run migrations: bun run db:migrate
  4. Check logs: docker compose logs db
Error: Risk assessment failed: timeoutFix:
  1. Increase LLM_TIMEOUT_MS to 20000 (20 seconds)
  2. Verify LLM_API_KEY is valid and has quota
  3. Check LLM_BASE_URL is reachable from the backend container
  4. Monitor LLM provider status page
When the LLM fails, GaiterGuard falls back to method-based heuristics (+0.3 risk boost), so DELETE/PUT requests are blocked until the LLM recovers.
Error: Network error in browser consoleFix:
  1. Verify backend is running: curl http://localhost:3000/health
  2. Check VITE_API_URL in frontend .env or docker-compose.yaml
  3. Ensure CORS is configured (backend allows http://localhost:5173 in dev)
  4. For production, update VITE_API_URL to your backend domain
Error: migration failed in backend logsFix:
  1. Drop and recreate the database: dropdb gaiterguard && createdb gaiterguard
  2. Run migrations manually: cd backend && bun run db:migrate
  3. Check for schema conflicts if you modified schema.ts
  4. Generate fresh migrations: bun run db:generate

Next steps

Quickstart

Test your installation with a complete proxy workflow.

Configuration

Tune risk thresholds, approval TTLs, and LLM provider settings.

Agent integration

Integrate GaiterGuard into your AI agent codebase.

Architecture

Understand how GaiterGuard works under the hood.