# [API](/api/) › @qwik.dev/qwik/server

## getQwikBackpatchExecutorScript

Provides the `backpatch-executor.js` executor script as a string.

```typescript
export declare function getQwikBackpatchExecutorScript(opts?: {
  debug?: boolean;
}): string;
```

| Parameter | Type | Description |
| --- | --- | --- |
| opts | \{ debug?: boolean; } | _(Optional)_ |

**Returns:**

string

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/scripts.ts)

## getQwikLoaderScript

Provides the `qwikloader.js` file as a string. Useful for tooling to inline the qwikloader script into HTML.

```typescript
export declare function getQwikLoaderScript(opts?: { debug?: boolean }): string;
```

| Parameter | Type | Description |
| --- | --- | --- |
| opts | \{ debug?: boolean; } | _(Optional)_ |

**Returns:**

string

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/scripts.ts)

## getQwikPrefetchWorkerScript

Provides the `qwik-prefetch-service-worker.js` file as a string. Useful for tooling to inline the qwik-prefetch-service-worker script into HTML.

```typescript
export declare function getQwikPrefetchWorkerScript(opts?: {
  debug?: boolean;
}): string;
```

| Parameter | Type | Description |
| --- | --- | --- |
| opts | \{ debug?: boolean; } | _(Optional)_ |

**Returns:**

string

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/scripts.ts)

## InOrderAuto

```typescript
export interface InOrderAuto
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| maximumChunk? |  | number | _(Optional)_ |
| maximumInitialChunk? |  | number | _(Optional)_ |
| strategy |  | 'auto' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## InOrderDisabled

```typescript
export interface InOrderDisabled
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| strategy |  | 'disabled' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## InOrderStreaming

```typescript
export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
```

**References:** [InOrderAuto](#inorderauto), [InOrderDisabled](#inorderdisabled)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## OutOfOrderStreaming

```typescript
export type OutOfOrderStreaming = boolean;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## PrefetchResource

```typescript
export interface PrefetchResource
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| imports |  | [PrefetchResource](#prefetchresource)[] |  |
| url |  | string |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## PreloaderOptions

```typescript
export interface PreloaderOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| maxIdlePreloads? |  | number | _(Optional)_ Maximum number of simultaneous preload links that the preloader will maintain. If you set this higher, the browser will have all JS files in memory sooner, but it will contend with other resource downloads. Furthermore, if a bundle suddenly becomes more likely, it will have to wait longer to be preloaded. Bundles that reach 100% probability (static imports of other bundles) will always be preloaded immediately, no limit. Defaults to `25` |
| ssrPreloads? |  | number | _(Optional)_ Maximum number of preload links to add during SSR. These instruct the browser to preload likely bundles before the preloader script is active. This most likely includes the core and the preloader script itself. Setting this to 0 will disable all preload links. Preload links can delay LCP, which is a Core Web Vital, but it can increase TTI, which is not a Core Web Vital but more noticeable to the user. Defaults to `5` |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## QwikLoaderOptions

```typescript
export type QwikLoaderOptions =
  | "module"
  | "inline"
  | "never"
  | {
      include?: "always" | "never" | "auto";
      position?: "top" | "bottom";
    };
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## Render

```typescript
export type Render = RenderToString | RenderToStream;
```

**References:** [RenderToString](#rendertostring-type-alias), [RenderToStream](#rendertostream-type-alias)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderOptions

```typescript
export interface RenderOptions extends SerializeDocumentOptions
```

**Extends:** [SerializeDocumentOptions](#serializedocumentoptions)

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| base? |  | string \\| ((options: [RenderOptions](#renderoptions)) => string) | _(Optional)_ Specifies the root of the JS files of the client build. Setting a base, will cause the render of the `q:base` attribute in the `q:container` element. |
| containerAttributes? |  | Record<string, string> | _(Optional)_ |
| containerTagName? |  | string | _(Optional)_ When set, the app is serialized into a fragment. And the returned html is not a complete document. Defaults to `html` |
| locale? |  | string \\| ((options: [RenderOptions](#renderoptions)) => string) | _(Optional)_ Language to use when rendering the document. |
| preloader? |  | [PreloaderOptions](#preloaderoptions) \\| false | _(Optional)_ Specifies how preloading is handled. This ensures that code is instantly available when needed. |
| qwikLoader? |  | [QwikLoaderOptions](#qwikloaderoptions) | _(Optional)_ Specifies how the Qwik Loader is included in the document. This enables interactivity and lazy loading. `module`: Use a `` tag to load the Qwik Loader. Subsequent page loads will have the script cached and instantly running. `inline`: This embeds the Qwik Loader script directly in the document. This adds about 3kB before compression, which typically is reduced to about 1.6kB with gzip. `never`: Do not include the Qwik Loader script. This is mostly useful when embedding multiple containers on the same page. Defaults to `module`. Note that the Qwik Loader is absolutely required for Qwik to work. There must be an instance of it loaded for any interactivity to happen. |
| serverData? |  | Record<string, any> | _(Optional)_ Metadata that can be retrieved during SSR with `useServerData()`. |
| snapshot? |  | boolean | _(Optional)_ Defaults to `true` |
| statePrewarm? |  | number \\| false | _(Optional)_ Root-count threshold for eager yielded state prewarm during client resume. Defaults to `false`, keeping state fully lazy. Set to a number to enable eager prewarm when serialized state has at least that many roots. |
| transformError? |  | (error: unknown) => Error \\| undefined \\| null \\| void | _(Optional)_ Server-only. Projects a thrown error into the `Error` an `` fallback displays during SSR; `onError$` still receives the original. It never runs on the client, where a re-derived fallback shows the error as thrown. Return an `Error` to project it, or `undefined`/`null` to decline; any other return, or a throw, redacts to the generic error. It is called synchronously, so it cannot be `async`: a returned promise redacts every error. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderResult

```typescript
export interface RenderResult
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| isStatic |  | boolean |  |
| manifest? |  | ServerQwikManifest | _(Optional)_ |
| snapshotResult? |  | SnapshotResult \\| undefined | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## renderToStream

```typescript
export type RenderToStream = (
  opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;
```

**References:** [RenderToStreamOptions](#rendertostreamoptions), [RenderToStreamResult](#rendertostreamresult)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/ssr-render.ts)

## RenderToStream

```typescript
export type RenderToStream = (
  opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;
```

**References:** [RenderToStreamOptions](#rendertostreamoptions), [RenderToStreamResult](#rendertostreamresult)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderToStreamOptions

```typescript
export interface RenderToStreamOptions extends RenderOptions
```

**Extends:** [RenderOptions](#renderoptions)

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| onBeforeFirstFlush? |  | (info: \{ errorBoundaryCaught: boolean; }) => void | _(Optional)_ Called synchronously just before the first chunk is written — the last moment response headers can still change. `errorBoundaryCaught` is true when an `` already swapped in its fallback during SSR. |
| stream |  | StreamWriter |  |
| streaming? |  | [StreamingOptions](#streamingoptions) | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderToStreamResult

```typescript
export interface RenderToStreamResult extends RenderResult
```

**Extends:** [RenderResult](#renderresult)

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| errorBoundaryCaught? |  | boolean | _(Optional)_ True when an `` caught during the render, no matter where in the stream. |
| flushes |  | number |  |
| size |  | number |  |
| timing |  | \{ firstFlush: number; render: number; snapshot: number; } |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## renderToString

```typescript
export type RenderToString = (
  opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;
```

**References:** [RenderToStringOptions](#rendertostringoptions), [RenderToStringResult](#rendertostringresult)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/ssr-render.ts)

## RenderToString

```typescript
export type RenderToString = (
  opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;
```

**References:** [RenderToStringOptions](#rendertostringoptions), [RenderToStringResult](#rendertostringresult)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderToStringOptions

```typescript
export interface RenderToStringOptions extends RenderOptions
```

**Extends:** [RenderOptions](#renderoptions)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## RenderToStringResult

```typescript
export interface RenderToStringResult extends RenderResult
```

**Extends:** [RenderResult](#renderresult)

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| html |  | string |  |
| timing |  | \{ firstFlush: number; render: number; snapshot: number; } |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## resolveManifest

Merges a given manifest with the built manifest and provides mappings for symbols.

```typescript
export declare function resolveManifest(
  manifest?: Partial<QwikManifest | ResolvedManifest> | undefined,
): ResolvedManifest | undefined;
```

| Parameter | Type | Description |
| --- | --- | --- |
| manifest | Partial<QwikManifest \\| ResolvedManifest> \\| undefined | _(Optional)_ |

**Returns:**

ResolvedManifest \| undefined

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/ssr-render.ts)

## SerializeDocumentOptions

```typescript
export interface SerializeDocumentOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| debug? |  | boolean | _(Optional)_ |
| manifest? |  | Partial<QwikManifest \\| ResolvedManifest> | _(Optional)_ |
| symbolMapper? |  | SymbolMapperFn | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## setServerPlatform

```typescript
export declare function setServerPlatform(
  manifest?: Partial<QwikManifest | ResolvedManifest>,
): Promise<void>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| manifest | Partial<QwikManifest \\| ResolvedManifest> | _(Optional)_ |

**Returns:**

Promise&lt;void&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/index.ts)

## StreamingOptions

```typescript
export interface StreamingOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| inOrder? |  | [InOrderStreaming](#inorderstreaming) | _(Optional)_ |
| outOfOrder? |  | [OutOfOrderStreaming](#outoforderstreaming) | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## versions

```typescript
versions: {
    readonly qwik: string;
    readonly qwikDom: string;
}
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/utils.ts)
