Welcome to Nestjs-Query
Relevant source files
The following files were used as context for generating this wiki page:
Nestjs-Query provides a collection of packages to simplify the creation of CRUD (Create, Read, Update, Delete) endpoints in NestJS applications. It primarily focuses on GraphQL but also supports REST and multiple persistence layers. The framework automates common patterns such as querying, sorting, and paging, allowing you to focus on business logic.
Sources: README.md:12-16, documentation/src/pages/index.js:13-19
Project Architecture
Nestjs-Query operates as a monorepo managed with Yarn 4 workspaces and Nx. The system separates core logic from transport and persistence layers to ensure flexibility.
Core Modules and Relationships
The following diagram illustrates how the core package provides the foundation for transport and persistence adapters.
The architecture separates framework-independent query primitives in core from specific integrations like graphql and typeorm.
Sources: AGENTS.md:5-7, AGENTS.md:32-36, packages/core/README.md:12-14
Package Overview
| Package Name | Purpose |
|---|---|
@ptc-org/nestjs-query-core | Defines interfaces and utility types used by all other packages. |
@ptc-org/nestjs-query-graphql | Provides GraphQL resolvers, decorators, and CRUD endpoints. |
@ptc-org/nestjs-query-rest | Implements code-first REST CRUD endpoints. |
| Persistence Adapters | Implement QueryService for TypeORM, Mongoose, Sequelize, and Typegoose. |
Sources: README.md:31-45, packages/query-rest/README.md:12-14
Development and Contribution
The project follows strict guidelines to maintain code quality and consistency across its various modules.
Development Process
You must follow the Conventional Commits Guidelines for all contributions. The project uses GitHub issues for tracking bugs and feature requests. Each change must be reflected in an issue or pull request.
Sources: CONTRIBUTING.md:9-11, CONTRIBUTING.md:139-141, AGENTS.md:21-21
Testing Standards
Nestjs-Query distinguishes between unit tests and E2E (End-to-End) tests:
- Unit Tests: Located in the package's
test/directory, matching thesrc/path. They must not rely on persistent storage. - E2E Tests: Located in the
examples/directory. They ensure the stack functions correctly when called through the full layers.
Sources: CONTRIBUTING.md:85-115, AGENTS.md:19-20
Build and Initialization
To prepare the environment for development, perform the following steps:
- Run
npm installto install dependencies. - Run
npm run bootstrapto link monorepo packages. - Run
npm run buildto compile all packages. - Use
docker compose up -dwithin theexamplesdirectory to start backing services for E2E tests.
Sources: CONTRIBUTING.md:73-79, CONTRIBUTING.md:126-130
Key Features
Nestjs-Query automates complex API patterns through its modular structure:
- GraphQL CRUD: Creates resolvers with built-in filtering, paging, and sorting.
- Persistence Agnostic: You can swap between TypeORM, Sequelize, or Mongoose while using the same core interfaces.
- Built with TypeScript: The entire codebase is native TypeScript, ensuring type safety from the ground up.
- Code-First Approach: Resolvers and controllers are generated based on DTO classes and decorators.
Sources: README.md:31-45, documentation/src/pages/index.js:13-33
Summary
Nestjs-Query provides a scalable, type-safe framework for building CRUD APIs in NestJS. By utilizing @ptc-org/nestjs-query-core for shared logic and specific adapters for GraphQL, REST, and various databases, it reduces boilerplate and enforces consistent API patterns across the entire application stack.
Sources: README.md:12-16, AGENTS.md:32-36 Assistant: