Skip to content

Contentstack StacksmithContent models as code.

Define Contentstack content types and global fields in TypeScript. Diff against a live stack. Apply safe changes with one CLI command.

Quick taste

typescript
import { defineContentType, text, reference, globalField } from "@timbenniks/contentstack-stacksmith";

export default defineContentType("blog_post", {
  title: "Blog Post",
  fields: [
    text("title", { required: true }),
    text("slug", { required: true, unique: true }),
    reference("author", { to: ["author"] }),
    globalField("seo", { ref: "seo" }),
  ],
});
bash
# Build, plan, and apply your models against a live stack
csdx stacksmith:build
csdx stacksmith:plan --stack blt123 --token-alias my-stack
csdx stacksmith:apply --stack blt123 --token-alias my-stack

# Or pull an existing stack down into DSL files
csdx stacksmith:import --cwd ./apps/website --stack blt123 --token-alias my-stack

The packages

PackagePurpose
@timbenniks/contentstack-stacksmithTypeScript DSL plus schema normalization, diffing, planning, and validation helpers.
@timbenniks/contentstack-stacksmith-cliContentstack CLI plugin exposing csdx stacksmith:* commands.

The lower-level workspace packages are internal and are not meant to be installed separately.

Released under the MIT License.