How to Add Nark to Your CircleCI Pipeline
By Nark Team
Overview
Adding Nark to CircleCI ensures every commit is checked for unhandled package behaviors — axios timeouts, Prisma connection failures, Stripe rate limits, and more. Setup takes under 5 minutes.
Prerequisites
- A TypeScript project with a
tsconfig.json - A CircleCI account connected to your repository
Basic Setup
Add a Nark job to your .circleci/config.yml:
version: 2.1
jobs:
nark-scan:
docker:
- image: cimg/node:20.0
steps:
- checkout
- run:
name: Install dependencies
command: npm ci
- run:
name: Run Nark
command: npx nark --tsconfig tsconfig.json
workflows:
check:
jobs:
- nark-scan
Add to an Existing Workflow
If you already have a CI workflow, add Nark as a parallel job:
workflows:
build-and-test:
jobs:
- build
- test
- lint
- nark-scan # Runs in parallel with other checks
With Nark Cloud (Optional)
To stream results to your Nark Cloud dashboard, add your API key as an environment variable in CircleCI:
- Go to Project Settings → Environment Variables in CircleCI
- Add
NARK_API_KEYwith your key from the Nark Cloud dashboard - Update the job:
nark-scan:
docker:
- image: cimg/node:20.0
steps:
- checkout
- run:
name: Install dependencies
command: npm ci
- run:
name: Run Nark
command: npx nark --tsconfig tsconfig.json --api-key $NARK_API_KEY
Save Results as Artifacts
Store the scan report for later review:
nark-scan:
docker:
- image: cimg/node:20.0
steps:
- checkout
- run:
name: Install dependencies
command: npm ci
- run:
name: Run Nark
command: npx nark --tsconfig tsconfig.json --format json > /tmp/nark-report.json
- store_artifacts:
path: /tmp/nark-report.json
destination: nark-report.json
Monorepo Configuration
For monorepos, use CircleCI's matrix jobs:
jobs:
nark-scan:
parameters:
package:
type: string
docker:
- image: cimg/node:20.0
steps:
- checkout
- run: npm ci
- run:
name: Run Nark on << parameters.package >>
command: npx nark --tsconfig << parameters.package >>/tsconfig.json
workflows:
check:
jobs:
- nark-scan:
matrix:
parameters:
package: ["apps/api", "apps/web", "packages/shared"]
Next Steps
- What Is Nark Profile Verification? — understand the concepts
- npx nark: Scan in 30 Seconds — try it locally first
- GitHub Actions setup — alternative CI platform guide