API Reference
Reference index for the vyuh_server public surface. Each entry links to the source on GitHub for the authoritative dartdoc.
Runtime
| Symbol | Purpose |
|---|---|
VyuhServer.bootstrap | The entry point — composes plugins + features into a runtime |
VyuhServer.start (extension) | Mounts the Relic transport, wires middleware, starts listening |
VyuhServer.shutdown | Reverse-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
| Symbol | Purpose |
|---|---|
Plugin | Base class for all plugins |
DbPlugin | Singleton role: contributes DbAdapter (relational/OLTP) |
StoragePlugin | Singleton role: contributes StorageAdapter (file/blob storage) |
AuthPlugin | Chain entry: contributes AuthStrategys; optional fallback actor |
TelemetryPlugin | Singleton role: contributes TelemetrySink |
QueryPlugin | Singleton role: contributes QueryCompiler |
PolicyPlugin | Contributes (ref → PolicyEvaluator) entries to PolicyRegistry |
PermissionPlugin | Singleton role: resolves effective permissions and roles |
TenancyPlugin | Singleton role: extracts app-specific tenant context |
EnvPlugin | Singleton role: contributes EnvRegistry |
ErrorCodesPlugin | Singleton role: claims ErrorCodesDescriptors |
DescriptorHandler<D> | Mix-in on Plugin to claim a descriptor type |
Features
| Symbol | Purpose |
|---|---|
FeatureDescriptor | Domain-area contributor with the five contribution slots |
Contribution Slots
| Symbol | Slot |
|---|---|
RouteSpec | One method + path + handler tuple, optionally with route-local middleware |
MiddlewareSpec | Path-scoped middleware with explicit order |
ContextProvider<T> | Per-request typed value derivation |
DiRegistration | Server-wide DI binding |
Descriptor | Marker interface for open-extension types |
Routing
| Symbol | Purpose |
|---|---|
RouterScope | Imperative API for declaring routes (get, post, mount, protect) |
RouteModule | Named, basePath-scoped group of routes with co-located auth |
RouterShaper | void Function(RouterScope) — the extend callback shape |
Database (relational, OLTP)
| Symbol | Purpose |
|---|---|
DbAdapter | Abstract: open, close, applyDdl, runTx, execute, listen |
DbSession | Session passed to runTx body |
DbResult | Row set returned by execute |
DbException | Base for adapter-thrown exceptions |
File Storage
| Symbol | Purpose |
|---|---|
StorageAdapter | Abstract bucket+path file ops: upload, download, delete, move, copy, list, getPublicUrl (sync), createSignedUrl (async, TTL) |
StorageObject | DTO with name, size, contentType, lastModified, etag |
StorageException | Framework-shared error type; backends translate at the boundary |
Auth
| Symbol | Purpose |
|---|---|
Actor | Authenticated principal — id, tenantId, roles, claims |
AnonymousActor | Default fallback when no strategy resolves |
AuthModule | Composed strategy chain |
AuthStrategy | resolve(AuthContext) → Future<Actor?> |
AuthContext | Shape passed to strategies — wraps the request |
AuthFailed | Thrown by a strategy when credentials are present but invalid |
JwtVerifier (in auth_jwt) | Callback typedef — (token) → claims |
Telemetry
| Symbol | Purpose |
|---|---|
TelemetrySink | startSpan, counter, event |
TelemetrySpan | setAttribute, recordException, end({success}) |
NoOpTelemetrySink | Default — every call is a no-op |
Filters
| Symbol | Purpose |
|---|---|
QueryCompiler | compile(json) → CompiledQuery |
CompiledQuery | whereClause, parameters |
Policy
| Symbol | Purpose |
|---|---|
PolicyRegistry | register(ref, evaluator), evaluate(ref, ctx) |
PolicyContext | Shape passed to evaluators |
PolicyDecision | Sealed Allowed / Denied(error) |
PolicyEvaluator | (ctx) → FutureOr<PolicyDecision> |
Env
| Symbol | Purpose |
|---|---|
EnvPlugin | Boot-time env unifier; takes defines: (compile-time keys) + configs: (typed configs) at construction |
EnvRegistry | register<T>(config), get<T>(), read(key), requireRead(key) |
TypedEnvConfig.factory<T> / TypedEnvConfig.value<T> | Type-preserving registration wired into EnvPlugin(configs:) |
Middleware
| Symbol | Purpose |
|---|---|
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
| Symbol | Returns |
|---|---|
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
| Symbol | Purpose |
|---|---|
StructuredException | Base for thrown errors; carries code, message, details |
ErrorCodeRegistry | Bound to vyuh.errors; resolves codes to HTTP status + default message |
ErrorCodesDescriptor | Feature-side declaration of error codes |
EntityValidationException | Specialized for EntityCrudConfig.validators |
Plugin-Side Reference
Each shipped plugin's API surface lives in the plugin's page:
- Postgres —
PostgresDbPlugin,PostgresDbAdapter,PostgresDbSession,PostgresConnectionConfig - File Storage —
SupabaseStoragePlugin,SupabaseStorageAdapter - JWT Auth —
JwtAuthPlugin,JwtBearerStrategy - API Key Auth —
ApiKeyAuthPlugin,ApiKeyStrategy,ApiKeyLookup - Console Telemetry —
ConsoleTelemetryPlugin,ConsoleTelemetrySink - OTel Telemetry —
OtelTelemetryPlugin,OtelConfig,tracingMiddleware - Query —
PostgresQueryPlugin,PostgresQueryCompiler - Entity CRUD —
EntityCrudPlugin,EntityCrudDescriptor<T>,EntityCrudConfig<T>, every hook typedef - Realtime —
RealtimePlugin,RealtimeChannelDescriptor,ChannelSource,SupabaseChannelSource - OpenAPI —
OpenApiPlugin,scope.apiGet/apiPost/...,ApiRoute.get/.post/.put/.patch/.delete,DocsRenderer,OpenApiGenerator
Source
All source is open on GitHub: vyuh-tech/cdx under packages/server/.