Skip to content

andreaharris-go/nestjs-starter

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version

Description

Nest framework TypeScript starter repository.

Requirement

nodejs >= 18
npm >= 9
docker-compose >= 2.20

Environment Set Up

$ docker-compose up -d

$ cd gateway
$ npm install

$ cd service-example
$ npm install

then shell to Vault server and set environment variable, and init admin policies

$ export VAULT_ADDR='http://0.0.0.0:8200'
$ export VAULT_TOKEN="123456789"

$ vault auth enable approle
$ vault write auth/approle/role/admin secret_id_ttl="720h"  token_ttl="12h"  token_max_tll="12h"  policies="admin"
$ vault read auth/approle/role/admin/role-id
$ vault write -f auth/approle/role/admin/secret-id

checking Vault service on browser

URL: localhost:8200
Token: 123456789

Screenshot

Edit default policies with this:

path "secret/*" {
    capabilities = ["read"]
}

Screenshot

First Vault secret for MongoDB

In secret engine and new key and value

{
  "HOST": "0.0.0.0",
  "MONGODB_HOST": "mongodb://userexample2:example@localhost/example",
  "PORT": "3002"
}

Screenshot

Init MongoDB database

$ mongosh -u root -p example

# then create db and user
$ use example
$ db.createUser({user:"userexample2",pwd:"example",roles:[{role:"readWrite",db:"example"}]})

Running the app

Open two tab for running "gateway" and "service-example"

$ npm run build
$ npm run start:dev

Screenshot

Swagger UI

http://localhost:3001/docs

Screenshot

Support

No longer support by Duckdev84 LOL....

About

NestJS starter kit

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published