Quick Start
Step 1: Install chant
Section titled “Step 1: Install chant”Install a lexicon for your target platform (this also installs chant):
npm install --save-dev @intentius/chant-lexicon-aws # or another lexiconVerify it works:
chant --versionSee Installation for details.
Step 2: Initialize a Project
Section titled “Step 2: Initialize a Project”chant init my-infra --lexicon awscd my-infraThis scaffolds a project with a chant.config.ts and starter resources in src/.
Step 3: Write Resources
Section titled “Step 3: Write Resources”Here’s a typical chant project. Shared defaults are regular exports that other files import directly:
import { ServerSideEncryptionByDefault, ServerSideEncryptionRule, BucketEncryption, PublicAccessBlockConfiguration, VersioningConfiguration,} from "@intentius/chant-lexicon-aws";
export const encryptionDefault = new ServerSideEncryptionByDefault({ SSEAlgorithm: "AES256",});
export const encryptionRule = new ServerSideEncryptionRule({ ServerSideEncryptionByDefault: encryptionDefault,});
export const bucketEncryption = new BucketEncryption({ ServerSideEncryptionConfiguration: [encryptionRule],});
export const publicAccessBlock = new PublicAccessBlockConfiguration({ BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true,});
export const versioningEnabled = new VersioningConfiguration({ Status: "Enabled",});
export const lambdaTrustPolicy = { Version: "2012-10-17", Statement: [ { Effect: "Allow", Principal: { Service: "lambda.amazonaws.com" }, Action: "sts:AssumeRole", }, ],};
export const lambdaBasicExecutionArn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole";Resource files import types from the lexicon and reference sibling exports through direct imports:
import { Bucket, Sub, AWS, Ref } from "@intentius/chant-lexicon-aws";import { versioningEnabled, bucketEncryption, publicAccessBlock } from "./defaults";import { environment } from "./params";
export const dataBucket = new Bucket({ BucketName: Sub`${AWS.StackName}-${Ref(environment)}-data`, VersioningConfiguration: versioningEnabled, BucketEncryption: bucketEncryption, PublicAccessBlockConfiguration: publicAccessBlock,});Every property is typed — your editor autocompletes bucketName, bucketEncryption, sseAlgorithm, and catches typos immediately. Cross-file references like bucketEncryption are resolved through standard imports at build time.
Composites
Section titled “Composites”Built-in composites bundle common resource patterns into reusable factories:
import { LambdaNode, Sub, AWS, Ref } from "@intentius/chant-lexicon-aws";import { environment } from "./params";
export const app = LambdaNode({ name: Sub`${AWS.StackName}-${Ref(environment)}-fn`, Code: { ZipFile: `exports.handler = async (event) => { console.log("Event:", JSON.stringify(event)); return { statusCode: 200, body: JSON.stringify({ message: "Hello from Lambda!" }), };};`, },});LambdaNode creates an IAM Role + Lambda Function with Node.js defaults. See Composites for all built-in composites.
See the AWS CloudFormation lexicon reference for intrinsic functions, composites, custom lint rules, and examples.
Step 4: Build
Section titled “Step 4: Build”chant buildThe build command discovers all .ts files, collects exported declarables, resolves dependencies, and serializes to the target format.
Step 5: Run an Op
Section titled “Step 5: Run an Op”Resources synthesize to artifacts. Ops execute — phased, with retries and rollback. Write a minimal one:
import { Op, phase, shell } from "@intentius/chant-lexicon-temporal";
export default Op({ name: "hello", overview: "Minimal local Op — no Temporal server required", taskQueue: "hello", phases: [ phase("Greet", [ shell("echo hello from chant"), ]), ],});chant run hello[phase] Greet ✓ shellCmd(cmd=echo hello from chant) 42msOp "hello" completed in 0.1sNo Temporal server required — chant runs Ops locally by default. (The Op imports from @intentius/chant-lexicon-temporal, so install that package — but nothing has to be running.) For durable resume, gates, and schedules, configure a Temporal profile and pass --temporal. See Local vs Temporal.
Step 6: See drift, decide what to do
Section titled “Step 6: See drift, decide what to do”Once resources are deployed, chant tells you when the cloud and your source disagree — without hosting a state file:
chant lifecycle diff prod --liveThat’s the observe position: report drift, change nothing. From there you turn the dial up per environment — open cloud → code PRs (ReconcileOp) or apply code → cloud behind a gate (ApplyOp). The lifecycle-reconcile-aws example walks the whole loop; Lifecycle Models explains the dial.
Next Steps
Section titled “Next Steps”- Project Structure — understand what
chant initcreated - Core Concepts — learn the design principles behind chant
- Writing Resources — the full guide to defining resources
- Linting & Type-Checking — validate your definitions
- Choosing Your Deployment Model — synthesize only, or extend into durable deployment workflows
- Ops — define
*.op.tsfiles for phased, observable deploys with gates and rollback - Lifecycle Models — the observe → reconcile → authoritative dial, chosen per environment