A backend application built with NestJS and Prisma, using Postgresssql as the database. It allows regular users to create orders, each associated with a unique chat room for communication with administrators.
- Node.js (v20 or later)
- npm
- Postgresql instance (local or cloud)
-
Clone the Repository
git clone https://github.com/yourusername/order-management-system.git cd order-management-system
2.Install Dependencies
Using npm:
npm install
- Environment Variables Create a .env file at the root of the project and add your Postgresql connection string:
env
postgresql://:@localhost:5432/
Replace , , and other placeholders with your Postgresql credentials.
Prisma Setup Ensure schema.prisma is Located Correctly
The Prisma schema should be at ./prisma/schema.prisma. If it's not, move it:
mkdir -p prisma mv ./src/prisma/schema.prisma ./prisma/schema.prisma Generate Prisma Client
npx prisma generate Running the Application Start the NestJS application in development mode:
npm run start:dev
The server will run at http://localhost:4000.
API Documentation Access Swagger UI at http://localhost:4000/api to explore and test the API endpoints.
Project Structure
order-management-system/
├── src/
├── modules
│ ├── chats/
│ │ ├── dtos/
│ │ ├── entities/
│ │ ├── repository/
│ │ ├── chats.controller.ts
│ │ └── chats.module.ts
│ ├── orders/
│ │ ├── dtos/
│ │ ├── entities/
│ │ ├── repository/
│ │ ├── orders.controller.ts
│ │ ├── orders.service.ts
│ │ └── orders.module.ts
│ ├── users/
│ │ ├── dtos/
│ │ ├── entities/
│ │ ├── repository/
│ │ ├── users.controller.ts
│ │ ├── users.service.ts
│ │ └── users.module.ts
│ │ ├── interfaces/
│ │ └── utils/
│ ├── prisma/
│ │ ├── schema.prisma
│ ├── shared/
| | ├── enums/
│ │ ├── interfaces/
│ │ └── utils/
│ ├── app.module.ts
│ └── main.ts
├── .env
├── package.json
├── README.md
└── tsconfig.json
Ensure schema.prisma is located at ./prisma/schema.prisma. If it's elsewhere, specify the path using the --schema flag:
npx prisma generate --schema=./path/to/schema.prisma
Verify that all referenced records exist before creating or updating related documents.
License This project is licensed under the MIT License.