Introduction to GuildGate
GuildGate provides a guarded action kernel and infrastructure contracts for Discord dashboard servers. It keeps sessions, exact-origin checks, CSRF, authorization, idempotency, transactions, cache, audit, realtime delivery, and operator actions in one server-side decision pipeline.
These docs follow @kavtuai/guildgate@1.1.1. The package requires Node.js 22 or newer.
What the library handles
- Opaque session tokens, absolute expiry, idle expiry, rotation, and revocation
- Discord OAuth state and encrypted credential storage contracts
- Exact-origin and session-bound CSRF verification
- Separate user and bot permission decisions
- Rate limits, idempotency, optimistic revisions, and distributed leases
- Transactions, post-commit callbacks, cache invalidation, audit, and outbox delivery
- Authorized WebSocket, Socket.IO, and SSE subscriptions with sequence and replay
- PostgreSQL, Redis, memory, and custom store contracts
- Operator actions, analytics, status monitoring, and OpenTelemetry hooks
What remains in the application
GuildGate is not a dashboard UI, ORM, or Discord command system. Resource ownership, role policy, domain validation, database schema, Discord request budgets, retention, backups, and incident response remain application responsibilities.
Stable reliability boundary
A successful database commit is final. A cache, realtime, or observer callback failure after commit does not report the domain write as rolled back and does not rerun the operation. The PostgreSQL adapter uses savepoints for nested transactions.
Idempotency records carry reservation ownership through reservationId. A stale worker cannot complete or delete a newer reservation. An action deadline returns at the configured boundary; a late idempotent operation is observed for a bounded settlement window and a committed result is stored for replay.
Realtime transports share payload, rate, activity, subscription, and backpressure limits. Audit pagination uses an opaque (createdAt, id) cursor. Outbox delivery is at least once, so consumers that produce external side effects must deduplicate by event ID.