Skip to content

API Reference

Reference index for the vyuh_server public surface. Each entry links to the source on GitHub for the authoritative dartdoc.

Runtime

SymbolPurpose
VyuhServer.bootstrapThe entry point — composes plugins + features into a runtime
VyuhServer.start (extension)Mounts the Relic transport, wires middleware, starts listening
VyuhServer.shutdownReverse-topological dispose; unbinds vyuh global
vyuh (global)Per-isolate accessor — vyuh.db, vyuh.storage, vyuh.auth, vyuh.telemetry, vyuh.log, vyuh.query, vyuh.policy, vyuh.di, vyuh.env, vyuh.errors, vyuh.permission, vyuh.tenancy, vyuh.events

Plugins

SymbolPurpose
PluginBase class for all plugins
DbPluginSingleton role: contributes DbAdapter (relational/OLTP)
StoragePluginSingleton role: contributes StorageAdapter (file/blob storage)
AuthPluginChain entry: contributes AuthStrategys; optional fallback actor
TelemetryPluginSingleton role: contributes TelemetrySink
QueryPluginSingleton role: contributes QueryCompiler
PolicyPluginContributes (ref → PolicyEvaluator) entries to PolicyRegistry
PermissionPluginSingleton role: resolves effective permissions and roles
TenancyPluginSingleton role: extracts app-specific tenant context
EnvPluginSingleton role: contributes EnvRegistry
ErrorCodesPluginSingleton role: claims ErrorCodesDescriptors
DescriptorHandler<D>Mix-in on Plugin to claim a descriptor type

Features

SymbolPurpose
FeatureDescriptorDomain-area contributor with the five contribution slots

Contribution Slots

SymbolSlot
RouteSpecOne method + path + handler tuple, optionally with route-local middleware
MiddlewareSpecPath-scoped middleware with explicit order
ContextProvider<T>Per-request typed value derivation
DiRegistrationServer-wide DI binding
DescriptorMarker interface for open-extension types

Routing

SymbolPurpose
RouterScopeImperative API for declaring routes (get, post, mount, protect)
RouteModuleNamed, basePath-scoped group of routes with co-located auth
RouterShapervoid Function(RouterScope) — the extend callback shape

Database (relational, OLTP)

SymbolPurpose
DbAdapterAbstract: open, close, applyDdl, runTx, execute, listen
DbSessionSession passed to runTx body
DbResultRow set returned by execute
DbExceptionBase for adapter-thrown exceptions

File Storage

SymbolPurpose
StorageAdapterAbstract bucket+path file ops: upload, download, delete, move, copy, list, getPublicUrl (sync), createSignedUrl (async, TTL)
StorageObjectDTO with name, size, contentType, lastModified, etag
StorageExceptionFramework-shared error type; backends translate at the boundary

Auth

SymbolPurpose
ActorAuthenticated principal — id, tenantId, roles, claims
AnonymousActorDefault fallback when no strategy resolves
AuthModuleComposed strategy chain
AuthStrategyresolve(AuthContext) → Future<Actor?>
AuthContextShape passed to strategies — wraps the request
AuthFailedThrown by a strategy when credentials are present but invalid
JwtVerifier (in auth_jwt)Callback typedef — (token) → claims

Telemetry

SymbolPurpose
TelemetrySinkstartSpan, counter, event
TelemetrySpansetAttribute, recordException, end({success})
NoOpTelemetrySinkDefault — every call is a no-op

Filters

SymbolPurpose
QueryCompilercompile(json) → CompiledQuery
CompiledQuerywhereClause, parameters

Policy

SymbolPurpose
PolicyRegistryregister(ref, evaluator), evaluate(ref, ctx)
PolicyContextShape passed to evaluators
PolicyDecisionSealed Allowed / Denied(error)
PolicyEvaluator(ctx) → FutureOr<PolicyDecision>

Env

SymbolPurpose
EnvPluginBoot-time env unifier; takes defines: (compile-time keys) + configs: (typed configs) at construction
EnvRegistryregister<T>(config), get<T>(), read(key), requireRead(key)
TypedEnvConfig.factory<T> / TypedEnvConfig.value<T>Type-preserving registration wired into EnvPlugin(configs:)

Middleware

SymbolPurpose
GlobalMiddleware.auth()Resolves req.actor; apps normally include it in runtime.start(middleware: [...])
GlobalMiddleware.cors()Standard CORS headers
GlobalMiddleware.errorHandler()Catches StructuredExceptions, returns structured JSON
GlobalMiddleware.requestLogger()One log line per request
GlobalMiddleware.clientContext()Mounted by the framework as outermost (request id, IP, UA)
tracingMiddleware() (in telemetry_otel)One span per request

Response Helpers

SymbolReturns
jsonResponse(body: ..., statusCode: ...)Low-level JSON response helper
TypedResponse.ok(data: ...) / .created(data: ...)Typed success envelopes
TypedResponse.badRequest(...) / .notFound(...) / .conflict(...) / .forbidden(...)Typed error envelopes
typedJsonResponse(...)One-object typed JSON envelope
typedJsonListResponse(...)List + optional pagination envelope

Errors

SymbolPurpose
StructuredExceptionBase for thrown errors; carries code, message, details
ErrorCodeRegistryBound to vyuh.errors; resolves codes to HTTP status + default message
ErrorCodesDescriptorFeature-side declaration of error codes
EntityValidationExceptionSpecialized for EntityCrudConfig.validators

Plugin-Side Reference

Each shipped plugin's API surface lives in the plugin's page:

  • PostgresPostgresDbPlugin, PostgresDbAdapter, PostgresDbSession, PostgresConnectionConfig
  • File StorageSupabaseStoragePlugin, SupabaseStorageAdapter
  • JWT AuthJwtAuthPlugin, JwtBearerStrategy
  • API Key AuthApiKeyAuthPlugin, ApiKeyStrategy, ApiKeyLookup
  • Console TelemetryConsoleTelemetryPlugin, ConsoleTelemetrySink
  • OTel TelemetryOtelTelemetryPlugin, OtelConfig, tracingMiddleware
  • QueryPostgresQueryPlugin, PostgresQueryCompiler
  • Entity CRUDEntityCrudPlugin, EntityCrudDescriptor<T>, EntityCrudConfig<T>, every hook typedef
  • RealtimeRealtimePlugin, RealtimeChannelDescriptor, ChannelSource, SupabaseChannelSource
  • OpenAPIOpenApiPlugin, scope.apiGet/apiPost/..., ApiRoute.get/.post/.put/.patch/.delete, DocsRenderer, OpenApiGenerator

Source

All source is open on GitHub: vyuh-tech/cdx under packages/server/.