> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started

> Create your first Namespace compute instance with the TypeScript SDK.

Use the Compute API client to create Linux, macOS, or Windows instances from a Node.js application. Create a client and provision your first instance.

## Create your first instance

The following example creates a Linux instance with 2 vCPUs and 4 GiB of memory, prints its instance ID, and waits for it to start.

**1. Authenticate with Namespace**

For local development, authenticate with the Namespace CLI:

```bash theme={null}
nsc login
```

The SDK uses a Namespace workload token when available and otherwise the local user token created by `nsc login`.

**2. Create a Compute client**

Import `createComputeClient()` and create a client:

```typescript theme={null}
import { createComputeClient } from "@namespacelabs/sdk/api/compute";

const client = createComputeClient();
```

The client loads credentials on its first authenticated request and uses the `us` regional endpoint by default.

**3. Create an instance**

Create a Linux instance with a 30-minute deadline:

```typescript theme={null}
import { timestampFromDate } from "@bufbuild/protobuf/wkt";

const instance = await client.compute.createInstance({
  shape: {
    os: "linux",
    machineArch: "amd64",
    virtualCpu: 2,
    memoryMegabytes: 4 * 1024,
  },
  documentedPurpose: "TypeScript SDK example",
  deadline: timestampFromDate(new Date(Date.now() + 30 * 60 * 1000)),
});
```

The deadline releases the instance after 30 minutes.

**4. Print the instance ID**

Read the instance ID from the response metadata:

```typescript theme={null}
const instanceId = instance.metadata!.instanceId;
console.log(`Created instance: ${instanceId}`);
```

**5. Wait for the instance**

Instance creation is asynchronous. Wait until the instance reaches the `RUNNING` state:

```typescript theme={null}
await client.compute.waitInstanceSync(
  { instanceId },
  { timeoutMs: 10 * 60 * 1000 },
);

console.log("Instance is running");
```

**Complete example**

```typescript theme={null}
import { timestampFromDate } from "@bufbuild/protobuf/wkt";
import { createComputeClient } from "@namespacelabs/sdk/api/compute";

const client = createComputeClient();

const instance = await client.compute.createInstance({
  shape: {
    os: "linux",
    machineArch: "amd64",
    virtualCpu: 2,
    memoryMegabytes: 4 * 1024,
  },
  documentedPurpose: "TypeScript SDK example",
  deadline: timestampFromDate(new Date(Date.now() + 30 * 60 * 1000)),
});

const instanceId = instance.metadata!.instanceId;
console.log(`Created instance: ${instanceId}`);

await client.compute.waitInstanceSync(
  { instanceId },
  { timeoutMs: 10 * 60 * 1000 },
);

console.log("Instance is running");
```

See [Create and manage compute instances](https://namespace.so/docs/reference/typescript-sdk/compute/manage.md) for request fields, platform examples, placement, readiness handling, and the rest of the instance lifecycle.

## Explore Compute

> [card] [Create and manage instances](https://namespace.so/docs/reference/typescript-sdk/compute/manage.md)
>
> Create, wait for, inspect, list, extend, suspend, wake, and destroy instances.

> [card] [Compute Client](https://namespace.so/docs/reference/typescript-sdk/compute/compute-client.md)
>
> Configure authentication, region, and transport, and see every compute service.

> [card] [Authenticate with Namespace](https://namespace.so/docs/reference/typescript-sdk/compute/authentication.md)
>
> Configure credentials for local development and automated workloads.

> [card] [Access and networking](https://namespace.so/docs/reference/typescript-sdk/compute/access.md)
>
> Expose ingresses and read SSH, VNC, and Kubernetes configuration.

> [card] [Run commands](https://namespace.so/docs/reference/typescript-sdk/compute/command.md)
>
> Run a command in a container and stream or buffer its output.

> [card] [Inspect and release volumes](https://namespace.so/docs/reference/typescript-sdk/compute/storage.md)
>
> List, describe, and destroy cache and persistent volumes.

> [card] [Report on usage](https://namespace.so/docs/reference/typescript-sdk/compute/usage.md)
>
> Compute, volume, and artifact usage, time series, and reports.

> [card] [Read logs and egress](https://namespace.so/docs/reference/typescript-sdk/compute/observability.md)
>
> Stream and fetch instance logs and egress records.

> [card] [Compute platform](https://namespace.so/docs/architecture/compute.md)
>
> Learn about platforms, machine shapes, storage, and instance access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.