Build
Connect & operate
Design & teams
Start hereScope a build in one callBring a spec, a wireframe, or a paragraph. You leave with an architecture, a timeline, and a number.Book a scoping call
AI software
LLM & data systems
Vibe coding
Ready to ship?Put AI where the work isAgents, RAG, and private LLMs wired into the systems your team already uses — not a chatbot bolted to a homepage.Discuss an AI project
Domain firstWe learn your workflow before we model itRegulated, operational, or high-volume — the constraints belong in the schema, not in a training doc.Talk about your domain
Plan smarterEstimate before you commitCost ranges, scope templates, and the questions we ask in discovery — free, no form.Open the cost calculator
Real conversationsTalk with a technical leadNo SDR, no discovery gauntlet. The person on the call is the one who scopes the build.Book a call
Open-Source Testing · mswjs

data

@msw/data is a schema-based data querying library designed for testing JavaScript applications. It allows developers to model, seed, and query test data using Standard Schema libraries (Zod, Valibot, etc.) with an ORM-inspired syntax, and integrates with Mock Service Worker for full mocking workflows.

Source: GitHub — github.com/mswjs/data
1k
GitHub stars
65
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorymswjs/data
Ownermswjs
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars1k
Forks65
Open issues7
Latest releasev1.1.6 (2026-05-15)
Last updated2026-05-20
Sourcehttps://github.com/mswjs/data

What data is

Provides runtime and type-safe data collections with Prisma-like querying, Drizzle-inspired relations (one-to-one, one-to-many, many-to-many), offset/cursor pagination, sorting, and logical operators. Relies on Standard Schema for schema definition rather than proprietary syntax, enabling compatibility with multiple validation libraries.

Quickstart

Get the data source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/mswjs/data.gitcd data# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Testing with complex relational data

Seed collections with defined relations (one-to-many, many-to-many) and query them in tests, avoiding manual fixture construction and enabling realistic data scenarios.

MSW-integrated mocking workflows

Use @msw/data alongside Mock Service Worker to mock both network and data layers seamlessly, reducing test setup boilerplate for API-dependent applications.

Fixture generation with pagination and filtering

Generate test data at scale using .createMany() with Faker, then query with offset/cursor pagination and complex predicates for realistic pagination testing.

Implementation considerations

  • Choose a Standard Schema library (Zod, Valibot, ArkType) upfront; schema modeling is core to the library, and switching later requires refactoring collections.
  • Plan relational schema design carefully—relations are declared post-collection creation and depend on internal IDs, requiring thoughtful ordering in setup.
  • Seed data with .createMany() and predicates can become verbose for large or complex test datasets; consider abstractions or factory patterns to reduce repetition.
  • Pagination support includes both offset and cursor-based; cursor pagination requires maintaining record references, which may add complexity in large test suites.
  • Extensions exist but are not documented in the excerpt; evaluate custom extension needs (e.g., cross-tab sync) early, as they may require external implementation.

When to avoid it — and what to weigh

  • Production data layer needs — This library is explicitly for testing and development. Do not use for production databases or persistent data storage; it is in-memory and test-scoped.
  • Existing ORM investment — If your test suite already relies on Prisma, TypeORM, or Sequelize, integrating a separate testing-only ORM may complicate rather than simplify your stack.
  • Simple mocking without relations — For lightweight test mocks with no relational logic, simpler fixtures or libraries may introduce less overhead than modeling collections with schemas.
  • Non-JavaScript/TypeScript ecosystems — Limited to JavaScript/TypeScript; no bindings for Python, Go, Java, or other languages if you test cross-language integrations.

License & commercial use

MIT License (permissive OSI-approved). Grants rights to use, modify, distribute, and sublicense with minimal restrictions.

MIT License permits commercial use in closed-source products without disclosure. However, verify that all transitive dependencies (schema libraries, MSW, etc.) align with your commercial license requirements before production adoption.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

In-memory test library with no persistent storage, network exposure, or authentication. Security concerns are limited to test data isolation in concurrent test environments and schema validation via Standard Schema libraries. Use secrets with caution in seed data.

Alternatives to consider

Prisma Client (test utilities)

Provides relational modeling and querying for test databases; heavier lift but integrates with production Prisma schemas. Better if you already use Prisma in production.

Factory Bot (JavaScript, Fishery, etc.)

Lightweight fixture builders for simple object generation. Minimal overhead compared to schema-based collections; suitable if relations and complex querying are not required.

Faker.js with manual fixtures

Lower-level random data generation without schema enforcement or querying. Suits projects avoiding extra abstraction layers or preferring ad-hoc test data.

Software development agency

Build on data with DEV.co software developers

Devco can help you design and integrate testing libraries like @msw/data, or build custom testing solutions tailored to your TypeScript or JavaScript application.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

data FAQ

Can I use @msw/data in production?
No. It is explicitly designed for testing and development. Use a production ORM (Prisma, Drizzle, TypeORM) for persistent data.
What schema libraries are supported?
Any Standard Schema-compliant library: Zod, Valibot, ArkType, yup, and others. Choose based on your existing stack and preferences.
Do I have to use Mock Service Worker?
No. @msw/data works standalone for in-memory test data. MSW integration is optional and enhances full-stack mocking workflows.
Does @msw/data support transactions or rollback?
Not explicitly documented in the README. Requires review of full API documentation; in-memory nature may limit transaction semantics.

Custom software development, end to end

If data is on your shortlist, DEV.co can build around it. We are a custom software development company covering architecture, implementation, and production operations for open-source testing workloads.

Need test data infrastructure for your application?

Devco can help you design and integrate testing libraries like @msw/data, or build custom testing solutions tailored to your TypeScript or JavaScript application.