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

https://github.com/adrianmjim/nestjs-api-grpc-example

gRPC API pet project built on top of NestJS using DDD, CQRS, MikroORM and PostgreSQL
https://github.com/adrianmjim/nestjs-api-grpc-example

cqrs ddd ddd-architecture grpc grpc-server mikroorm nestjs nestsjs nodejs postgresql

Last synced: 21 days ago
JSON representation

gRPC API pet project built on top of NestJS using DDD, CQRS, MikroORM and PostgreSQL

Awesome Lists containing this project

README

          

# NestJS API gRPC Example


Nest Logo








## Description

gRPC API pet project built on top of NestJS using DDD, CQRS, MikroORM and PostgreSQL

## Requirements:

1. Install [NodeJS](https://nodejs.org) and [pnpm](https://pnpm.io)

2. Install dependencies

```bash
pnpm install
```

3. Add an .env file based on .env.example

## Database

We need a PostgreSQL instance to run the project. It's necessary to configure the environment variables for this database in the .env file. This project can also be launched with Docker Compose, which already includes the required database instance.

This repository uses [MikroORM](https://mikro-orm.io) and its [migration system](https://mikro-orm.io/docs/migrations). To apply the migrations, you need to run the following command:

```bash
npx mikro-orm migration:up
```

## Usage:

You can start the app in development mode:

```bash
pnpm start:dev
```

Or in production mode:

1. First, You need to build code:

```bash
pnpm build
```

2. Then, You can start app:

```bash
pnpm start:prod
```

To run the current repository using Docker Compose, follow these steps:

1. Build images

```bash
docker compose build
```

2. Run services

```bash
docker compose up
```

## Test

You can run test of this project:
```bash
pnpm test
```