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.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | mswjs/data |
| Owner | mswjs |
| Primary language | TypeScript |
| License | MIT — OSI-approved |
| Stars | 1k |
| Forks | 65 |
| Open issues | 7 |
| Latest release | v1.1.6 (2026-05-15) |
| Last updated | 2026-05-20 |
| Source | https://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.
Get the data source
Clone the repository and explore it locally.
git clone https://github.com/mswjs/data.gitcd data# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
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.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
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.
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.coRelated 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?
What schema libraries are supported?
Do I have to use Mock Service Worker?
Does @msw/data support transactions or rollback?
Work with a software development agency
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If data is part of your open-source testing roadmap, our team can implement, customize, migrate, and maintain it.
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.