<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [server](./server.md) &gt; [startServer](./server.startserver.md)

## startServer() function

Boots the server runtime, runs your init callback, and starts accepting connections.

Use for: normal server startup in your entry file. Do NOT use for: restarting an already running server within the same process.

**Signature:**

```typescript
export declare function startServer(init: ((() => void | Promise<void>) | ((world: World) => void | Promise<void>))): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

init


</td><td>

((() =&gt; void \| Promise&lt;void&gt;) \| ((world: [World](./server.world.md)<!-- -->) =&gt; void \| Promise&lt;void&gt;))


</td><td>

Game initialization callback. It can be sync or async. If it accepts a world parameter, the default world is created and passed in.

\*\*Requires:\*\* Call once per process before using gameplay systems.


</td></tr>
</tbody></table>
**Returns:**

void

## Remarks

Initialization order: 1) Physics engine (RAPIER) 2) Block texture atlas preload 3) Model preload 4) Your `init` callback (awaited if async) 5) Server starts accepting connections

If `init` declares a `world` parameter, a default world is created and provided.

