GodTunnel
Code & DataGodTunnel Engineering··7 min read

Debugging APIs Locally: Inspecting JWTs, Converting cURL to Fetch, and Generating TypeScript Types

Inspect production JWT tokens locally, test regular expressions, translate cURL commands to Fetch or Axios, and generate TypeScript types.

Quick summary

Pasting live bearer JWTs, API keys, or private SQL queries into unknown third-party web tools risks credential exposure in analytics or server logs. Decoding Base64URL claims, checking HMAC signatures via WebCrypto, translating cURL snippets into Fetch or Axios code, and generating TypeScript interfaces locally keeps secrets inside your browser tab.

Inspecting JWT claims and signatures without leaking bearer tokens

A JSON Web Token looks opaque at first glance, yet its header and payload segments are plain Base64URL-encoded JSON. Developers frequently paste production Authorization headers into public debugger websites to inspect scopes, tenant IDs, or expiration timestamps (exp and iat), inadvertently exposing valid session tokens to remote telemetry.

Decoding the three dot-separated segments directly inside local browser memory eliminates that risk. When you need to verify HS256, HS384, or HS512 signatures against a shared staging secret, WebCrypto performs subtle HMAC verification right on your machine without making a single network request.

From raw cURL snippets and API payloads to clean TypeScript interfaces

Turning API documentation examples into production client code typically involves three repetitive chores: adapting cURL flags into Fetch or Axios request objects, validating malformed JSON responses by exact line and column number, and modeling deeply nested JSON objects into strongly typed TypeScript interfaces.

Safe automated generators should inspect arrays of uniform objects, merge optional fields across array elements, and quote non-identifier keys such as kebab-case headers automatically while avoiding duplicate Root type aliases or silent name collisions.

Everyday API debugging shortcuts and the tools built for each stage
Workflow StepCommon Failure PointLocal Utility Fix
Parse cURL commandMismatched single vs double quotes on -d bodiesPaired-quote shell parser emitting escaped Fetch, Axios, or HTTPie
Validate JSON syntaxCryptic offset numbers on minified 50 KB payloadsLine and column error mapping with configurable indentation
Generate TS interfacesDuplicate interface names overwriting nested shapesStructural collision disambiguation and optional property detection
Evaluate JSONPathSilent prototype lookup bugs like $.constructorStrict own-property traversal with full expression consumption checks

Checking cron schedules, regular expressions, and CSS minification edge cases

Off-by-one schedule mistakes in 5-field cron jobs, such as mixing numeric weekday ranges (1-7 vs mon-sun where Sunday represents both 0 and 7), often go unnoticed until a weekend batch job fails to trigger. Inspecting the next five actual local run timestamps before committing catches range inversion and DOM/DOW union logic immediately.

Similarly, naive string minifiers frequently corrupt valid CSS math functions by stripping required whitespace around plus and minus signs inside calc(100% + 16px) or collapsing descendant spaces before :hover pseudo-classes. Modern token-aware formatters isolate quoted strings, URLs, and CSS math functions before normalizing selectors and declarations.

Frequently asked questions

Can browser JWT decoders verify RS256 public keys too?
Base64URL header/payload inspection and exp claim expiration checks work on all JWT algorithms locally. Local signature verification in simple secret mode supports HS256, HS384, and HS512 via HMAC WebCrypto.
Why do naive CSS minifiers break calc() expressions?
Per the CSS Values specification, binary + and - operators inside calc() require whitespace on both sides to distinguish subtraction from negative lengths or percentages.
How does cron handle day-of-month and day-of-week when both are set?
Standard Vixie cron triggers when EITHER the day-of-month OR the day-of-week matches if both fields are restricted (not *), rather than intersecting them.

Explore category hubs

More technical guides