Skip to content

API backends

Every FKN API is imported into browser code. Cloud, extension, and desktop describe where the work runs, not which client can call it. Cloud APIs are therefore available to browser apps with no extension installed.

import {
const fetch: (input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}) => Promise<Response>
fetch
,
(alias) namespace cloud
import cloud
cloud
,
(alias) namespace extension
import extension
extension
,
(alias) namespace desktop
import desktop
desktop
} from '@fkn/lib'
await
function fetch(input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}): Promise<Response>
fetch
('https://example.com') // chooses extension or cloud
await
(alias) namespace cloud
import cloud
cloud
.
cloud_d_exports.fetch(input: string | Request | URL, init?: (RequestInit & {
render?: boolean;
}) | undefined): Promise<Response>
export cloud_d_exports.fetch
fetch
('https://example.com') // always uses the FKN cloud proxy
await
(alias) namespace extension
import extension
extension
.
extension_d_exports.fetch(input: RequestInfo | URL, init?: extension.FetchInit): Promise<Response>
export extension_d_exports.fetch
fetch
('https://example.com') // always uses the browser extension
(alias) namespace desktop
import desktop
desktop
.
desktop_d_exports.available(): boolean
export desktop_d_exports.available

Typed placeholder for the planned desktop backend. Always false in this release.

available
() // false until the desktop backend ships
BackendWhere the work runsCurrent capabilitiesAvailability
cloud.*FKN infrastructureHTTP proxy, TCP/UDP, DNS, storage, quota, isolated or persistent frame sessionsAvailable to browser apps, no install
extension.*The user’s browserCross-origin fetch, optional session cookies, browser-session frames, locators, cookies, request-header rulesRequires the FKN extension
desktop.*The user’s machineTyped placeholders for fetch, sockets, DNS, and storagePlanned; availability checks return false and operation calls throw

cloud.available() reports whether the current JavaScript realm has the FKN message transport. It is not a remote service health check. extension.available() is a point-in-time check and can change after the extension announces itself. desktop.available() is always false in @fkn/lib 0.6.1.

import {
(alias) namespace cloud
import cloud
cloud
,
(alias) namespace extension
import extension
extension
,
(alias) namespace desktop
import desktop
desktop
} from '@fkn/lib'
(alias) namespace cloud
import cloud
cloud
.
cloud_d_exports.available(): boolean
export cloud_d_exports.available
available
()
(alias) namespace extension
import extension
extension
.
extension_d_exports.available(): boolean
export extension_d_exports.available
available
()
(alias) namespace desktop
import desktop
desktop
.
desktop_d_exports.available(): boolean
export desktop_d_exports.available

Typed placeholder for the planned desktop backend. Always false in this release.

available
()

The root exports are conveniences, but they do not all use one generic fallback chain.

Root exportCurrent behavior
fetch()Chooses the exposed extension first, then the future desktop backend, then cloud
attachFrame()Uses the extension when exposed; degrades to the cloud render proxy otherwise
net, dgram, http, dnsDirect aliases of the cloud-backed implementations
fsHybrid storage: local OPFS first, with optional cloud replication for a connected account
opfsLocal browser storage only

Bare cookieless fetch() prefers the extension when it is exposed. That extension operation is severity 0, so it is granted automatically rather than showing a prompt. Without the extension, the call uses the cloud proxy. Pick cloud.fetch() or extension.fetch() explicitly whenever the egress location matters to your app.

import {
const fetch: (input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}) => Promise<Response>
fetch
,
(alias) namespace cloud
import cloud
cloud
,
(alias) namespace extension
import extension
extension
} from '@fkn/lib'
await
function fetch(input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}): Promise<Response>
fetch
('https://example.com/public.json')
await
(alias) namespace cloud
import cloud
cloud
.
cloud_d_exports.fetch(input: string | Request | URL, init?: (RequestInit & {
render?: boolean;
}) | undefined): Promise<Response>
export cloud_d_exports.fetch
fetch
('https://example.com/public.json')
await
(alias) namespace extension
import extension
extension
.
extension_d_exports.fetch(input: RequestInfo | URL, init?: extension.FetchInit): Promise<Response>
export extension_d_exports.fetch
fetch
('https://example.com/public.json')

A bare fetch is cookieless by default. Passing credentials: 'include' in the second argument always selects the extension because only that backend can use the target site’s browser session. If the extension is missing, the configured install flow runs and the call rejects rather than falling back to cloud. Credentials set only on a Request object are not used for backend selection in the current release.

import {
const fetch: (input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}) => Promise<Response>
fetch
} from '@fkn/lib'
const
const response: Response
response
= await
function fetch(input: RequestInfo | URL, init?: RequestInit & {
reason?: string;
render?: boolean;
}): Promise<Response>
fetch
('https://example.com/me', {
RequestInit.credentials?: RequestCredentials | undefined

A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.

credentials
: 'include',
reason?: string | undefined
reason
: 'Load the profile from your existing session',
})

Bare attachFrame() waits briefly for extension exposure and uses the extension when it shows up. When it does not, the call degrades to the cloud render proxy in every cookie mode with no install prompt: the default maps to the persistent cloud jar, and syncCookies: false to an isolated per-attach jar. The exceptions are lockdown: true and realms without a configured render proxy, which stay on the extension path and surface the install flow. See attachFrame().

The root fs export combines browser OPFS with optional cloud replication. It is not selected through the networking backend chain. See Storage.

Fetch APIs refuse FKN’s own domains (fkn.app, fkn.dev, and their subdomains). The same boundary is enforced in the library, broker, proxy, and extension so direct calls to a lower layer behave consistently.

This table shows the execution backends for each browser-callable API. It does not show native web-platform support.

@fkn/lib capabilities by execution backend

All APIs below are called from browser code. The columns show which backend performs the work.

API / featureExtensionCloudDesktop
fetch
cross-originSupportedSupportedPlanned
credentials: 'include'Carries the browser sessionSupportedNot availableNot available
net (TCP)Not availableSupportedPlanned
dgram (UDP)Not availableSupportedPlanned
httpNot availableSupportedNot available
dnsNot availableSupportedNot available
File storageRoot fs also uses OPFSNot availableSupportedPlanned
attachFrame / locatorsCloud: no lockdown or videoElementSupportedSupportedNot available
cookies.getSupportedNot availableNot available
quotaNot availableSupportedNot available