An opinionated NestJS development docker kit utilising
- Database : Postgres
- Backend : NestJS
- Caching : Redis
- DB Client : PGAdmin
- Do install Docker Desktop or any Docker client here
- Open terminal point to where docker-compose.yml is located
- Request client installed eg: Postman / Insomnia
This template is used to containerized an sample NestJS app. The directory structure should follow as below
/folder
/app
/src
...
... (nestjs files)
...
.env.example
.dockerignore
Dockerfile.DEV
docker-compose.yml
Lets make your life easier and make time for your family. Let run the app with fullset together in single command.
To do this, fill in custom .env
file using .env.example
as the template at the same directory.
Fill in the following for full feature:
SMTP_USER= #registered mailtrap user
SMTP_PASSWORD= #registered mailtrap password
Put here:
/folder
/app
.env.example
.env <--- added custom .env using .env.example as template
...
Run the following commands to build and run the images:
docker-compose up --detach
- spawn a
POSTGRES
database bind to localhost:5432 as default defined in .envDOCKER_POSTGRES_PORT
value
username and password will be based on defined .env in this case
postgres : postgres
new database will be created inside with name definedapp_dev
you can use other client such as TablePlus to connect at this port.
localhost:5432
- spawn a
REDIS
caching bind tolocalhost:6379
as default defined in .envDOCKER_REDIS_PORT
value
password will be as defined in
REDIS_PASSWORD
you will needredis-cli
to tunnel this port
localhost:6379
- spawn a
NESTJS
application bind tolocalhost:3000
as default defined in .envDOCKER_APP_PORT
value
will also use other .env variables inside
localhost:3000/api
- spawn a
PGADMIN
client bind tolocalhost:8080
as default defined in .envDOCKER_PGADMIN_PORT
value
client can be access at
localhost:8080
username and password will be based on defined .env in this case[email protected] : admin
localhost:8080
Using PgAdmin :
- schema migration will be done auto when not set
MODE
toPROD
- open swagger docs and begin using sample API:
localhost:3000/customString123forSecuringSw@ggerD0cs