PTB Configuration

When you run ptb init, PTB creates a ptb.config.json file at your project root. This file controls generation output, naming conventions, and AI settings.

Full Schema

{
  "designTool": {
    "provider": "figma",
    "fileKey": "YOUR_FIGMA_FILE_KEY",
    "accessTokenEnv": "FIGMA_ACCESS_TOKEN"
  },
  "project": {
    "rootDir": "."
  },
  "output": {
    "componentsDir": "packages/ui/src/components",
    "tokensDir": "packages/ui/src/tokens",
    "metadataDir": ".ptb"
  },
  "framework": {
    "name": "react",
    "typescript": true,
    "styling": "css-modules"
  },
  "generation": {
    "stories": true,
    "tests": false,
    "types": true,
    "indexFiles": true,
    "cssFiles": true
  },
  "naming": {
    "componentCase": "PascalCase",
    "folderCase": "kebab-case",
    "tokenCase": "camelCase"
  },
  "classification": {
    "treatComponentSetsAsCanonical": true,
    "treatStandaloneComponentsAsCanonical": true,
    "treatNestedInstancesAsReferences": true
  },
  "docs": {
    "tool": "storybook",
    "format": "both"
  },
  "ai": {
    "active": "claude",
    "providers": {
      "claude": {
        "model": "claude-sonnet-4-6",
        "accessTokenEnv": "ANTHROPIC_API_KEY"
      }
    }
  }
}

Security Note

accessTokenEnv stores the name of the environment variable (e.g., "FIGMA_ACCESS_TOKEN"), never the token value itself.

At runtime PTB resolves the token in this order:

  1. process.env[accessTokenEnv] — env var wins (used in CI)
  2. ~/.config/calibrate-ds/credentials.json — credentials file (set via ptb token set, works for local dev and the MCP server)

Never put a token value directly in ptb.config.json — that file is committed to git.


Next Steps

Learn about the Internal Architecture and how PTB parses Figma data.