Documentation Index
Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt
Use this file to discover all available pages before exploring further.
1. Quick Start (Dev)
| Account | API key | Mode |
|---|---|---|
| Live | dev-api-key-local | Normal consent flow |
| Sandbox | sandbox-api-key-local | Auto-approves grants, returns code immediately |
2. Generating a Production RSA Key
Grantex signs grant tokens with RSA-256. Generate a 2048-bit private key:RSA_PRIVATE_KEY.
Keep
private.pem out of source control. The JWKS endpoint exposes only the public key.3. Production Docker Compose
Prerequisites
- Docker 24+ with Compose v2
- A domain name with DNS pointing to your server
- TLS certificate (Let’s Encrypt for production)
Step 1 — Fill in the env file
.env.prod and replace every change-me-* placeholder. Set RSA_PRIVATE_KEY to the collapsed PEM and JWT_ISSUER to your public base URL.
Step 2 — Provide TLS certificates
Step 3 — Start the stack
4. Kubernetes / Helm
Prerequisites
- Kubernetes 1.26+, Helm 3.x
- Managed PostgreSQL and Redis
- An RSA private key (Section 2)
Install
Enable Ingress
Use an existing Secret
5. Environment Variable Reference
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | — | PostgreSQL connection string |
REDIS_URL | Yes | — | Redis connection string |
RSA_PRIVATE_KEY | Yes* | — | PEM private key for JWT signing. *Or set AUTO_GENERATE_KEYS=true (dev only) |
AUTO_GENERATE_KEYS | No | false | Auto-generate RSA keypair at startup (dev only) |
JWT_ISSUER | Yes | https://grantex.dev | iss claim in every JWT |
PORT | No | 3001 | Port the auth service listens on |
HOST | No | 0.0.0.0 | Bind address |
SEED_API_KEY | No | — | Pre-seed a live developer API key (dev only) |
SEED_SANDBOX_KEY | No | — | Pre-seed a sandbox API key (dev only) |
STRIPE_SECRET_KEY | No | — | Enable Stripe billing integration |
STRIPE_WEBHOOK_SECRET | No | — | Stripe webhook signature validation |
STRIPE_PRICE_PRO | No | — | Stripe price ID for Pro tier |
STRIPE_PRICE_ENTERPRISE | No | — | Stripe price ID for Enterprise tier |
6. Database Migrations
Migrations run automatically on every startup. The auth service reads all*.sql files from the migrations/ directory and executes each one using idempotent DDL (CREATE TABLE IF NOT EXISTS, etc.).
There are currently 9 migration files covering: core tables, webhooks, consent, delegation, compliance, policies, anomalies, SCIM/SSO, and developer email.
To upgrade, just restart the service — new migration files are applied automatically.
7. Key Rotation
- Generate a new RSA key pair (Section 2)
- Update
RSA_PRIVATE_KEYin your env file or Kubernetes secret - Restart the auth service
8. Health Checks & Monitoring
9. Backup & Recovery
PostgreSQL
Redis
Redis holds ephemeral token metadata and rate-limiting state. If Redis data is lost, in-flight auth requests will fail temporarily, but no permanent data is lost. PostgreSQL is the source of truth.10. Production Readiness Checklist
-
RSA_PRIVATE_KEYis a real 2048-bit RSA key -
POSTGRES_PASSWORDandREDIS_PASSWORDare strong random values -
SEED_API_KEYandSEED_SANDBOX_KEYare not set - TLS is enabled end-to-end
- Database and Redis ports are not exposed publicly
-
JWT_ISSUERmatches your public base URL exactly - Automated database backups are configured
- Health checks are wired into your load balancer
- CPU and memory limits are set
- Log forwarding is configured