App Plugins
App plugins extend Baeta at the application level. They attach middlewares, read or set metadata across modules, and inspect the compiled schema. The built-in authorization and complexity features are themselves app plugins, and you can stack any number of them in a single app.
Authorization
@baeta/auth is a scope-based authorization system. You declare the scopes your app cares about (isLoggedIn, hasRole('admin'), ownsResource(id)), Baeta loads them lazily per request, and resolvers gate themselves with auth(scope.X) or auth(rule.or(scope.X, scope.Y)). Failures throw typed errors; successes are cached for the rest of the request.
Complexity
@baeta/complexity scores every incoming query and rejects requests that exceed your configured budget. The default scoring is "1 per field, list multiplier on list types" — override either globally or per field as needed.
Caching
@baeta/cache is a typed cache layer for resolvers. You declare each query with defineQuery, point the cache at a storage adapter (Redis, Valkey, Upstash, Cloudflare), and the cache handles serialization, key derivation, and invalidation when you mutate the underlying data.