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 --lexicon aws my-infracd 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.
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