defineApiConfig accepts an ApiRuntimeConfig. Every field is optional, but the generated resolvers need a runtime. Without it, context.getReadStrategy throws on each request.
Common Options #
-
runtime— theLakeQLRuntimeresolvers execute against. Required in practice. -
tokenResolver— validates the request token into a current user. See JWT authentication . Defaults to a development mock that accepts any request whenAUTH_MOCK=trueand theauthorizationheader equalsAUTH_MOCK_TOKEN, taking the username from thex-usernameheader. Provide a real resolver for anything beyond local development. -
identityResolver— maps the JWT payload to a resolved identity. Defaults to the Entra ID resolver. -
permissions— technical-user permission rules . -
hasReadPermission/hasWritePermission— custom permission resolvers.
Paths and Server #
-
baseDir— base directory for resolving relative paths. Defaults to the current working directory. -
schemaPath— where the generated query schema files live, relative tobaseDir. -
graphqlPath— the path the server mounts the GraphQL handler at. Defaults to/graphql. -
healthCheckEndpoint— the health check path. Defaults to/live. -
port— the server port. Defaults to4000.
Limits and Hooks #
-
maxRecordsPerPage— caps rows per paginated response. Defaults to2000. -
yogaConfig— override GraphQL Yoga options and plugins. See Yoga configuration . -
cors— CORS options for the GraphQL route, applied by the Hono layer. Off by default. See CORS configuration . -
onError— a hook invoked for every execution error after logging. See error handling .