Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Shashank-H/gaiter-gaurd/llms.txt
Use this file to discover all available pages before exploring further.
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:backend/.env with your production values:
3. Start all services
Launch the full stack with Docker Compose:4. Verify services
Check that all containers are healthy:| Service | URL | Description |
|---|---|---|
| Backend API | http://localhost:3000 | REST API for agents and dashboard |
| Frontend | http://localhost:4173 | React dashboard for approvals |
| PostgreSQL | localhost:5432 | Database (not exposed in production) |
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
Thedocker-compose.yaml defines three services:
db (PostgreSQL)
db (PostgreSQL)
pgdata) to retain data across container restarts.backend (Bun API)
backend (Bun API)
frontend (React + Vite)
frontend (React + Vite)
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 withbackend/ and frontend/ workspaces:
4. Configure backend environment
Createbackend/.env:
backend/.env
5. Run database migrations
Apply the Drizzle schema to PostgreSQL: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:src/ files auto-reload.
Available backend scripts (from backend/package.json):
7. Start the frontend
In a separate terminal:frontend/package.json):
8. Verify local setup
Test the backend health endpoint:Environment variables reference
Database
| Variable | Description | Example |
|---|---|---|
DATABASE_URL | PostgreSQL connection string | postgres://user:pass@host:5432/db |
Server
| Variable | Description | Default |
|---|---|---|
PORT | HTTP server port | 3000 |
NODE_ENV | Environment mode | development |
JWT Authentication
| Variable | Description | Default |
|---|---|---|
JWT_SECRET | Secret for signing JWTs | (required) |
JWT_ACCESS_EXPIRY | Access token TTL | 15m |
JWT_REFRESH_EXPIRY | Refresh token TTL | 7d |
Encryption
| Variable | Description | Notes |
|---|---|---|
ENCRYPTION_SECRET | AES-256-GCM encryption key | Min 32 chars |
ENCRYPTION_SALT | Salt for key derivation | Change per deployment |
LLM Risk Assessment
| Variable | Description | Example |
|---|---|---|
LLM_BASE_URL | OpenAI-compatible API base URL | https://api.openai.com/v1 |
LLM_API_KEY | API key for LLM provider | sk-... |
LLM_MODEL | Model identifier | gpt-4o-mini |
LLM_TIMEOUT_MS | Request timeout in milliseconds | 10000 |
Risk & Approval
| Variable | Description | Range |
|---|---|---|
RISK_THRESHOLD | Score at or above this triggers approval | 0.0–1.0 (default 0.5) |
APPROVAL_EXECUTE_TTL_HOURS | Hours until approved requests expire | Default 1 |
Production deployment
Recommended architecture
Use managed PostgreSQL
Instead of the
db container, use a managed PostgreSQL service (AWS RDS, Google Cloud SQL, Supabase) with automated backups and replication.Deploy backend with health checks
Deploy the
backend container to Kubernetes, ECS, or Fly.io. Configure health checks on GET /health.Serve frontend via CDN
Build the frontend (
bun run build) and serve static files via Cloudflare, Vercel, or S3 + CloudFront.Use HTTPS everywhere
Terminate TLS at a load balancer (ALB, Cloudflare). Never expose unencrypted API endpoints.
Security checklist
Secrets rotation
Secrets rotation
- Rotate
JWT_SECRETmonthly (invalidates all sessions) - Rotate
ENCRYPTION_SECRETwith data re-encryption migration - Use short-lived
LLM_API_KEYwith scoped permissions
Network isolation
Network isolation
- Run backend and database in a private VPC
- Expose only the backend API via load balancer
- Block direct database access from the internet
Monitoring
Monitoring
- Log all approval actions (who approved what, when)
- Alert on failed LLM risk assessments (fallback to method heuristics)
- Monitor
RISK_THRESHOLDhit rate (tune if too many/few approvals)
Access control
Access control
- Limit dashboard access to authorized personnel
- Use SSO/SAML for user authentication in production
- Audit who creates and revokes agent keys
Troubleshooting
Database connection errors
Database connection errors
Error:
ECONNREFUSED or relation does not existFix:- Verify PostgreSQL is running:
docker compose psorpg_isready - Check
DATABASE_URLmatches your PostgreSQL credentials - Run migrations:
bun run db:migrate - Check logs:
docker compose logs db
LLM timeout errors
LLM timeout errors
Error:
Risk assessment failed: timeoutFix:- Increase
LLM_TIMEOUT_MSto 20000 (20 seconds) - Verify
LLM_API_KEYis valid and has quota - Check
LLM_BASE_URLis reachable from the backend container - Monitor LLM provider status page
Frontend can't reach backend
Frontend can't reach backend
Error:
Network error in browser consoleFix:- Verify backend is running:
curl http://localhost:3000/health - Check
VITE_API_URLin frontend.envordocker-compose.yaml - Ensure CORS is configured (backend allows
http://localhost:5173in dev) - For production, update
VITE_API_URLto your backend domain
Migrations fail on startup
Migrations fail on startup
Error:
migration failed in backend logsFix:- Drop and recreate the database:
dropdb gaiterguard && createdb gaiterguard - Run migrations manually:
cd backend && bun run db:migrate - Check for schema conflicts if you modified
schema.ts - 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.