> ## 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.

<Steps>
  <Step title="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`.
  </Step>

  <Step title="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.
  </Step>

  <Step title="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.
  </Step>

  <Step title="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}`);
    ```
  </Step>

  <Step title="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");
    ```
  </Step>
</Steps>

<Expandable title="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");
  ```
</Expandable>

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

## Explore Compute

<Columns cols={2}>
  <Card title="Create and manage instances" icon="server" href="/docs/reference/typescript-sdk/compute/manage">
    Create, wait for, inspect, list, extend, suspend, wake, and destroy instances.
  </Card>

  <Card title="Compute Client" icon="plug" href="/docs/reference/typescript-sdk/compute/compute-client">
    Configure authentication, region, and transport, and see every compute service.
  </Card>

  <Card title="Authenticate with Namespace" icon="key" href="/docs/reference/typescript-sdk/compute/authentication">
    Configure credentials for local development and automated workloads.
  </Card>

  <Card title="Access and networking" icon="radio-tower" href="/docs/reference/typescript-sdk/compute/access">
    Expose ingresses and read SSH, VNC, and Kubernetes configuration.
  </Card>

  <Card title="Run commands" icon="terminal" href="/docs/reference/typescript-sdk/compute/command">
    Run a command in a container and stream or buffer its output.
  </Card>

  <Card title="Inspect and release volumes" icon="database" href="/docs/reference/typescript-sdk/compute/storage">
    List, describe, and destroy cache and persistent volumes.
  </Card>

  <Card title="Report on usage" icon="chart-column" href="/docs/reference/typescript-sdk/compute/usage">
    Compute, volume, and artifact usage, time series, and reports.
  </Card>

  <Card title="Read logs and egress" icon="activity" href="/docs/reference/typescript-sdk/compute/observability">
    Stream and fetch instance logs and egress records.
  </Card>

  <Card title="Compute platform" icon="microchip" href="/docs/architecture/compute">
    Learn about platforms, machine shapes, storage, and instance access.
  </Card>
</Columns>
