Documentation Index Fetch the complete documentation index at: https://mintlify.com/tailor-platform/sdk/llms.txt
Use this file to discover all available pages before exploring further.
The SDK uses tailor.config.ts as the central configuration file for your Tailor Platform application. This TypeScript-based configuration provides type safety and IntelliSense support while defining your application structure.
Basic Structure
Use defineConfig() to create your application configuration:
import { defineConfig } from "@tailor-platform/sdk" ;
export default defineConfig ({
name: "my-app" ,
cors: [ "https://example.com" ] ,
allowedIpAddresses: [ "192.168.1.0/24" ] ,
disableIntrospection: false ,
}) ;
Application Settings
The application name. Must be unique within your workspace.
CORS allowed origins. Can include static website URL references like website.url.
IP addresses allowed to access the application in CIDR format.
Disable GraphQL introspection. Useful for production environments.
Service Configuration
Services are configured using glob patterns to load files automatically:
export default defineConfig ({
db: {
tailordb: {
files: [ "./tailordb/*.ts" ],
ignores: [ "./tailordb/*.draft.ts" ],
},
analyticsdb: {
files: [ "./analyticsdb/*.ts" ]
},
} ,
resolver: {
"my-resolver" : {
files: [ "./resolvers/*.ts" ],
},
} ,
executor: {
files: [ "./executors/*.ts" ]
} ,
workflow: {
files: [ "./workflows/**/*.ts" ],
} ,
}) ;
File Patterns
Glob patterns to match service files. Supports standard glob syntax like **/*.ts.
Glob patterns to exclude files. By default, **/*.test.ts and **/*.spec.ts are automatically ignored. If you explicitly specify ignores, the default patterns will not be applied. Use ignores: [] to include test files.
Environment Variables
Define environment variables that are accessible in resolvers, executors, and workflows:
export default defineConfig ({
name: "my-app" ,
env: {
foo: 1 ,
bar: "hello" ,
baz: true ,
} ,
}) ;
Access environment variables in your code:
resolvers/env.ts
executors/example.ts
workflows/example.ts
import { createResolver , t } from "@tailor-platform/sdk" ;
export default createResolver ({
name: "env" ,
description: "Test environment variables" ,
operation: "query" ,
input: {
multiplier: t . int (). description ( "Number to multiply with env.foo" ),
} ,
body : ({ input , env }) => {
return {
result: input . multiplier * env . foo ,
envBar: env . bar ,
envBaz: env . baz ,
};
} ,
output: t . object ({
result: t . int (). description ( "Result of multiplication" ),
envBar: t . string (). description ( "Value of env.bar" ),
envBaz: t . bool (). description ( "Value of env.baz" ),
}) ,
}) ;
Auth & IdP Configuration
Configure authentication and identity provider services:
import {
defineConfig ,
defineAuth ,
defineIdp ,
} from "@tailor-platform/sdk" ;
import { user } from "./tailordb/user" ;
const idp = defineIdp ( "my-idp" , {
authorization: "loggedIn" ,
clients: [ "default-idp-client" ],
userAuthPolicy: {
useNonEmailIdentifier: false ,
allowSelfPasswordReset: true ,
passwordRequireUppercase: true ,
passwordRequireLowercase: true ,
passwordRequireNonAlphanumeric: true ,
passwordRequireNumeric: true ,
passwordMinLength: 8 ,
passwordMaxLength: 128 ,
},
});
const auth = defineAuth ( "my-auth" , {
userProfile: {
type: user ,
usernameField: "email" ,
attributes: {
role: true ,
},
},
machineUsers: {
"manager-machine-user" : {
attributes: {
role: "MANAGER" ,
},
},
},
oauth2Clients: {
sample: {
redirectURIs: [ "https://example.com/callback" ],
description: "Sample OAuth2 client" ,
grantTypes: [ "authorization_code" , "refresh_token" ],
},
},
idProvider: idp . provider ( "sample" , "default-idp-client" ),
});
export default defineConfig ({
idp: [ idp ] ,
auth ,
}) ;
Static Websites
Configure static website hosting and reference URLs dynamically:
import { defineConfig , defineStaticWebSite } from "@tailor-platform/sdk" ;
const website = defineStaticWebSite ( "my-frontend" , {
description: "my frontend application" ,
});
const erdSite = defineStaticWebSite ( "my-erd-site" , {
description: "ERD site for TailorDB" ,
});
export default defineConfig ({
name: "my-app" ,
cors: [
website . url , // Resolved at deployment time
] ,
db: {
tailordb: {
files: [ "./tailordb/*.ts" ],
erdSite: erdSite . name ,
},
} ,
staticWebsites: [ website , erdSite ] ,
}) ;
The website.url property is resolved at deployment time and can be used in CORS settings and OAuth2 redirect URIs.
External Resources
Reference resources managed by Terraform or other SDK projects:
export default defineConfig ({
name: "my-app" ,
db: {
"shared-db" : { external: true },
} ,
resolver: {
"my-resolver" : { external: true },
} ,
auth: { name: "shared-auth" , external: true } ,
idp: [{ name: "shared-idp" , external: true }] ,
}) ;
External resources must already exist and be managed by another project. They are not deployed by this project but can be used for shared access across multiple applications.
Config File Location
By default, the SDK looks for tailor.config.ts in the project root. You can specify a different path:
tailor-sdk apply --config ./config/custom.config.ts
Or set via environment variable:
export TAILOR_PLATFORM_SDK_CONFIG_PATH = ./ config / custom . config . ts
tailor-sdk apply
Next Steps
Type Safety Learn how TypeScript types flow through the system
Deployment Understand the apply/remove workflow