← Back to Blog

npx nark: Scan Your TypeScript Project in 30 Seconds

By Nark Team

One Command, Zero Config

npx nark

That's it. No installation. No config files. No account required.

Nark scans your TypeScript project and tells you exactly where you're ignoring package failure modes that will eventually break production.

What Happens When You Run It

Nark does three things:

  1. Reads your tsconfig.json to find all TypeScript source files
  2. Finds every npm package callaxios.get(), prisma.user.create(), stripe.charges.create(), etc.
  3. Cross-references each call against its Nark Profile — a formal spec of every error, timeout, and edge case that call can produce

The output looks like this:

  src/api/users.ts:24
  ❌ axios.get() — missing error handling
     Contract requires: try/catch or .catch() for AxiosError
     Possible failures: ECONNREFUSED, ETIMEDOUT, 4xx/5xx responses

  src/services/billing.ts:41
  ❌ stripe.customers.create() — missing error handling
     Contract requires: try/catch for StripeError
     Possible failures: rate_limit, authentication_error, invalid_request

  src/db/queries.ts:15
  ✅ prisma.user.findUnique() — properly handled

  Found 2 violations in 3 files (47 calls checked)

Why This Matters

Every unhandled failure mode is a production incident waiting to happen:

  • axios without try/catch → Your API returns a 500 instead of a helpful error message
  • Prisma without error handling → A unique constraint violation crashes your endpoint
  • Stripe without catch → A rate limit error takes down your checkout flow

Unit tests don't catch these because they mock the happy path. Integration tests might, if you remember to test every failure mode. Nark checks all of them, automatically.

Common Options

Specify a tsconfig

npx nark --tsconfig tsconfig.app.json

JSON output for scripting

npx nark --format json > nark-report.json

Check only errors (skip warnings)

npx nark --min-severity error

What Packages Are Supported?

Nark ships with Profiles for the most popular npm packages that make network calls, database queries, or interact with external services:

PackageWhat Nark Checks
axiosNetwork errors, timeouts, HTTP error responses
@prisma/clientQuery failures, connection errors, constraint violations
stripeAPI errors, rate limits, idempotency issues
pgConnection failures, query errors
redis / ioredisConnection failures, command errors
nodemailerSMTP errors, auth failures
mongooseConnection errors, validation failures
twilioAPI errors, rate limits

The Profile library is open source and growing. You can also write your own Profiles for internal packages.

Add It to CI

The real power is running Nark on every pull request. See our guide on adding Nark to GitHub Actions for a 5-minute setup.

Try It Now

Open your terminal in any TypeScript project and run:

npx nark

No signup. No credit card. Just answers.