Quickstart
Getting Started
In this quickstart tutorial, you'll create an app using the Tailor Platform SDK. Follow the steps below to get started.
Prerequisite
You'll need a Tailor account to start using the Tailor Platform. Contact us here to get started.
Install Node.js
The SDK requires Node.js 22 or later. Install Node.js via your package manager by following the official Node.js instructions.
Alternatively, you can use Bun as the runtime.
Note: Bun has a known issue with HTTP/2 connections that may cause intermittent failures during
applyorgeneratecommands (bun#14249, bun#26719). If you encounter a connection error, retry the command.
Create an Example App
The following command creates a new project with the required configuration files and example code.
npm create @tailor-platform/sdk -- --template hello-world example-app
# Or with Bun:
# bun create @tailor-platform/sdk --template hello-world example-appBefore deploying your app, you need to create a workspace:
npx tailor-sdk login
npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
npx tailor-sdk workspace list
# Or with Bun:
# bunx tailor-sdk login
# bunx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
# OR
# Create a new workspace using Tailor Platform Console
# https://console.tailor.tech/Deploy Your App
Run the apply command to deploy your project:
cd example-app
npm run deploy -- --workspace-id <your-workspace-id>
# Or with Bun:
# bun run deploy --workspace-id <your-workspace-id>You can now open the GraphQL Playground and execute the hello query:
query {
hello(name: "sdk") {
message
}
}Hello World Example
Here's a simple query resolver from the hello-world template:
import { createResolver, t } from "@tailor-platform/sdk";
export default createResolver({
name: "hello",
operation: "query",
input: {
name: t.string().description("Name to greet"),
},
body: (context) => {
return {
message: `Hello, ${context.input.name}!`,
};
},
output: t
.object({
message: t.string().description("Greeting message"),
})
.description("Greeting response"),
});You can edit src/resolvers/hello.ts to customize the message:
export default createResolver({
body: (context) => {
return {
message: `Goodbye, ${context.input.name}!`,
};
},
});Deploy again to see the response.