- Install Docker:
- Visit the Docker Hub website: https://hub.docker.com/
- Download and install Docker for your operating system (Windows, macOS, or Linux).
https://hub.docker.com/_/postgres?tab=tags
-
Clone the Project Repository:
$ cd <your_project_directory> $ git clone <URL_that_you_clone>
-
Set up a PostgresSQL database with Docker:
-
Open a terminal and run the following commands:
# Pull the official Postgres Docker image $ docker pull postgres
-
3-1. Click the run button, and you will check optional settings
| text | type |
|---|---|
| container name | postgres |
| Hostport | 5432 |
| Volumes Host Path | {path you want to} |
| Environment variables(Variables:Values) | POSTGRES_PASSWORD:0927 |
| Environment variables(Variables:Values) | POSTGRES_DB:xsearch |
this also two options to set up database
4-1. TablePlus(Recommended) TablePlus : https://tableplus.com/
-
Create a new connection by clicking "Create a new connection" on the welcome screen of TablePlus.
-
Click "PostgreSQL" to select a PostgreSQL connection.
-
Set the connection details:
- Name: An alias for the database connection (for example, "postgres").
- Host: Hostname or IP address of the Postgres running in Docker (localhost)
- Port: The port of the PostgreSQL running on (default: 5432)
- User: The username (default: postgres)
- Password: 0927
- Database: Name of the database to use
After completing the settings, click the "Test" button to verify the connection, then click "Connect" to finalize the connection.
this is a exam images-
Install Postman:(don't need to do this)
- Download and install Postman from: https://www.postman.com/downloads/
-
Test API using Postman:(don't need to do this)
- Launch Postman and create a new request by clicking the "+" button at the top.
- Choose the desired HTTP method and enter the API endpoint URL.
- Configure any required authentication tokens, headers, etc., under the "Headers" tab.
- If necessary, write the request body under the "Body" tab (e.g., for POST or PUT requests).
- Click the blue "Send" button to send the request.
- Check the response displayed in the panel below the request. If successful, you should receive a token.
-
Download Nest.js modules:
$ npm install // If you occur problems in VS, Type below Scripts $ npm install --save @nestjs/typeorm typeorm $ npm install @types/hbs --save-dev $ npm install --save-dev @nestjs/testing $ npm install --save-dev @types/babel__core
To run the Nest.js backend server: you need to run container actions, and npm run start.
If you don't have an .env file in a subdocument of the backend folder, create one and add an example like the following
DB_HOST=localhost
# localhost is for nest js npm run start:dev
# postgres is for docker container
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=0927
DB_DATABASE=xsearch
ACCESS_TOKEN_EXPIRATION=60s
JWT_SECRET_KEY=secretKey
Your backend database server should now be up and running, and you can start developing and testing your application
visit "localhost:3000/api"
you can test database server and login, out, register etc...
# Development mode
$ npm run start
# Watch mode (for automatic restart on file changes)
$ npm run start:devand, you need to change
- And in the project root folder, type the above command
$ docker-compose up -d
# IF you want to delete cash, because you adjust package, type docker-compose build --no-cacheyou can check this image in docker desktop.
- and you can get images and container visit "http://localhost:3000/api"
and also you need to set new database
you can also get swagger and page with out command npm run start:dev!
you can check swagger at localhost:8090, not 3000!
This guide illustrates how to connect a NestJS application with Postgres and Minio services using Docker Compose.
Start the Postgres and Minio services using Docker Compose. You can do this by entering the following command in your terminal:
docker-compose up -dNext, launch the NestJS application.
Note: Minio does not support creating a bucket using Docker Compose. Therefore, before proceeding with this step, ensure that a bucket is already created in Minio.
To verify if NestJS is running and connecting properly, use the Swagger API. Through this, you can check if uploaded images are displayed correctly.
you can also check on minio api
If you encounter any issues with the connection, check and modify the access permissions of your Minio bucket, if necessary. If the issue persists, reach out to your supervisor or the person responsible for assistance.
Through these steps, you can connect your NestJS application with Postgres and Minio services using Docker Compose. We hope this guide is helpful to you!








