Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/josephgodwinkimani/nestjsx-crud-starter

@nestjsx/crud starter repository for RESTful APIs running on Fastify
https://github.com/josephgodwinkimani/nestjsx-crud-starter

boilerplate crud fastify nestjs nestjsx-crud restful-api starter-template typeorm

Last synced: 25 days ago
JSON representation

@nestjsx/crud starter repository for RESTful APIs running on Fastify

Awesome Lists containing this project

README

        


Nest Logo

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest

A progressive Node.js framework for building efficient and scalable server-side applications.



NPM Version
Package License
NPM Downloads
CircleCI
Coverage
Discord
Backers on Open Collective
Sponsors on Open Collective

Support us


## Simple Blog API (CRUD users, users CRUD posts)

> [nestjsx-crud](https://github.com/nestjsx/crud) [TypeORM](https://docs.nestjs.com/techniques/database#repository-pattern) [Fastify](https://github.com/fastify/fastify) REST API

Nest TypeScript starter repository with NestJs CRUD for RESTful APIs and Fastify.

## Installation

```bash
$ pnpm install
```

## Running the app

```bash
# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod
```

## Test

```bash
# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov
```

## API Endpoints

nestjsx/crud `Crud()` decorator generates the following API endpoints:

### Get many resources

```
GET /users
GET /posts
```

_Result:_ array of resources | pagination object with data,
_Status Codes:_ 200

### Get one resource

```
GET /users/:id
GET /posts/:id
```

_Request Params:_ :id - some resource field (slug),
_Result:_ resource object | error object,
_Status Codes:_ 200 | 404

### Create one resource

```
POST /users
POST /posts
```

_Request Body:_ resource object | resource object with nested (relational) resources,
_Result:_ created resource object | error object,
_Status Codes:_ 201 | 400

### Update one resource

```
PATCH /users/:id
PATCH /posts/:id
```

_Request Params:_ :id - some resource field (slug),
_Request Body:_ resource object (or partial) | resource object with nested (relational) resources (or partial),
_Result:_ updated partial resource object | error object,
_Status codes:_ 200 | 400 | 404

### Delete one resource
```
DELETE /users/:id
DELETE /posts/:id
```

_Request Params:_ :id - some resource field (slug),
_Result:_ empty | resource object | error object
_Status codes:_ 200 | 404

## License

This repo is [MIT licensed](LICENSE).

## Related Projects

- [Refine Boilerplate for Web (PWA), Desktop and Mobile](https://github.com/josephgodwinkimani/refine-starter) — A Cross-Platform starter template for Refine.dev that utilizes the Simple REST data provider to fetch and display data from a REST API (can easily replace with graphql data provider).
-