Resource Naming
chant discovers resources by scanning exports from your src/ files. The export name becomes the logical resource name — it’s what you see in lint output, build logs, and cross-file imports. Choosing clear, consistent names makes your project easier to navigate and maintain.
Export naming
Section titled “Export naming”Exports must use camelCase — the lint rule COR005 enforces this automatically.
// ✅ correctexport const appBucket = new Bucket({ ... });export const taskQueue = new Queue({ ... });
// ❌ rejected by COR005export const AppBucket = new Bucket({ ... });export const app_bucket = new Bucket({ ... });Descriptive names
Section titled “Descriptive names”Name exports after what the resource does, not what it is. Suffix with the resource’s role to distinguish resources of the same type.
// ✅ clear purposeexport const uploadBucket = new Bucket({ ... });export const taskQueue = new Queue({ ... });export const apiRole = new Role({ ... });
// ❌ ambiguousexport const bucket1 = new Bucket({ ... });export const myQueue = new Queue({ ... });Shared configuration
Section titled “Shared configuration”When multiple resources share naming prefixes or tags, extract them into a const object. Template literals keep physical names consistent across the stack.
import { Bucket, Queue } from "@intentius/chant-lexicon-aws";
const app = { name: "myapp", team: "platform" } as const;
export const dataBucket = new Bucket({ BucketName: `${app.name}-data`, Tags: [{ Key: "Team", Value: app.team }], PublicAccessBlockConfiguration: { BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true, },});
export const taskQueue = new Queue({ QueueName: `${app.name}-tasks`, Tags: [{ Key: "Team", Value: app.team }],});Because the config object is as const, chant’s evaluator can resolve every value at build time.
Multiple similar resources
Section titled “Multiple similar resources”TypeScript’s native constructs replace the need for framework-level count or for_each. Use Array.map to create a set of resources, then destructure the result into named exports:
import { Bucket } from "@intentius/chant-lexicon-aws";
const envs = ["dev", "staging", "prod"] as const;
const buckets = envs.map( (env) => new Bucket({ BucketName: `myapp-${env}-data`, PublicAccessBlockConfiguration: { BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true, }, }));
export const [devData, stagingData, prodData] = buckets;Each destructured export (devData, stagingData, prodData) is a distinct named resource that can be referenced from other files via import.
File organization
Section titled “File organization”Group related resources in the same file and keep unrelated ones separate. The lint rule COR009 warns when a single file exports eight or more resources — a signal that it may be doing too much.
A typical layout:
src/ storage.ts # buckets, tables compute.ts # functions, containers networking.ts # VPCs, subnets, security groups iam.ts # roles, policiesNext steps
Section titled “Next steps”- Cross-File References — import resources from other files
- Composite Resources — group related resources into reusable units