mata
mata
PPrisma
Created by mata on 8/13/2024 in #help-and-questions
Share prisma schema and client between two backend services.
I have this backend project where I am creating two services both running on different port e.g httpService , wsService. Though I am challenged with handling prisma between the two services since they are going to rely on the same database, I think they would need to share the prisma client and not to have challenges with manually updating the schema from one service to another. Below is my file structure, whenever I try to run prisma it tries to create a package.json in the root folder which I don't desire. How can I share prisma client between to services running within different docker containers?
backend/
├── docker-compose.yml
├── httpServer/
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ ├── prismaClient.ts
│ ├── src/
│ │ ├── httpServer.ts
│ │ └── ...
│ ├
│ └── .env
├── wsServer/
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ ├── prismaClient.ts
│ ├── src/
│ │ ├── wsServer.ts
│ │ └── ...
│ ├
│ └── .env
└── prisma/
├── schema.prisma
└── migrations/
backend/
├── docker-compose.yml
├── httpServer/
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ ├── prismaClient.ts
│ ├── src/
│ │ ├── httpServer.ts
│ │ └── ...
│ ├
│ └── .env
├── wsServer/
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ ├── prismaClient.ts
│ ├── src/
│ │ ├── wsServer.ts
│ │ └── ...
│ ├
│ └── .env
└── prisma/
├── schema.prisma
└── migrations/
I will be glad for any assistance offered. thanks
4 replies