https://github.com/ziv/nestjs-rest
JSON:API integration with Nest.JS
https://github.com/ziv/nestjs-rest
Last synced: 3 months ago
JSON representation
JSON:API integration with Nest.JS
- Host: GitHub
- URL: https://github.com/ziv/nestjs-rest
- Owner: ziv
- License: mit
- Created: 2025-07-19T10:58:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-01-27T17:41:51.000Z (4 months ago)
- Last Synced: 2026-01-28T01:48:51.159Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 524 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# nestjs-rest
A [`JSON:API`](https://jsonapi.org/) compliant REST controller for
[`NestJS`](https://nestjs.com/).
[](https://github.com/ziv/nestjs-rest/actions/workflows/ci.yml)
[](http://commitizen.github.io/cz-cli/)
[](https://github.com/semantic-release/semantic-release)
# Overview
This project bring the `JSON:API` specification to the `NestJS` framework,
providing zero code REST controller that supports CRUD operations, sorting,
pagination, filtering, and more using simple configurations.
## Contents
| Package Name | Version | Description |
| ------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [`std-json-api`](./packages/std-json-api) |  | Standard `JSON:API` implementation, providing the core functionality of document structure |
| [`nestjs-rest`](./packages/nestjs-rest) |  | NestJS controller that implements the `JSON:API` |
| [`nestjs-rest-mongodb`](./packages/nestjs-rest-mongodb) |  | MongoDB adapter for `nestjs-rest` |
## Specification
`JSON:API/v1` specification is a standard for building APIs in JSON
format([reference](./packages/std-json-api/specs.md)).
### Implementation Report
| Spec | Subject | Status | Reference |
| ------------------- | ---------- | ------ | -------------------------------------------------- |
| content-negotiation | | 🚧 | https://jsonapi.org/format/#content-negotiation |
| document structure | | ✈️ | https://jsonapi.org/format/#document-structure |
| fetching data | | ✈️ | https://jsonapi.org/format/#fetching |
| | sorting | ✈️ | https://jsonapi.org/format/#fetching-sorting |
| | pagination | ✈️ | https://jsonapi.org/format/#fetching-pagination |
| | filtering | ✈️ | https://jsonapi.org/format/#fetching-filtering |
| | relations | 🚧 | https://jsonapi.org/format/#fetching-relationships |
| crud | | ✈️ | https://jsonapi.org/format/#crud |
| query parameters | | ✈️ | https://jsonapi.org/format/#query-parameters |
| errors | | 🚧 | https://jsonapi.org/format/#errors |
| extensions | | 🚧 | https://jsonapi.org/extensions/ |
### Pagination Strategies
There are two pagination strategies supported by this project:
| Pagination Strategy | Status | Description |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Offset-based pagination | ✈️ | Default pagination strategy using offset and limit query parameters. |
| Cursor-based pagination | ✈️ | Pagination strategy using cursor to provide a more efficient way to paginate through large datasets. |
### Adapters Implementation Report
| Adapter | Status | Description | Readme |
| ------- | ------ | -------------------------------------------------------------- | -------------------------------------------------- |
| Mongodb | ✈️ | Simple (without relationships) adapter for Mongodb collection. | [readme](./packages/nestjs-rest-mongodb/readme.md) |
---
#### Legend
✅ done ✈️ departed (ready for testing) 🚧 in progress 🚫 not started 🫥 not planned
---
# TODO
- [x] Add a MongoDB adapter.
- [x] Convert to be JSON:API compliant.
- [ ] Add a client library.
- [ ] Add any SQL DB adapter.
- [ ] Add Typeorm support.