GraphQL Overview
Gauze exposes GraphQL through realm-specific schemas. Each realm has its own endpoint, authorization context, JWT audience, and generated operation surface.
/environment/graphqlhandles authentication, environment sessions, proxy sessions, and realm entry./system/graphqlis the usual application-facing endpoint after a caller has entered the system realm./database/graphqlexposes lower-level generated entity operations directly.
Start the HTTP Server
Run:
npx gauze project ./my-app application serveThe server is a Koa application with koa-body, CORS, compression, conditional requests, and ETags enabled. By default, the HTTP server listens on port 4000.
Endpoints
The top-level router mounts three realm GraphQL endpoints:
- Use
/environment/graphqlfor the environment realm GraphQL endpoint. - Use
/system/graphqlfor the system realm GraphQL endpoint. - Use
/database/graphqlfor the database realm GraphQL endpoint.
The same HTTP server also serves the static UI bundle at /gauze/.
Authentication
Each realm has its own JWT audience and secret:
- Set
GAUZE_ENVIRONMENT_JWT_SECRETfor the environment realm. - Set
GAUZE_SYSTEM_JWT_SECRETfor the system realm. - Set
GAUZE_DATABASE_JWT_SECRETfor the database realm.
Requests use Authorization: Bearer <token>. In open realms, public operations may proceed without a token; in closed realms, authentication is required.
Request Behavior
GraphQL execution builds a request context, authenticates the agent, executes the operation, then:
- Commits transactions on success.
- Rolls back on GraphQL errors.
- Rolls back on unexpected runtime errors.
Generated Schemas
Generated entity schemas follow a consistent shape across realms. Entity definitions produce standard operations such as create_<entity>, read_<entity>, count_<entity>, update_<entity>, and delete_<entity>, plus relationship traversal fields when relationships are registered.
The system realm usually delegates to the database realm while applying system-level authorization and behavior. The database realm exposes the lower-level CRUD-oriented operation set.
What to Read Next
Read Queries and Mutations for the generated operation shapes, including reads, counts, creates, updates, deletes, and relationship traversal.
Read Parameters for shared arguments such as attributes, filters, limit, offset, order, count, and source.