Skip to main content

Example projects

The package examples/ directory contains small integrations. Adapt each example to your own authorization, storage, and deployment conditions.

Adapters​

  • Fastify: @kavtuai/guildgate/fastify
  • Express: @kavtuai/guildgate/express
  • Hono: @kavtuai/guildgate/hono
  • discord.js: @kavtuai/guildgate/discordjs

An HTTP adapter establishes the response boundary; parsing, resource lookup, authorization, idempotency, transactions, and audit remain in the action definition.

PostgreSQL and Redis​

const postgres = createPostgresAdapter({pool});
await postgres.migrate();

const stores = composeStores(
postgres.stores,
createRedisEphemeralStores(redis),
);

Realtime and testing​

createRealtimeHub(), attachWebSocket(), attachSocketIo(), and createServerSentEventStream() share the same session and authorization kernel. A custom transport must call hub.acceptMessage() before handling a client message.

const harness = createGuildGateTestHarness();
const login = await harness.login("user-1", "en");

Do not leave memory stores in production. Verify custom stores through runStoreContract() and driver-specific race tests.