Local Development

Daily commands for building, testing, formatting, and deploying from your workstation.


Dev workflow at a glance

Everything in this repo runs through Projen-generated npm scripts, so the same commands work locally and in CI. Run npx projen --help to see the full list.

Build and test

npm run build   # compile, synth, test, lint in one go (used by CI)
npm test        # jest with coverage enabled

Need a faster feedback loop? Use watch mode:

npm run watch        # rebuild and re-test on file changes
npm run test:watch   # jest watch mode with the repo's config

Format and lint

Biome rules are enforced in CI. Run them locally before you commit:

npm run biome             # check mode
npm run biome -- --apply  # fix mode (note the extra `--`)

Stack operations with environment tasks

Projen creates per-environment commands based on .projenrc.ts. Replace test with any other environment name you configure (see Configuration > Environments).

npm run test:synth                   # synthesize all stacks for the test account
npm run test:diff:stack StarterStack # diff a specific stack
npm run test:deploy:all              # deploy all stacks
npm run test:destroy:stack FooStack  # destroy a specific stack
 
# Branch previews (auto-set GIT_BRANCH_REF)
npm run test:branch:synth
npm run test:branch:deploy:all

Every command sets CDK_DEFAULT_ACCOUNT, CDK_DEFAULT_REGION, ENVIRONMENT, and (for branch tasks) GIT_BRANCH_REF so names and tags stay consistent. See Branch-based Development for the full preview workflow.

Watch mode for infrastructure

When supported by your stacks, CDK watch gives rapid redeploys:

npx cdk watch

This uses your current AWS credentials and deployments are scoped by the environment variables injected into the process (for example, run npm run test:synth once to set env vars in your shell session).

Keep configuration in sync

Any time you edit .projenrc.ts, regenerate the project:

npx projen

Review the resulting git diff before committing. Generated files should never be hand-edited—tweak .projenrc.ts, rerun Projen, and let the automation update tasks, workflows, and config.