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.
Function Signature
function defineStaticWebSite(
name: string,
config: Omit<StaticWebsiteInput, "name">
): StaticWebsiteConfig & { readonly url: string }
Defines a static website configuration with a placeholder URL that is resolved at deployment time.
Parameters
config
StaticWebsiteInput
required
Static website configuration objectDescription of the static website
IP addresses allowed to access the static website
Returns
Defined static website configuration with the following properties:Website description (if provided)
Allowed IP addresses (if provided)
Placeholder URL in the format "{name}:url". This is replaced with the actual deployed URL by the Tailor Platform at deployment time
Example
Basic Configuration
import { 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",
});
With IP Restrictions
const website = defineStaticWebSite("my-frontend", {
description: "Internal admin dashboard",
allowedIpAddresses: ["192.168.1.0/24", "10.0.0.1"],
});
Using the URL Property
import {
defineAuth,
defineConfig,
defineIdp,
defineStaticWebSite,
} from "@tailor-platform/sdk";
const website = defineStaticWebSite("my-frontend", {
description: "my frontend application",
});
const idp = defineIdp("my-idp", {
authorization: "loggedIn",
clients: ["default-idp-client"],
});
const auth = defineAuth("my-auth", {
userProfile: {
type: user,
usernameField: "email",
},
oauth2Clients: {
sample: {
// Use website.url in redirect URIs
redirectURIs: ["https://example.com/callback", `${website.url}/callback`],
description: "Sample OAuth2 client",
grantTypes: ["authorization_code", "refresh_token"],
},
},
idProvider: idp.provider("sample", "default-idp-client"),
});
export default defineConfig({
name: "my-app",
cors: [
website.url, // URL is replaced with actual deployment URL
],
db: {
tailordb: {
files: ["./tailordb/*.ts"],
},
},
staticWebsites: [website],
});
Notes
- The
.url property returns a placeholder string in the format "{name}:url" during configuration
- At deployment time, the Tailor Platform replaces this placeholder with the actual deployed URL
- This allows you to reference the website URL in CORS settings, OAuth redirect URIs, and other configuration fields before the actual URL is known
- The static website must be included in the
staticWebsites array in defineConfig for deployment
- Use the website name in the
erdSite field of TailorDB configuration to associate an ERD visualization site