본문 바로가기
WIKI 기술 지식 베이스

퀵스타트

원문 보기 위키 갱신

퀵스타트 (Quickstart)

Turso Platform API를 몇 단계만에 시작하는 방법을 소개해요. 토큰 발급부터 그룹·데이터베이스 생성, 연결까지 차례로 따라가 보세요.

출처: 문서

본문

Get started with Turso API in a few easy steps.

**TypeScript 사용 중이신가요?** 원시 HTTP 예제를 건너뛰고 [`@tursodatabase/api`](https://www.npmjs.com/package/@tursodatabase/api) 클라이언트를 바로 쓸 수도 있어요. [SDK 퀵스타트](https://docs.turso.tech/api-reference/introduction#quickstart-with-the-typescript-sdk)를 참고하세요. 아직이라면 먼저 [Turso CLI를 설치](https://docs.turso.tech/cli/installation)하세요.
<CodeGroup>
  ```bash Signup theme={null}
  turso auth signup
  ```

  ```bash Login theme={null}
  turso auth login
  ```
</CodeGroup>
Platform API는 개인 계정으로도, 조직으로도 사용할 수 있어요. Turso CLI로 계정이나 조직의 `slug`를 확인해 보세요:
```bash theme={null}
turso org list
```
이제 Turso CLI로 새 API 토큰을 만들어요:
```bash theme={null}
turso auth api-tokens mint quickstart
```

`--org` 옵션으로 특정 조직에 맞춰 토큰을 발급할 수도 있어요:

```bash theme={null}
turso auth api-tokens mint quickstart --org my-org
```

<Info>
  토큰은 안전한 곳에 잘 저장해 두세요. 다음 단계에서 필요해요.
</Info>
특정 리전에 그룹이나 데이터베이스를 만들기 전에, 먼저 사용 가능한 리전 목록을 가져와야 해요:
<CodeGroup>
  ```bash cURL theme={null}
  curl -L 'https://api.turso.tech/v1/locations' \
    -H 'Authorization: Bearer ***' \
  ```

  ```ts Node.js theme={null}
  import { createClient } from "@tursodatabase/api";

  const turso = createClient({
    org: "...",
    token: "",
  });

  const locations = await turso.locations.list();
  ```
</CodeGroup>

<br />

<Info>
  `organizationSlug`는 조직 이름 또는 개인 계정 이름이에요.
</Info>
모든 데이터베이스는 하나 이상의 위치에 존재하는 그룹에 속해요.
먼저 `name`과 기본 `location`을 지정해 그룹을 만들어요:

<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/groups' \
    -H 'Authorization: Bearer ***' \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "default",
        "location": "lhr"
    }'
  ```

  ```ts Node.js theme={null}
  import { createClient } from "@tursodatabase/api";

  const turso = createClient({
    org: "...",
    token: "",
  });

  const group = await turso.groups.addLocation("default", "lhr");
  ```
</CodeGroup>
이제 위에서 만든 그룹에 첫 데이터베이스를 만들어요:
<CodeGroup>
  ```bash cURL theme={null}
  curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases' \
    -H 'Authorization: Bearer ***' \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "my-db",
        "group": "default"
    }'
  ```

  ```ts Node.js theme={null}
  import { createClient } from "@tursodatabase/api";

  const turso = createClient({
    org: "...",
    token: "",
  });

  const database = await turso.databases.create("my-db", "ams");
  ```
</CodeGroup>
이제 여러 리전에 분산된 데이터베이스가 준비됐어요. 공식 또는 실험용 SDK 중 하나를 골라 연결해 보세요:
<Snippet file="all-sdks.mdx" />

더 알아보기 (Learn more)

  • API 소개 — SDK 퀵스타트를 포함한 전체 개요를 확인해요.
  • 토큰 생성 — API 토큰 발급 엔드포인트를 살펴봐요.
  • 응답 코드 — 상태 코드별 의미를 확인해요.
  • CLI 설치 — Turso CLI 설치 방법을 안내해요.