Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/georgiirocket/nestjs-monorepo
✅ Implementation nestjs-monorepo (microservices)
https://github.com/georgiirocket/nestjs-monorepo
docker monorepo nestjs prisma
Last synced: 26 days ago
JSON representation
✅ Implementation nestjs-monorepo (microservices)
- Host: GitHub
- URL: https://github.com/georgiirocket/nestjs-monorepo
- Owner: georgiirocket
- Created: 2024-11-17T16:23:18.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-29T10:55:14.000Z (27 days ago)
- Last Synced: 2024-11-29T11:37:19.599Z (27 days ago)
- Topics: docker, monorepo, nestjs, prisma
- Language: TypeScript
- Homepage:
- Size: 128 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Monorepo
Implementation nestjs-monorepo (microservices)
This repository shows how you can organize the structure in monorepo.
Feel free to copy, add and use this
## Tools used
- [Nest JS](https://nestjs.com/)
- [Prisma](https://www.prisma.io/)
- [Docker](https://www.docker.com/)## First start
Before the start you need to install docker and run it.
1.Clone repository
2.Install dependencies
```bash
npm i
```3.Start dev database
```bash
docker-compose --profile dev up -d
```4.Migrate prisma schema
```bash
npm run migrate-dev
```4.Start all apps
```bash
npm run start:micro
```## Start prod
Before the start you need to install docker and run it.
```bash
docker-compose --profile prod up -d
```## Documentation
After the start applications:
- [Swagger](http://localhost:3000/api-documentation)
## Postman
If you want to test endpoints. You can import this file in Postman
- nestjs-monorepo.postman_collection.json
## Structure
Services can communicate between each other
```mermaid
flowchart TD
G[NestJS Gateway]
D[Database]subgraph Services
s1[User service]
s2[Post service]
endG --> s1
G --> s2
s1 --> D
s2 --> D
``````
.
├── Dockerfile
├── README.md
├── apps
│ ├── gateway
│ │ ├── Dockerfile
│ │ ├── src
│ │ │ ├── gateway.module.ts
│ │ │ ├── main.ts
│ │ │ ├── post
│ │ │ │ ├── post.controller.ts
│ │ │ │ └── post.module.ts
│ │ │ └── user
│ │ │ ├── user.controller.ts
│ │ │ └── user.module.ts
│ │ └── tsconfig.app.json
│ ├── post
│ │ ├── Dockerfile
│ │ ├── src
│ │ │ ├── main.ts
│ │ │ ├── post.controller.ts
│ │ │ ├── post.module.ts
│ │ │ └── post.service.ts
│ │ └── tsconfig.app.json
│ └── user
│ ├── Dockerfile
│ ├── src
│ │ ├── main.ts
│ │ ├── user.controller.ts
│ │ ├── user.module.ts
│ │ └── user.service.ts
│ └── tsconfig.app.json
├── docker-compose.yml
├── environment.d.ts
├── libs
│ ├── src
│ │ ├── constants
│ │ │ ├── patterns
│ │ │ │ ├── post.ts
│ │ │ │ └── user.ts
│ │ │ └── services.ts
│ │ ├── dto
│ │ │ ├── entity.dto.ts
│ │ │ ├── post
│ │ │ │ ├── create.dto.ts
│ │ │ │ ├── delete.dto.ts
│ │ │ │ ├── post.dto.ts
│ │ │ │ └── update.dto.ts
│ │ │ └── user
│ │ │ ├── create.dto.ts
│ │ │ ├── delete.dto.ts
│ │ │ ├── update.dto.ts
│ │ │ └── user.dto.ts
│ │ ├── filters
│ │ │ └── exception-up.filter.ts
│ │ ├── modules
│ │ │ └── database
│ │ │ ├── prisma.module.ts
│ │ │ └── prisma.service.ts
│ │ └── services
│ │ └── micro
│ │ └── service.ts
│ └── tsconfig.lib.json
├── migration.sh
├── nest-cli.json
├── nestjs-monorepo.postman_collection.json
├── package-lock.json
├── package.json
├── prisma
│ ├── migrations
│ │ ├── 20241121165743_init
│ │ │ └── migration.sql
│ │ ├── 20241121171613_adding_dates_fields
│ │ │ └── migration.sql
│ │ ├── 20241121182847_adding_cascade
│ │ │ └── migration.sql
│ │ ├── 20241122112740_uniq_name
│ │ │ └── migration.sql
│ │ └── migration_lock.toml
│ └── schema.prisma
├── tsconfig.build.json
└── tsconfig.json```
## Node version
- node - 20.16.0
- npm - 10.8.1