Skip to main content

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.

Static Website is a service for hosting static web applications with type-safe URL references and IP restrictions.

Overview

Static Website provides:
  • Static file hosting
  • Type-safe URL references for configuration
  • IP address restrictions
For the official Tailor Platform documentation, see Static Website Guide.

Configuration

Configure static website hosting using defineStaticWebSite():
Definition Rules:
  • Multiple websites allowed: You can define multiple static websites in your config file
  • Configuration location: Define in tailor.config.ts and add to the staticWebsites array
  • Uniqueness: Website names must be unique across all static websites
example/tailor.config.ts
import { defineStaticWebSite, defineConfig } 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({
  staticWebsites: [website, erdSite], // Add all websites to the array
});

Options

description

A description of the static website:
defineStaticWebSite("my-website", {
  description: "Frontend application for my service",
});
description
string
A human-readable description of the static website

allowedIpAddresses

Restrict access to specific IP addresses in CIDR format:
defineStaticWebSite("my-website", {
  allowedIpAddresses: ["192.168.0.0/24", "10.0.0.0/8"],
});
allowedIpAddresses
string[]
Array of IP addresses in CIDR format that are allowed to access the website

Type-safe URL References

The returned website object provides a url property that resolves to the actual URL at deployment time. Use this for type-safe configuration:

CORS Settings

example/tailor.config.ts
import { defineStaticWebSite, defineConfig } from "@tailor-platform/sdk";

const website = defineStaticWebSite("my-frontend", {
  description: "Frontend application",
});

export default defineConfig({
  cors: [website.url], // Resolved at deployment
  staticWebsites: [website],
});

OAuth2 Redirect URIs

example/tailor.config.ts
import {
  defineConfig,
  defineAuth,
  defineIdp,
  defineStaticWebSite,
} from "@tailor-platform/sdk";
import { user } from "./tailordb/user";

const website = defineStaticWebSite("my-frontend", {
  description: "Frontend application",
});

const idp = defineIdp("my-idp", {
  authorization: "loggedIn",
  clients: ["default-client"],
});

const auth = defineAuth("my-auth", {
  userProfile: {
    type: user,
    usernameField: "email",
    attributes: { role: true },
  },
  oauth2Clients: {
    sample: {
      redirectURIs: [
        "https://example.com/callback",
        `${website.url}/callback`, // https://my-frontend.example.com/callback
      ],
      grantTypes: ["authorization_code", "refresh_token"],
    },
  },
  idProvider: idp.provider("sample", "default-client"),
});

export default defineConfig({
  cors: [website.url],
  idp: [idp],
  auth,
  staticWebsites: [website],
});

Complete Example

example/tailor.config.ts
import {
  defineConfig,
  defineAuth,
  defineIdp,
  defineStaticWebSite,
} from "@tailor-platform/sdk";
import { user } from "./tailordb/user";

const website = defineStaticWebSite("my-frontend", {
  description: "my frontend application",
});

const erdSite = defineStaticWebSite("my-erd-site", {
  description: "ERD site for TailorDB",
});

const idp = defineIdp("my-idp", {
  authorization: "loggedIn",
  clients: ["default-idp-client"],
});

export 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", `${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],
  idp: [idp],
  auth,
  staticWebsites: [website, erdSite],
});

Build docs developers (and LLMs) love