Provider Config
provider tells runtime execution to use a named provider instead of only executing a resolved endpoint.
Schema shape
TS
export const usersSchema = {
resource: "users",
provider: {
type: "custom",
name: "admin"
}
} as const;| Property | Purpose |
|---|---|
type | Provider kind metadata such as rest, custom, graphql, trpc, supabase, or firebase. |
name | Provider key resolved from FluiKitProvider providers. |
query | Metadata field for provider-specific query names. |
Runtime provider map
Providers are passed to FluiKitProvider.
TSX
import { FluiKitProvider } from "@vibeflui/core";
const providers = {
admin: {
list: async ({ query }) => fetchUsers(query),
detail: async ({ params }) => fetchUser(params.id),
create: async ({ values }) => createUser(values),
update: async ({ params, values }) => updateUser(params.id, values),
delete: async ({ params }) => deleteUser(params.id),
action: async ({ operation, params }) => runAction(operation, params)
}
};
export function AppProviders({ children }: { children: React.ReactNode }) {
return <FluiKitProvider providers={providers}>{children}</FluiKitProvider>;
}Provider methods
| Method | Used for |
|---|---|
list | list operation. |
detail | detail or view operation. |
create | create operation. |
update | update or edit operation. |
delete | delete operation. |
action | Custom operations and fallback. |
type: "rest"
When schema.provider.type is rest and no provider.name is used, VibeFlui creates the built-in endpoint provider. The schema still needs resolvable endpoints.
TS
export const usersSchema = {
resource: "users",
provider: {
type: "rest"
},
endpoint: "/api/users"
} as const;Execution context
Provider methods receive an action execution context with:
schemaactionoperationrowvaluesqueryendpointfetcheridentityValueparamspermissionContext
Common mistakes
- Put runtime provider functions in
FluiKitProvider, not inside schema. - Set
provider.nameonly when the provider exists in the runtime provider map. type: "graphql"andtype: "trpc"are metadata unless a matching provider is supplied.