This repository contains a simple Order Management System implemented using NestJS for the backend, Prisma ORM for database interactions, PostgreSQL for the database, and Docker for containerization.
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
-
Clone the repository
git clone https://github.com/your-username/order-management-system.git cd order-management-system
-
Configure Environment Variables
Ensure that the
DATABASE_URL
in the docker-compose.yml file matches your setup. The provided configuration uses default PostgreSQL credentials. -
Run the application with Docker Compose
docker-compose up --build
This command will build the Docker images for the NestJS application and PostgreSQL database, start the containers, and link them together.
-
Accessing the application The NestJS application will be running at http://localhost:3000. You can see the documentation of the endpoints at http://localhost:3000/api. You can access the application endpoints using any API client (e.g., Postman, Thunder Client, curl).
-
Stopping the application To stop the application and remove the containers, press Ctrl + C in the terminal where docker-compose is running. Then, run:
docker-compose down
Before you begin, ensure you have the following installed:
- Node.js (version 18): Install Node.js
- PostgreSQL (version 13 or above): Install PostgreSQL
- npm (comes with Node.js): Install npm
-
Clone the repository
git clone https://github.com/your-username/order-management-system.git cd order-management-system
-
Install Dependencies Install the project dependencies using npm:
npm install
-
Set Up PostgreSQL Database
-
Start PostgreSQL: Ensure PostgreSQL is running on your machine.
-
Create a Database:
Connect to your PostgreSQL server and create a new database:
psql -U postgres
Inside the PostgreSQL prompt, run:
CREATE DATABASE order_management_system_db;
-
Create a .env File:
In the project root, create a .env file and add the following environment variables:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/order_management_system_db?schema=public
-
-
Generate Prisma Client:
Generate the Prisma client based on the schema
npx prisma generate
-
Run Database Migrations:
Apply the database migrations to set up the database schema
npx prisma migrate dev
-
Start the Application
Start the NestJS application:
npm run start:dev
The NestJS application will be running at http://localhost:3000. You can see the documentation of the endpoints at http://localhost:3000/api. You can access the application endpoints using any API client (e.g., Postman, Thunder Client, curl).
Contributions are welcome! Please fork the repository and create a pull request with your improvements.