TypeScript-first DSL
Typed builders for every Contentstack field kind. Autocomplete, refactor, and validate your models like any other code.
Define Contentstack content types and global fields in TypeScript. Diff against a live stack. Apply safe changes with one CLI command.
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" }),
],
});# 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| Package | Purpose |
|---|---|
@timbenniks/contentstack-stacksmith | TypeScript DSL plus schema normalization, diffing, planning, and validation helpers. |
@timbenniks/contentstack-stacksmith-cli | Contentstack CLI plugin exposing csdx stacksmith:* commands. |
The lower-level workspace packages are internal and are not meant to be installed separately.