Tusk Drift – Open-Source API Testing SDK for Node.js
Open-source Node.js SDK that records live API calls and replays them as deterministic tests. Supports HTTP, gRPC, PostgreSQL, MongoDB, Redis, GraphQL, and more. Self-hosted.
TL;DR
TL;DR: Tusk Drift is an open-source Node.js SDK that records live API calls and replays them as deterministic regression tests — no mock servers, no external dependencies, fully self-hosted.
What Is Tusk Drift?
Tusk Drift is an open-source API testing SDK built by the team behind Tusk. Rather than writing test assertions by hand, you run your service normally and Drift automatically captures every outbound HTTP, database, and gRPC call. Those recordings become a test suite you can replay deterministically — any regression that changes a recorded response fails the test automatically.
The core philosophy: your real API traffic is the test fixture. No more brittle mock objects or hand-written assertions.
“Automatically record real-world API calls, then replay them as tests using the Tusk CLI to find regressions.”
Source and Accuracy Notes
- Project page: tusk.com — verified
- Source repository: github.com/Use-Tusk/drift-node-sdk — README read in full
- SDK documentation: docs.usetusk.ai/api-tests/installation — verified
- License: Apache 2.0 — verified via LICENSE file
- HN launch thread: news.ycombinator.com/item?id=45887536 — SDK launch thread found via HN Algolia
Setup Workflow
Step 1: Install the CLI
Install the Tusk CLI, which handles configuration and test replay:
npm install -g @use-tusk/tusk-cli
Step 2: Run the setup wizard
The CLI wizard generates your tusk.yml configuration and guides you through SDK installation:
npx tusk drift setup
The wizard will prompt you to install the SDK in your project:
npm install @use-tusk/drift-node-sdk
Step 3: Initialize the SDK
After setup, initialize Drift in your Node.js service. Follow the Initialization Guide to instrument your application. The SDK automatically wraps supported packages at import time — no manual instrumentation required for most use cases.
Step 4: Record and replay
With the SDK initialized, run your service normally. Drift captures all outbound calls automatically. To replay as tests:
tusk drift replay
During replay, all outbound requests are intercepted and served from recorded data — ensuring deterministic, side-effect-free test runs.
Supported Packages
Drift instruments a broad range of Node.js libraries out of the box:
| Category | Packages |
|---|---|
| HTTP | http, https (all versions) |
| gRPC | @grpc/[email protected] |
| Databases | [email protected], [email protected], [email protected], [email protected], [email protected], @upstash/[email protected] |
| ORMs | [email protected] |
| Auth | [email protected], [email protected] |
| API | [email protected] |
The full list is in the README.
How It Works
- Record — Run your service with the SDK loaded. Every outbound call (HTTP, database, cache, gRPC) is serialized to a local trace file.
- Replay — Run
tusk drift replay. The CLI serves recorded responses for every outbound request, intercepting the actual network call. - Assert — Any divergence between recorded and actual responses fails the test, surfacing regressions without manual assertion writing.
This approach is particularly effective for:
- Integration tests against real database and cache layers
- Regression detection when an upstream API changes response shape
- CI pipelines where deterministic, side-effect-free tests are essential
Limitations
- gRPC interception is outbound only
- MySQL support covers
[email protected]and legacy[email protected]— other drivers not yet supported - Documentation is sparse outside the SDK README and quickstart guide
- No TypeScript types mentioned in the current release (check the package
index.d.tsbefore assuming) - No public roadmap or contribution guide visible at publish time
FAQ
Q: How is this different from MockServer or nock? A: nock and MockServer require you to write mock expectations manually. Drift records real production traffic and replays it — no hand-written mocks, and regressions surface automatically when recorded responses diverge from actual calls.
Q: Does it work with TypeScript?
A: The SDK is a Node.js package. Check the package for index.d.ts or types/ to confirm TypeScript support — the current README does not explicitly state a typed release.
Q: Can I run tests against a live database? A: Yes. During replay, outbound database calls are intercepted and served from recorded responses, but the database connection itself may still be established. For fully isolated tests, use a test database instance.
Q: Is there a hosted or SaaS version? A: No. Tusk Drift is entirely self-hosted. There is no external service or subscription required.
Conclusion
Tusk Drift flips the typical API testing model — instead of writing mocks, you record real traffic and replay it as tests. For Node.js services with complex outbound dependencies, this reduces test maintenance significantly. The broad package coverage (15+ libraries) handles most real-world stacks out of the box.
The main trade-off is documentation depth and TypeScript clarity. If you are evaluating it, start with the SDK README and the quickstart guide to confirm your specific stack is covered.
For a tool in active development (the HN thread is from mid-2026), the core recording and replay engine is solid — the gaps are in tooling ergonomics, not the core idea.
Related Posts
ai-setup
Recall – Persistent Memory for Claude Code via MCP Hooks
Recall gives Claude Code a permanent memory store that survives session restarts and context compaction. Four hooks capture and restore context automatically — with cloud SaaS or self-hosted options.
2/28/2026
dev-tools
Automotive Skills Suite for AI Engineering
Evaluate Automotive Skills Suite for APQP, ASPICE, HARA, safety-plan, and DIA workflows with setup notes, governance risks, and SME review guidance.
5/28/2026
dev-tools
awesome-agentic-ai-zh Roadmap Guide
Explore awesome-agentic-ai-zh as a Chinese agentic AI learning roadmap, with setup notes, track selection, study workflow, and evaluation guidance.
5/28/2026