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

https://github.com/AlexGalhardo/farm-nestjs-api

A simple NestJS REST CRUD API using PostgreSQL, PrismaORM, Zod, Docker, Pino Logger, Swagger OpenAPI Documentation, Unit and Integrations Tests using Jest
https://github.com/AlexGalhardo/farm-nestjs-api

api crud docker integration-testing nestjs postgresql prisma rest-api typescript unit-test zod

Last synced: 6 months ago
JSON representation

A simple NestJS REST CRUD API using PostgreSQL, PrismaORM, Zod, Docker, Pino Logger, Swagger OpenAPI Documentation, Unit and Integrations Tests using Jest

Awesome Lists containing this project

README

          

Farm NestJS API

## Technologies

- [NodeJS v22](https://nodejs.org/en)
- [NestJS v11](https://nestjs.com/)
- [PrismaORM](https://www.prisma.io/)
- [Docker](https://docs.docker.com/)
- [PostgreSQL](https://www.postgresql.org/)

## Prerequisites

- Node v22 and NPM v11

```bash
nvm install 22.9.0
nvm use 22.9.0
npm install -g npm@11.4.2
```

## Local Development Setup using Docker

1. Clone repository

```bash
git clone git@github.com:AlexGalhardo/farm-nestjs-api.git
```

2. Enter repository

```bash
cd farm-nestjs-api/
```

3. Install dependencies

```bash
npm install
```

4. Setup your environment variables

```bash
cp .env.example .env
```

5. UP Docker with Postgres & API

```bash
sudo chmod +x setup.sh && ./setup.sh
```

6. The Server API will start Inside docker connecting to your local machine at:

## Prisma Studio (DataBase GUI)

- To Start Prisma Studio:

```bash
npm run prisma:studio
```

## Build

a. Creating build

```bash
npm run build
```

b. Testing build server locally

```bash
npm run start
```

## API Requests and Docs

- You can see and use the HTTP Requests references inside folder [rest-client/](rest-client/)
- OpenAPI Documentation (using Swagger)
- Local:

## Tests

a. Run all unit mocked tests

```bash
npm run test
```

Screenshot 2025-06-06 at 16 24 05

b. Run all end to end tests

```bash
npm run test:e2e
```

Screenshot 2025-06-06 at 14 43 15

## License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) June 2025-present, [Alex Galhardo](https://github.com/AlexGalhardo)