Gathering detailed insights and metrics for @nestjs-mod/docker-compose
Gathering detailed insights and metrics for @nestjs-mod/docker-compose
Gathering detailed insights and metrics for @nestjs-mod/docker-compose
Gathering detailed insights and metrics for @nestjs-mod/docker-compose
npm install @nestjs-mod/docker-compose
Typescript
Module System
Min. Node Version
Node Version
NPM Version
two-factor-v1.1.7
Updated on Jul 08, 2025
two-factor-v1.1.6
Updated on Jul 08, 2025
notifications-v1.2.5
Updated on Jul 08, 2025
two-factor-v1.1.5
Updated on Jul 08, 2025
files-v1.2.5
Updated on Jul 08, 2025
supabase-v1.2.3
Updated on Jul 08, 2025
TypeScript (96.75%)
JavaScript (2.51%)
Shell (0.45%)
HTML (0.28%)
Less (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
8 Stars
765 Commits
2 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Jul 08, 2025
Latest Version
1.21.0
Package Id
@nestjs-mod/docker-compose@1.21.0
Unpacked Size
507.95 kB
Size
73.13 kB
File Count
172
NPM Version
10.9.2
Node Version
23.11.1
Published on
Jun 30, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience. (Generator docker-compose.yml for https://docs.docker.com/compose)
[![NPM version][npm-image]][npm-url] [![monthly downloads][downloads-image]][downloads-url] [![Telegram][telegram-image]][telegram-url] [![Discord][discord-image]][discord-url]
1npm i --save @nestjs-mod/docker-compose
Link | Category | Description |
---|---|---|
DockerCompose | infrastructure | Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience. (Generator docker-compose.yml for https://docs.docker.com/compose) |
DockerComposeAuthorizer | infrastructure | Authorizer is an open-source authentication and authorization solution for your applications. Bring your database and have complete control over the user information. You can self-host authorizer instances and connect to supported databases. (Generator for https://authorizer.dev in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposeMaildev | infrastructure | MailDev is a simple way to test your projects generated email during development, with an easy to use web interface that runs on your machine. (Generator for maildev in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposeMinio | infrastructure | MinIO is a high-performance, S3 compatible object storage. (Generator for minio in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposeNats | infrastructure | NATS is an open source, lightweight and high-performance messaging system. It is ideal for distributed systems and supports modern cloud architectures and pub-sub, request-reply and queuing models. (Generator for nats in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposeNginx | infrastructure | Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. (Generator for nginx in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposePostgreSQL | infrastructure | PostgreSQL (Postgres) is an open source object-relational database known for reliability and data integrity. ACID-compliant, it supports foreign keys, joins, views, triggers and stored procedures. (Generator for databases in docker-compose.yml for https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/libs/infrastructure/docker-compose) |
DockerComposeRedis | infrastructure | The open-source, in-memory data store used by millions of developers as a cache, vector database, document database, streaming engine, and message broker. (Generator for redis in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
DockerComposeSso | infrastructure | Single Sign-On on NestJS and Angular with webhooks and social authorization. (Generator for https://github.com/nestjs-mod/nestjs-mod-sso in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose) |
Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience. (Generator docker-compose.yml for https://docs.docker.com/compose)
An example you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-prisma-flyway or https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-prisma.
1import { PACKAGE_JSON_FILE, ProjectUtils, bootstrapNestApplication } from '@nestjs-mod/common'; 2import { DOCKER_COMPOSE_FILE, DockerCompose } from '@nestjs-mod/docker-compose'; 3import { join } from 'path'; 4 5export const flywayPrismaFeatureName = 'flyway-prisma'; 6 7const rootFolder = join(__dirname, '..', '..', '..'); 8const appFolder = join(rootFolder, 'apps', 'example-prisma-flyway'); 9 10bootstrapNestApplication({ 11 modules: { 12 system: [ 13 ProjectUtils.forRoot({ 14 staticConfiguration: { 15 applicationPackageJsonFile: join( 16 appFolder 17 PACKAGE_JSON_FILE 18 ), 19 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 20 envFile: join(rootFolder, '.env'), 21 }, 22 }), 23 ], 24 infrastructure: [ 25 DockerCompose.forRoot({ 26 configuration: { 27 dockerComposeFileVersion: '3', 28 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 29 }, 30 }), 31 ], 32 }, 33});
After connecting the module to the application and npm run build
and starting generation of documentation through npm run docs:infrastructure
, you will have new files and scripts to run.
New scripts mostly package.json
1{ 2 "scripts": { 3 "_____docker-compose infra_____": "_____docker-compose infra_____", 4 "docker-compose:start:example-prisma-flyway": "export COMPOSE_INTERACTIVE_NO_CLI=1 && docker compose -f ./apps/example-prisma-flyway/docker-compose.yml --compatibility up -d", 5 "docker-compose:stop:example-prisma-flyway": "export COMPOSE_INTERACTIVE_NO_CLI=1 && docker compose -f ./apps/example-prisma-flyway/docker-compose.yml down" 6 }, 7 "scriptsComments": { 8 "docker-compose:start:example-prisma-flyway": [ 9 "Running the docker-compose infrastructure for example-prisma-flyway" 10 ], 11 "docker-compose:stop:example-prisma-flyway": [ 12 "Stopping the docker-compose infrastructure for example-prisma-flyway" 13 ] 14 } 15}
Empty docker-compose file for application docker-compose.yml
with real credenionals and add it to .gitignore
file
1# Do not modify this file, it is generated using the DockerCompose module included with NestJS-mod. 2version: '3'
Empty docker-compose file for application docker-compose-example.yml
with fake credenionals
1# Do not modify this file, it is generated using the DockerCompose module included with NestJS-mod. 2version: '3'
ManualDockerComposeFeatures
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
dockerComposeFile | Main file for docker-compose, the Compose specification establishes a standard for the definition of multi-container platform-agnostic applications | isNotEmpty (dockerComposeFile should not be empty) | - | - |
prodDockerComposeFile | Main file for prod docker-compose, the Compose specification establishes a standard for the definition of multi-container platform-agnostic applications | optional | - | - |
exampleDockerComposeFile | Example file for docker-compose, the Compose specification establishes a standard for the definition of multi-container platform-agnostic applications | optional | - | - |
prodDockerComposeEnvFile | Dotenv file for prod docker-compose file | optional | - | - |
prodDockerComposeExampleEnvFile | Dotenv example file for prod docker-compose-example file | optional | - | - |
dockerComposeFileVersion | Docker-compose file version. @see https://docs.docker.com/compose/compose-file/compose-versioning | isNotEmpty (dockerComposeFileVersion should not be empty) | 3 | - |
beforeSaveExampleDockerComposeFile | Before save file for example docker-compose | optional | - | - |
beforeSaveDockerComposeFile | Before save main file for docker-compose | optional | - | - |
beforeSaveProdDockerComposeFile | Before save main file for prod docker-compose | optional | - | - |
beforeSaveDockerComposeEnvFile | Method before save dotenv file for docker-compose file | optional | - | - |
beforeSaveProdDockerComposeEnvFile | Method before save dotenv file for prod docker-compose file | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | - |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | - |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | - |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | {"authorizer":{"image":"lakhansamani/authorizer:1.3.8","container_name":"authorizer","ports":["8080:8080"],"networks":["default-network"],"environment":{"DATABASE_NAME":"authorizer","PORT":8080,"COOKIE_NAME":"authorizer","DISABLE_PLAYGROUND":true,"ACCESS_TOKEN_EXPIRY_TIME":"30m","IMAGE":"lakhansamani/authorizer:1.3.8","EXTERNAL_CLIENT_PORT":8080,"ENV":"production","RESET_PASSWORD_URL":"/reset-password","ROLES":"user,admin","DEFAULT_ROLES":"user","JWT_ROLE_CLAIM":"role","ORGANIZATION_NAME":"Authorizer","ORGANIZATION_LOGO":"Authorizer Logo","COUCHBASE_BUCKET":"authorizer","COUCHBASE_BUCKET_RAM_QUOTA":1000,"COUCHBASE_SCOPE":"_default"},"keysOfEnvironmentsWithStaticValue":["featureName","image","networks","dependsOnServiceNames","env"],"tty":true,"restart":"always","depends_on":{}}} |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | - |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | ```{"maildev":{"image":"maildev/maildev:2.2.1","container_name":"maildev","ports":["1025:1025","1080:1080"],"networks":["default-network"],"environment":{"MAILDEV_SMTP_PORT":1025,"MAILDEV_WEB_PORT":1080},"keysOfEnvironmentsWithStaticValue":["featureName","image","networks","smtpPort","webPort"],"healthcheck":{"test":"wget -O - http://localhost:${MAILDEV_WEB_PORT}${MAILDEV_BASE_PATHNAME}/healthz |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | - |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | {"postgre-sql":{"image":"bitnami/postgresql:15.5.0","container_name":"postgre-sql","volumes":["postgre-sql-volume:/bitnami/postgresql"],"ports":["5432:5432"],"networks":["default-network"],"healthcheck":{"test":["CMD-SHELL","pg_isready -U postgres"],"interval":"5s","timeout":"5s","retries":5},"tty":true,"restart":"always"}} |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | {"postgre-sql-volume":{"name":"postgre-sql-volume"}} |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | {"minio":{"image":"bitnami/minio:2024.2.9","container_name":"minio","volumes":["minio-volume:/bitnami/minio/data"],"ports":["9000:9000","9001:9001"],"networks":["default-network"],"environment":{},"keysOfEnvironmentsWithStaticValue":["featureName","image","networks","nginxBucketsLocations","nginxConfigContent","nginxConfigFolder","nginxLogsFolder"],"healthcheck":{"test":["CMD-SHELL","mc","ready","local"],"interval":"5s","timeout":"5s","retries":5},"tty":true,"restart":"always"}} |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | {"minio-volume":{"name":"minio-volume"}} |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | {"nginx":{"image":"nginx:alpine","container_name":"nginx","volumes":[],"ports":[],"networks":["default-network"],"tty":true,"restart":"always","depends_on":{}}} |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | - |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
version | The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative. @see https://github.com/compose-spec/compose-spec/blob/master/04-version-and-name.md | optional | - | - |
services | A service is an abstract definition of a computing resource within an application which can be scaled or replaced independently from other components. @see https://github.com/compose-spec/compose-spec/blob/master/05-services.md | optional | - | {"nats":{"image":"bitnami/nats:2.10.5","container_name":"nats","volumes":["nats-volume:/bitnami/nats/data"],"ports":["8222:8222","4222:4222"],"networks":["default-network"],"environment":{"NATS_EXTRA_ARGS":"-js"},"keysOfEnvironmentsWithStaticValue":["featureName","image","extraArgs","networks"],"tty":true,"restart":"always"}} |
networks | Networks are the layer that allow services to communicate with each other. @see https://github.com/compose-spec/compose-spec/blob/master/06-networks.md | optional | - | {"default-network":{"driver":"bridge"}} |
volumes | Volumes are persistent data stores implemented by the container engine. @see https://github.com/compose-spec/compose-spec/blob/master/07-volumes.md | optional | - | {"nats-volume":{"name":"nats-volume"}} |
secrets | Secrets are a flavor of Configs focusing on sensitive data, with specific constraint for this usage. @see https://github.com/compose-spec/compose-spec/blob/master/09-secrets.md | optional | - | - |
configs | Configs allow services to adapt their behaviour without the need to rebuild a Docker image. @see https://github.com/compose-spec/compose-spec/blob/master/08-configs.md | optional | - | - |
Authorizer is an open-source authentication and authorization solution for your applications. Bring your database and have complete control over the user information. You can self-host authorizer instances and connect to supported databases. (Generator for https://authorizer.dev in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose)
An example of using Maildev, you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-authorizer/INFRASTRUCTURE.MD.
1process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; 2 3import { AuthorizerModule } from '@nestjs-mod/authorizer'; 4import { 5 DefaultNestApplicationInitializer, 6 DefaultNestApplicationListener, 7 InfrastructureMarkdownReportGenerator, 8 PACKAGE_JSON_FILE, 9 ProjectUtils, 10 bootstrapNestApplication, 11 isInfrastructureMode, 12} from '@nestjs-mod/common'; 13import { DOCKER_COMPOSE_FILE, DockerCompose, DockerComposeAuthorizer, DockerComposePostgreSQL } from '@nestjs-mod/docker-compose'; 14import { join } from 'path'; 15import { adminSecret } from './app/app.constants'; 16import { AppModule } from './app/app.module'; 17 18const rootFolder = join(__dirname, '..', '..', '..'); 19const appFolder = join(rootFolder, 'apps', 'example-authorizer'); 20 21bootstrapNestApplication({ 22 globalConfigurationOptions: { debug: true }, 23 globalEnvironmentsOptions: { debug: true }, 24 modules: { 25 system: [ 26 ProjectUtils.forRoot({ 27 staticConfiguration: { 28 applicationPackageJsonFile: join(__dirname, '..', '..', '..', 'apps/example-authorizer', PACKAGE_JSON_FILE), 29 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 30 envFile: join(rootFolder, 'apps', 'example-authorizer', '.env'), 31 }, 32 }), 33 DefaultNestApplicationInitializer.forRoot(), 34 DefaultNestApplicationListener.forRoot({ 35 staticConfiguration: { 36 // When running in infrastructure mode, the backend server does not start. 37 mode: isInfrastructureMode() ? 'silent' : 'listen', 38 }, 39 }), 40 ], 41 feature: [ 42 AuthorizerModule.forRootAsync({ 43 environments: { 44 authorizerURL: 'http://localhost:8080', 45 redirectURL: 'http://localhost:3000' 46 } 47 }), 48 AppModule.forRoot() 49 ], 50 infrastructure: [ 51 InfrastructureMarkdownReportGenerator.forRoot({ 52 staticConfiguration: { 53 markdownFile: join(appFolder, 'INFRASTRUCTURE.MD'), 54 skipEmptySettings: true, 55 style: 'pretty', 56 }, 57 }), 58 DockerCompose.forRoot({ 59 configuration: { 60 dockerComposeFileVersion: '3', 61 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 62 }, 63 }), 64 DockerComposePostgreSQL.forRoot({ 65 staticEnvironments: { 66 rootDatabaseUrl: 'postgres://postgres:postgres_password@localhost:5432/postgres?schema=public' 67 } 68 }), 69 DockerComposeAuthorizer.forRoot({ 70 staticEnvironments: { 71 databaseType: 'postgres', 72 databaseUrl: 'postgres://postgres:postgres_password@example-authorizer-postgre-sql:5432/postgres', 73 databaseName: 'authorizer', 74 adminSecret 75 } 76 }), 77 ], 78 }, 79}); 80
After connecting the module to the application and npm run manual:prepare
and starting generation of documentation through npm run docs:infrastructure:example-authorizer
, you will have new files and scripts to run.
New scripts mostly package.json
Add database options to docker-compose file for application docker-compose.yml
with real credenionals and add it to .gitignore
file
1# Do not modify this file, it is generated using the DockerCompose module included with NestJS-mod. 2version: "3" 3services: 4 example-authorizer-postgre-sql: 5 image: "bitnami/postgresql:15.5.0" 6 container_name: "example-authorizer-postgre-sql" 7 volumes: 8 - "example-authorizer-postgre-sql-volume:/bitnami/postgresql" 9 ports: 10 - "5432:5432" 11 networks: 12 - "example-authorizer-network" 13 healthcheck: 14 test: 15 - "CMD-SHELL" 16 - "pg_isready -U postgres" 17 interval: "5s" 18 timeout: "5s" 19 retries: 5 20 tty: true 21 restart: "always" 22 environment: 23 POSTGRESQL_USERNAME: "${EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_USERNAME}" 24 POSTGRESQL_PASSWORD: "${EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_PASSWORD}" 25 POSTGRESQL_DATABASE: "${EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_DATABASE}" 26 example-authorizer-authorizer: 27 image: "lakhansamani/authorizer:1.3.8" 28 container_name: "example-authorizer-authorizer" 29 ports: 30 - "8080:8080" 31 networks: 32 - "example-authorizer-network" 33 environment: 34 DATABASE_TYPE: "${EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_TYPE}" 35 DATABASE_URL: "${EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_URL}" 36 DATABASE_NAME: "${EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_NAME}" 37 ADMIN_SECRET: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ADMIN_SECRET}" 38 PORT: "${EXAMPLE_AUTHORIZER_AUTHORIZER_PORT}" 39 COOKIE_NAME: "${EXAMPLE_AUTHORIZER_AUTHORIZER_COOKIE_NAME}" 40 DISABLE_PLAYGROUND: "${EXAMPLE_AUTHORIZER_AUTHORIZER_DISABLE_PLAYGROUND}" 41 ACCESS_TOKEN_EXPIRY_TIME: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ACCESS_TOKEN_EXPIRY_TIME}" 42 IMAGE: "${EXAMPLE_AUTHORIZER_AUTHORIZER_IMAGE}" 43 EXTERNAL_CLIENT_PORT: "${EXAMPLE_AUTHORIZER_AUTHORIZER_EXTERNAL_CLIENT_PORT}" 44 ENV: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ENV}" 45 RESET_PASSWORD_URL: "${EXAMPLE_AUTHORIZER_AUTHORIZER_RESET_PASSWORD_URL}" 46 ROLES: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ROLES}" 47 DEFAULT_ROLES: "${EXAMPLE_AUTHORIZER_AUTHORIZER_DEFAULT_ROLES}" 48 JWT_ROLE_CLAIM: "${EXAMPLE_AUTHORIZER_AUTHORIZER_JWT_ROLE_CLAIM}" 49 ORGANIZATION_NAME: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ORGANIZATION_NAME}" 50 ORGANIZATION_LOGO: "${EXAMPLE_AUTHORIZER_AUTHORIZER_ORGANIZATION_LOGO}" 51 COUCHBASE_BUCKET: "${EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_BUCKET}" 52 COUCHBASE_BUCKET_RAM_QUOTA: "${EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_BUCKET_RAM_QUOTA}" 53 COUCHBASE_SCOPE: "${EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_SCOPE}" 54 tty: true 55 restart: "always" 56 depends_on: {} 57networks: 58 example-authorizer-network: 59 driver: "bridge" 60volumes: 61 example-authorizer-postgre-sql-volume: 62 name: "example-authorizer-postgre-sql-volume"
New environment variable
1# example-authorizer-postgre-sql (generated) 2EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_USERNAME=postgres 3EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_PASSWORD=postgres_password 4EXAMPLE_AUTHORIZER_POSTGRE_SQL_POSTGRESQL_DATABASE=postgres 5# example-authorizer-authorizer (generated) 6EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_TYPE=postgres 7EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_URL=postgres://postgres:postgres_password@example-authorizer-postgre-sql:5432/postgres 8EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_NAME=authorizer 9EXAMPLE_AUTHORIZER_AUTHORIZER_ADMIN_SECRET=adminSecret 10EXAMPLE_AUTHORIZER_AUTHORIZER_PORT=8080 11EXAMPLE_AUTHORIZER_AUTHORIZER_COOKIE_NAME=authorizer 12EXAMPLE_AUTHORIZER_AUTHORIZER_DISABLE_PLAYGROUND=true 13EXAMPLE_AUTHORIZER_AUTHORIZER_ACCESS_TOKEN_EXPIRY_TIME=30m 14EXAMPLE_AUTHORIZER_AUTHORIZER_IMAGE= 15EXAMPLE_AUTHORIZER_AUTHORIZER_EXTERNAL_CLIENT_PORT=8080 16EXAMPLE_AUTHORIZER_AUTHORIZER_ENV= 17EXAMPLE_AUTHORIZER_AUTHORIZER_RESET_PASSWORD_URL=/reset-password 18EXAMPLE_AUTHORIZER_AUTHORIZER_ROLES=user,admin 19EXAMPLE_AUTHORIZER_AUTHORIZER_DEFAULT_ROLES=user 20EXAMPLE_AUTHORIZER_AUTHORIZER_JWT_ROLE_CLAIM=role 21EXAMPLE_AUTHORIZER_AUTHORIZER_ORGANIZATION_NAME=Authorizer 22EXAMPLE_AUTHORIZER_AUTHORIZER_ORGANIZATION_LOGO='Authorizer Logo' 23EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_BUCKET=authorizer 24EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_BUCKET_RAM_QUOTA=1000 25EXAMPLE_AUTHORIZER_AUTHORIZER_COUCHBASE_SCOPE=_default 26# EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_URL (generated) 27LOCALHOST_EXAMPLE_AUTHORIZER_AUTHORIZER_DATABASE_URL=postgres://postgres:postgres_password@localhost:5432/postgres
When launched in the infrastructure documentation generation mode, the module creates an .env
file with a list of all required variables, as well as an example example.env
, where you can enter example variable values.
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
adminSecret | Super admin secret used to access the master data | obj['adminSecret'] , process.env['ADMIN_SECRET'] | isNotEmpty (adminSecret should not be empty) | - | - |
databaseType | Which database you are using. Supported database types are postgres, mysql, planetscale, sqlite, sqlserver, mongodb, arangodb, yugabyte, mariadb, cassandradb, scylladb, couchbase, dynamodb | obj['databaseType'] , process.env['DATABASE_TYPE'] | isNotEmpty (databaseType should not be empty) | - | - |
databaseUrl | Database connection string. In case of cluster url eg. for cassandra db, you can use comma separated IPs | obj['databaseUrl'] , process.env['DATABASE_URL'] | isNotEmpty (databaseUrl should not be empty) | - | - |
databaseName | Name of database to connect to. This is useful in case of arangodb and mongodb. If not set, default value will be used | obj['databaseName'] , process.env['DATABASE_NAME'] | optional | authorizer | authorizer |
redisUrl | Redis URL where sessions can be persisted false sessions will be stored in memory | obj['redisUrl'] , process.env['REDIS_URL'] | optional | - | - |
databasePort | Port on which database connection should be made. This is used when DATABASE_URL is not mentioned. At the moment supported by cassandradb | obj['databasePort'] , process.env['DATABASE_PORT'] | optional | - | - |
databaseHost | Host/IP on which database connection should be made. This is used when DATABASE_URL is not mentioned. At the moment supported by cassandradb type | obj['databaseHost'] , process.env['DATABASE_HOST'] | optional | - | - |
databaseUsername | Username for the database access with permission to create tables and records. At the moment supported by cassandradb, scylladb type | obj['databaseUsername'] , process.env['DATABASE_USERNAME'] | optional | - | - |
databasePassword | Password for the database access with permission to create tables and records. At the moment supported by cassandradb, scylladb type | obj['databasePassword'] , process.env['DATABASE_PASSWORD'] | optional | - | - |
databaseCert | Base64 encoded certificate string used to make SSL connection. At the moment supported by cassandradb,scylladb type | obj['databaseCert'] , process.env['DATABASE_CERT'] | optional | - | - |
databaseCertKey | Base64 encoded key string used to make SSL connection. At the moment supported by cassandradb,scylladb type | obj['databaseCertKey'] , process.env['DATABASE_CERT_KEY'] | optional | - | - |
databaseCaCert | Base64 encoded CA certificate string used to make SSL connection. At the moment supported by cassandradb, scylladb type | obj['databaseCaCert'] , process.env['DATABASE_CA_CERT'] | optional | - | - |
port | Port on which server should be running | obj['port'] , process.env['PORT'] | optional | 8080 | 8080 |
authorizerUrl | Domain name of the server, eg https://authorizer.herokuapp.com | obj['authorizerUrl'] , process.env['AUTHORIZER_URL'] | optional | - | - |
cookieName | Name of cookie to be set by server | obj['cookieName'] , process.env['COOKIE_NAME'] | optional | authorizer | authorizer |
smtpHost | SMTP host is used to send email verification emails and forgot password emails false If not set email sending can fail | obj['smtpHost'] , process.env['SMTP_HOST'] | optional | - | - |
smtpPort | SMTP Port is used along with SMTP host | obj['smtpPort'] , process.env['SMTP_PORT'] | optional | - | - |
smtpUsername | Username for your smtp provider | obj['smtpUsername'] , process.env['SMTP_USERNAME'] | optional | - | - |
smtpPassword | Password for your smt provider | obj['smtpPassword'] , process.env['SMTP_PASSWORD'] | optional | - | - |
senderEmail | Email to be used in From section while sending emails | obj['senderEmail'] , process.env['SENDER_EMAIL'] | optional | - | - |
senderName | Email sender name that is displayed in the inbox instead of just showing the email address | obj['senderName'] , process.env['SENDER_NAME'] | optional | - | - |
disablePlayground | To disable playground | obj['disablePlayground'] , process.env['DISABLE_PLAYGROUND'] | optional | true | true |
accessTokenExpiryTime | Time interval for how long access token will be expired in 1h15m15s format | obj['accessTokenExpiryTime'] , process.env['ACCESS_TOKEN_EXPIRY_TIME'] | optional | 30m | 30m |
awsAccessKeyId | AWS access key used for connecting to dynamodb. Make sure access credentials has rights for dynamodb. Used with DATABASE_TYPE=dynamodb | obj['awsAccessKeyId'] , process.env['AWS_ACCESS_KEY_ID'] | optional | - | - |
awsSecretAccessKey | AWS secret access key used for connecting to dynamodb. Make sure access credentials has rights for dynamodb. Used with DATABASE_TYPE=dynamodb | obj['awsSecretAccessKey'] , process.env['AWS_SECRET_ACCESS_KEY'] | optional | - | - |
googleClientId | OAuth Google login client id | obj['googleClientId'] , process.env['GOOGLE_CLIENT_ID'] | optional | - | - |
googleClientSecret | OAuth Google login client secret | obj['googleClientSecret'] , process.env['GOOGLE_CLIENT_SECRET'] | optional | - | - |
githubClientId | OAuth Github login client id | obj['githubClientId'] , process.env['GITHUB_CLIENT_ID'] | optional | - | - |
githubClientSecret | OAuth Github login client secret | obj['githubClientSecret'] , process.env['GITHUB_CLIENT_SECRET'] | optional | - | - |
facebookClientId | OAuth Facebook login client id | obj['facebookClientId'] , process.env['FACEBOOK_CLIENT_ID'] | optional | - | - |
facebookClientSecret | OAuth Facebook login client secret | obj['facebookClientSecret'] , process.env['FACEBOOK_CLIENT_SECRET'] | optional | - | - |
linkedinClientId | OAuth LinkedIn login client id | obj['linkedinClientId'] , process.env['LINKEDIN_CLIENT_ID'] | optional | - | - |
linkedinClientSecret | OAuth LinkedIn login client secret | obj['linkedinClientSecret'] , process.env['LINKEDIN_CLIENT_SECRET'] | optional | - | - |
appleClientId | OAuth Apple login client id | obj['appleClientId'] , process.env['APPLE_CLIENT_ID'] | optional | - | - |
appleClientSecret | OAuth Apple login client secret | obj['appleClientSecret'] , process.env['APPLE_CLIENT_SECRET'] | optional | - | - |
twitterClientId | OAuth Twitter login client id | obj['twitterClientId'] , process.env['TWITTER_CLIENT_ID'] | optional | - | - |
twitterClientSecret | OAuth Twitter login client secret | obj['twitterClientSecret'] , process.env['TWITTER_CLIENT_SECRET'] | optional | - | - |
microsoftClientId | OAuth Microsoft login client id | obj['microsoftClientId'] , process.env['MICROSOFT_CLIENT_ID'] | optional | - | - |
microsoftClientSecret | OAuth Microsoft login client secret | obj['microsoftClientSecret'] , process.env['MICROSOFT_CLIENT_SECRET'] | optional | - | - |
microsoftActiveDirectoryTenantId | Microsoft Active Directory Tenant ID obtained from azure portal | obj['microsoftActiveDirectoryTenantId'] , process.env['MICROSOFT_ACTIVE_DIRECTORY_TENANT_ID'] | optional | - | - |
smtpLocalName | - | obj['smtpLocalName'] , process.env['SMTP_LOCAL_NAME'] | optional | - | - |
jwtSecret | - | obj['jwtSecret'] , process.env['JWT_SECRET'] | optional | - | - |
jwtPrivateKey | - | obj['jwtPrivateKey'] , process.env['JWT_PRIVATE_KEY'] | optional | - | - |
jwtPublicKey | - | obj['jwtPublicKey'] , process.env['JWT_PUBLIC_KEY'] | optional | - | - |
appUrl | - | obj['appUrl'] , process.env['APP_URL'] | optional | - | - |
discordClientId | - | obj['discordClientId'] , process.env['DISCORD_CLIENT_ID'] | optional | - | - |
discordClientSecret | - | obj['discordClientSecret'] , process.env['DISCORD_CLIENT_SECRET'] | optional | - | - |
twitchClientId | - | obj['twitchClientId'] , process.env['TWITCH_CLIENT_ID'] | optional | - | - |
twitchClientSecret | - | obj['twitchClientSecret'] , process.env['TWITCH_CLIENT_SECRET'] | optional | - | - |
clientId | - | obj['clientId'] , process.env['CLIENT_ID'] | optional | - | - |
clientSecret | - | obj['clientSecret'] , process.env['CLIENT_SECRET'] | optional | - | - |
encryptionKey | - | obj['encryptionKey'] , process.env['ENCRYPTION_KEY'] | optional | - | - |
isProd | - | obj['isProd'] , process.env['IS_PROD'] | optional | - | - |
allowedOrigins | - | obj['allowedOrigins'] , process.env['ALLOWED_ORIGINS'] | optional | - | - |
twilioApiKey | - | obj['twilioApiKey'] , process.env['TWILIO_API_KEY'] | optional | - | - |
twilioApiSecret | - | obj['twilioApiSecret'] , process.env['TWILIO_API_SECRET'] | optional | - | - |
twilioAccountSid | - | obj['twilioAccountSid'] , process.env['TWILIO_ACCOUNT_SID'] | optional | - | - |
twilioSender | - | obj['twilioSender'] , process.env['TWILIO_SENDER'] | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name | optional | lakhansamani/authorizer:1.3.8 | - |
featureName | Feature name for generate prefix to environments keys | optional | - | - |
networks | Network, if not set networkNames have project name and driver=bridge | optional | - | - |
externalClientPort | External port for sharing container | optional | 8080 | - |
dependsOnServiceNames | Depends on services | optional | - | - |
env | Which env you are running your server in. Supported envs production, development | optional | production | - |
resetPasswordUrl | Reset password link, that can be used to send the correct forgot password link | optional | /reset-password | - |
disableBasicAuthentication | Used to explicitly disable email and password based authentication | optional | - | - |
disableEmailVerification | Used to disable the email verification while signing up | optional | - | - |
disableMagicLinkLogin | Used to disable the password less login up | optional | - | - |
disableLoginPage | Used to disable the default login page that comes with authorizer instance. This is helpful when user is building their custom login page | optional | - | - |
disableSignUp | Used to disable the sign up feature. It is useful when you want to have beta release of your product and invite only limited users | optional | - | - |
roles | Comma separated list of roles that your platform supports | optional | user,admin | - |
defaultRoles | Comma separated list of roles that acts as Default roles which you would like to assign to users while they signup /login | optional | user | - |
protectedRoles | Comma separated list of roles for which signup should be disabled. Example admin roles. This roles can only assigned manually via super admin like adminUpdateProfile | optional | - | - |
jwtRoleClaim | Claim key that will be part of JWT token | optional | role | - |
organizationName | Name of organization that you want on default login page | optional | Authorizer | - |
organizationLogo | Logo of organization that you want on default login page | optional | Authorizer Logo | - |
customAccessTokenScript | Javascript function to add extra keys to your JWT id token. This feature is developed using otto and only supports writing function in ES5. Check the sample here | optional | - | - |
awsRegion | AWS, region id, where dynamod db tables are to be created. Used with DATABASE_TYPE=dynamodb | optional | - | - |
couchbaseBucket | Bucket used for couchbase database. Used with DATABASE_TYPE=couchbase | optional | authorizer | - |
couchbaseBucketRamQuota | RAM Quota for the bucket used for couchbase database. It has to be numeric value only. Used with DATABASE_TYPE=couchbase | optional | 1000 | - |
couchbaseScope | Scope in which bucket is created. Used with DATABASE_TYPE=couchbase | optional | _default | - |
test | - | optional | - | - |
envPath | - | optional | - | - |
isEmailServiceEnabled | - | optional | - | - |
isSmsServiceEnabled | - | optional | - | - |
appCookieSecure | - | optional | - | - |
adminCookieSecure | - | optional | - | - |
jwtType | - | optional | - | - |
jwk | - | optional | - | - |
disableMobileBasicAuthentication | - | optional | - | - |
disableRedisForEnv | - | optional | - | - |
disableStrongPassword | - | optional | - | - |
enforceMultiFactorAuthentication | - | optional | - | - |
disableMultiFactorAuthentication | - | optional | - | - |
disableTotpLogin | - | optional | - | - |
disableMailOtpLogin | - | optional | - | - |
disablePhoneVerification | - | optional | - | - |
defaultAuthorizeResponseType | - | optional | - | - |
defaultAuthorizeResponseMode | - | optional | - | - |
MailDev is a simple way to test your projects generated email during development, with an easy to use web interface that runs on your machine. (Generator for maildev in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose)
An example of using Maildev, you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-maildev.
1process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; 2 3import { 4 DefaultNestApplicationInitializer, 5 DefaultNestApplicationListener, 6 InfrastructureMarkdownReportGenerator, 7 PACKAGE_JSON_FILE, 8 ProjectUtils, 9 bootstrapNestApplication, 10 isInfrastructureMode, 11} from '@nestjs-mod/common'; 12import { DOCKER_COMPOSE_FILE, DockerCompose, DockerComposeMaildev } from '@nestjs-mod/docker-compose'; 13import { join } from 'path'; 14import { AppModule } from './app/app.module'; 15 16const rootFolder = join(__dirname, '..', '..', '..'); 17const appFolder = join(rootFolder, 'apps', 'example-maildev'); 18 19bootstrapNestApplication({ 20 globalConfigurationOptions: { debug: true }, 21 globalEnvironmentsOptions: { debug: true }, 22 modules: { 23 system: [ 24 ProjectUtils.forRoot({ 25 staticConfiguration: { 26 applicationPackageJsonFile: join(__dirname, '..', '..', '..', 'apps/example-maildev', PACKAGE_JSON_FILE), 27 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 28 envFile: join(rootFolder, '.env'), 29 }, 30 }), 31 DefaultNestApplicationInitializer.forRoot(), 32 DefaultNestApplicationListener.forRoot({ 33 staticConfiguration: { 34 // When running in infrastructure mode, the backend server does not start. 35 mode: isInfrastructureMode() ? 'silent' : 'listen', 36 }, 37 }), 38 ], 39 feature: [AppModule.forRoot()], 40 infrastructure: [ 41 InfrastructureMarkdownReportGenerator.forRoot({ 42 staticConfiguration: { 43 markdownFile: join(appFolder, 'INFRASTRUCTURE.MD'), 44 skipEmptySettings: true, 45 style: 'pretty', 46 }, 47 }), 48 DockerCompose.forRoot({ 49 configuration: { 50 dockerComposeFileVersion: '3', 51 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 52 }, 53 }), 54 DockerComposeMaildev.forRoot(), 55 ], 56 }, 57});
After connecting the module to the application and npm run build
and starting generation of documentation through npm run docs:infrastructure
, you will have new files and scripts to run.
New scripts mostly package.json
Add database options to docker-compose file for application docker-compose.yml
with real credenionals and add it to .gitignore
file
1version: '3' 2services: 3 example-maildev-maildev: 4 image: 'maildev/maildev:2.2.1' 5 container_name: 'example-maildev-maildev' 6 ports: 7 - '1025:1025' 8 - '1080:1080' 9 networks: 10 - 'example-maildev-network' 11 environment: 12 MAILDEV_SMTP_PORT: '1025' 13 MAILDEV_WEB_PORT: '1080' 14 healthcheck: 15 test: 'wget -O - http://localhost:${MAILDEV_WEB_PORT}${MAILDEV_BASE_PATHNAME}/healthz || exit 1' 16 interval: '10s' 17 timeout: '5s' 18 retries: 5 19 tty: true 20 restart: 'always' 21networks: 22 example-maildev-network: 23 driver: 'bridge'
New environment variable
1# example-maildev-maildev (generated) 2EXAMPLE_MAILDEV_MAILDEV_MAILDEV_SMTP_PORT=1025 3EXAMPLE_MAILDEV_MAILDEV_MAILDEV_WEB_PORT=1080
When launched in the infrastructure documentation generation mode, the module creates an .env
file with a list of all required variables, as well as an example example.env
, where you can enter example variable values.
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
maildevMailDirectory | Directory for persisting mail. | obj['maildevMailDirectory'] , process.env['MAILDEV_MAIL_DIRECTORY'] | optional | - | - |
maildevHttps | Switch from http to https protocol. | obj['maildevHttps'] , process.env['MAILDEV_HTTPS'] | optional | - | - |
maildevHttpsKey | The file path to the ssl private key. | obj['maildevHttpsKey'] , process.env['MAILDEV_HTTPS_KEY'] | optional | - | - |
maildevHttpsCert | The file path to the ssl cert file. | obj['maildevHttpsCert'] , process.env['MAILDEV_HTTPS_CERT'] | optional | - | - |
maildevIp | IP Address to bind SMTP service to, defaults to :: (any IPv4/v6). | obj['maildevIp'] , process.env['MAILDEV_IP'] | optional | - | - |
maildevOutgoingHost | SMTP host for outgoing mail. | obj['maildevOutgoingHost'] , process.env['MAILDEV_OUTGOING_HOST'] | optional | - | - |
maildevOutgoingPort | SMTP port for outgoing mail. | obj['maildevOutgoingPort'] , process.env['MAILDEV_OUTGOING_PORT'] | optional | - | - |
maildevOutgoingUser | SMTP user for outgoing mail. | obj['maildevOutgoingUser'] , process.env['MAILDEV_OUTGOING_USER'] | optional | - | - |
maildevOutgoingPass | SMTP password for outgoing mail. | obj['maildevOutgoingPass'] , process.env['MAILDEV_OUTGOING_PASS'] | optional | - | hidden |
maildevOutgoingSecure | Use SMTP SSL for outgoing mail. | obj['maildevOutgoingSecure'] , process.env['MAILDEV_OUTGOING_SECURE'] | optional | - | - |
maildevAutoRelay | Use auto-relay mode. Optional relay email address. | obj['maildevAutoRelay'] , process.env['MAILDEV_AUTO_RELAY'] | optional | - | - |
maildevAutoRelayRules | Filter rules for auto relay mode. | obj['maildevAutoRelayRules'] , process.env['MAILDEV_AUTO_RELAY_RULES'] | optional | - | - |
maildevIncomingUser | SMTP user for incoming mail. | obj['maildevIncomingUser'] , process.env['MAILDEV_INCOMING_USER'] | optional | - | - |
maildevIncomingPass | SMTP password for incoming mail. | obj['maildevIncomingPass'] , process.env['MAILDEV_INCOMING_PASS'] | optional | - | hidden |
maildevIncomingSecure | Use SMTP SSL for incoming emails. | obj['maildevIncomingSecure'] , process.env['MAILDEV_INCOMING_SECURE'] | optional | - | - |
maildevIncomingCert | Cert file location for incoming SSL. | obj['maildevIncomingCert'] , process.env['MAILDEV_INCOMING_CERT'] | optional | - | - |
maildevIncomingKey | Key file location for incoming SSL. | obj['maildevIncomingKey'] , process.env['MAILDEV_INCOMING_KEY'] | optional | - | - |
maildevWebIp | IP Address to bind HTTP service to, defaults to --ip. | obj['maildevWebIp'] , process.env['MAILDEV_WEB_IP'] | optional | - | - |
maildevWebUser | HTTP user for GUI. | obj['maildevWebUser'] , process.env['MAILDEV_WEB_USER'] | optional | - | - |
maildevWebPass | HTTP password for GUI. | obj['maildevWebPass'] , process.env['MAILDEV_WEB_PASS'] | optional | - | hidden |
maildevBasePathname | Base path for URLs. | obj['maildevBasePathname'] , process.env['MAILDEV_BASE_PATHNAME'] | optional | - | - |
maildevDisableWeb | Disable the use of the web interface. Useful for unit testing. | obj['maildevDisableWeb'] , process.env['MAILDEV_DISABLE_WEB'] | optional | - | - |
maildevHideExtensions | Comma separated list of SMTP extensions to NOT advertise (SMTPUTF8, PIPELINING, 8BITMIME). | obj['maildevHideExtensions'] , process.env['MAILDEV_HIDE_EXTENSIONS'] | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name | optional | maildev/maildev:2.2.1 | - |
featureName | Feature name for generate prefix to environments keys | optional | - | - |
networks | Network, if not set networkNames have project name and driver=bridge. | optional | - | - |
smtpPort | SMTP port to catch mail | optional | 1025 | - |
webPort | Port to run the Web GUI. | optional | 1080 | - |
MinIO is a high-performance, S3 compatible object storage. (Generator for minio in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose)
An example of using Minio, you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-minio and frontend on Angular here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-minio-angular.
1import { 2 DefaultNestApplicationInitializer, 3 DefaultNestApplicationListener, 4 InfrastructureMarkdownReportGenerator, 5 PACKAGE_JSON_FILE, 6 ProjectUtils, 7 bootstrapNestApplication, 8 isInfrastructureMode, 9} from '@nestjs-mod/common'; 10import { join } from 'path'; 11 12import { DOCKER_COMPOSE_FILE, DockerCompose, DockerComposeMinio } from '@nestjs-mod/docker-compose'; 13 14const userFeatureName = 'minio-user'; 15const rootFolder = join(__dirname, '..', '..', '..'); 16const appFolder = join(rootFolder, 'apps', 'example-minio'); 17 18bootstrapNestApplication({ 19 globalConfigurationOptions: { debug: true }, 20 globalEnvironmentsOptions: { debug: true }, 21 modules: { 22 system: [ 23 ProjectUtils.forRoot({ 24 staticConfiguration: { 25 applicationPackageJsonFile: join(appFolder, PACKAGE_JSON_FILE), 26 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 27 envFile: join(rootFolder, '.env'), 28 }, 29 }), 30 DefaultNestApplicationInitializer.forRoot(), 31 DefaultNestApplicationListener.forRoot({ 32 staticConfiguration: { 33 // When running in infrastructure mode, the backend server does not start. 34 mode: isInfrastructureMode() ? 'silent' : 'listen', 35 }, 36 }), 37 ], 38 infrastructure: [ 39 InfrastructureMarkdownReportGenerator.forRoot({ 40 staticConfiguration: { 41 markdownFile: join(appFolder, 'INFRASTRUCTURE.MD'), 42 skipEmptySettings: true, 43 }, 44 }), 45 DockerCompose.forRoot({ 46 configuration: { 47 dockerComposeFileVersion: '3', 48 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 49 }, 50 }), 51 DockerComposeMinio.forRoot({ 52 staticConfiguration: { 53 nginxPort: 1111, 54 nginxFilesFolder: join(appFolder, 'ngnix'), 55 featureName: userFeatureName, 56 }, 57 }), 58 ], 59 }, 60});
After connecting the module to the application and npm run build
and starting generation of documentation through npm run docs:infrastructure
, you will have new files and scripts to run.
New scripts mostly package.json
Add database options to docker-compose file for application docker-compose.yml
with real credenionals and add it to .gitignore
file
1version: '3' 2services: 3 example-minio-minio: 4 image: 'bitnami/minio:2024.2.9' 5 container_name: 'example-minio-minio' 6 volumes: 7 - 'example-minio-minio-volume:/bitnami/minio/data' 8 ports: 9 - '9000:9000' 10 - '9001:9001' 11 networks: 12 - 'example-minio-network' 13 environment: 14 MINIO_ROOT_USER: 'minioadmin' 15 MINIO_ROOT_PASSWORD: '6EcbcW66JsKvFrY2bZw6QGKjHhefca7Kgppq' 16 healthcheck: 17 test: 18 - 'CMD-SHELL' 19 - 'mc' 20 - 'ready' 21 - 'local' 22 interval: '5s' 23 timeout: '5s' 24 retries: 5 25 tty: true 26 restart: 'always' 27 example-minio-nginx: 28 image: 'nginx:alpine' 29 container_name: 'example-minio-nginx' 30 volumes: 31 - './ngnix/config:/etc/nginx/conf.d' 32 - './ngnix/logs:/var/log/nginx/' 33 ports: 34 - '1111:1111' 35 networks: 36 - 'example-minio-network' 37 tty: true 38 restart: 'always' 39 depends_on: 40 example-minio-minio: 41 condition: 'service_started' 42networks: 43 example-minio-network: 44 driver: 'bridge' 45volumes: 46 example-minio-minio-volume: 47 name: 'example-minio-minio-volume'
Add database options to docker-compose file for application docker-compose-example.yml
with fake credenionals
1# Do not modify this file, it is generated using the DockerCompose module included with NestJS-mod. 2version: '3' 3services: 4 example-minio-minio: 5 image: 'bitnami/minio:2024.2.9' 6 container_name: 'example-minio-minio' 7 volumes: 8 - 'example-minio-minio-volume:/bitnami/minio/data' 9 ports: 10 - '9000:9000' 11 - '9001:9001' 12 networks: 13 - 'example-minio-network' 14 environment: 15 MINIO_ROOT_USER: 'value_for_minio_root_user' 16 MINIO_ROOT_PASSWORD: 'value_for_minio_root_password' 17 healthcheck: 18 test: 19 - 'CMD-SHELL' 20 - 'mc' 21 - 'ready' 22 - 'local' 23 interval: '5s' 24 timeout: '5s' 25 retries: 5 26 tty: true 27 restart: 'always' 28 example-minio-nginx: 29 image: 'nginx:alpine' 30 container_name: 'example-minio-nginx' 31 volumes: 32 - './ngnix/config:/etc/nginx/conf.d' 33 - './ngnix/logs:/var/log/nginx/' 34 ports: 35 - '1111:1111' 36 networks: 37 - 'example-minio-network' 38 tty: true 39 restart: 'always' 40 depends_on: 41 example-minio-minio: 42 condition: 'service_started' 43networks: 44 example-minio-network: 45 driver: 'bridge' 46volumes: 47 example-minio-minio-volume: 48 name: 'example-minio-minio-volume'
New environment variable
1EXAMPLE_MINIO_MINIO_USER_MINIO_ROOT_USER=minioadmin 2EXAMPLE_MINIO_MINIO_USER_MINIO_ROOT_PASSWORD=6EcbcW66JsKvFrY2bZw6QGKjHhefca7Kgppq
When launched in the infrastructure documentation generation mode, the module creates an .env
file with a list of all required variables, as well as an example example.env
, where you can enter example variable values.
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
minioRootUser | Minio root user. | obj['minioRootUser'] , process.env['MINIO_ROOT_USER'] | isNotEmpty (minioRootUser should not be empty) | - | - |
minioRootPassword | Minio root password. | obj['minioRootPassword'] , process.env['MINIO_ROOT_PASSWORD'] | isNotEmpty (minioRootPassword should not be empty) | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name | optional | bitnami/minio:2024.2.9 | - |
featureName | Feature name for generate prefix to environments keys | optional | - | - |
networks | Network, if not set networkNames have project name and driver=bridge. | optional | - | - |
externalPort | External port for S3 API operations on the default MinIO server port. | optional | 9000 | - |
externalConsolePort | External console for browser access on the MinIO Console port. | optional | 9001 | - |
nginxPort | External port for proxy access over nginx (infrastructure, need for disable CORS errors) | optional | - | - |
nginxConfigFolder | Folder for store nginx config (infrastructure) | optional | - | - |
nginxLogsFolder | Folder for store nginx logs (infrastructure) | optional | - | - |
nginxBucketsLocations | Locations for proxy to minio (infrastructure) | optional | [ files ] | - |
nginxConfigContent | Custom nginx config content (infrastructure) | optional | - | - |
NATS is an open source, lightweight and high-performance messaging system. It is ideal for distributed systems and supports modern cloud architectures and pub-sub, request-reply and queuing models. (Generator for nats in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose)
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
natsEnableAuth | Enable Authentication. | obj['natsEnableAuth'] , process.env['NATS_ENABLE_AUTH'] | optional | - | - |
natsUsername | Username credential for client connections. | obj['natsUsername'] , process.env['NATS_USERNAME'] | optional | - | - |
natsPassword | Password credential for client connections. | obj['natsPassword'] , process.env['NATS_PASSWORD'] | optional | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name. | optional | bitnami/nats:2.10.5 | - |
featureName | Feature name for generate prefix to environments keys | optional | - | - |
networks | Network, if not set networkNames have project name and driver=bridge. | optional | - | - |
externalClientPort | External client port for sharing container. | optional | 4222 | - |
externalHttpPort | External http port for sharing container. | optional | 8222 | - |
extraArgs | Extra arguments. | optional | -js | - |
Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. (Generator for nginx in docker-compose.yml for https://www.npmjs.com/package/@nestjs-mod/docker-compose)
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name | optional | nginx:alpine | - |
configContent | Config content | isNotEmpty (configContent should not be empty) | - | - |
configFolder | Config folder for map volume to /etc/nginx/conf.d | isNotEmpty (configFolder should not be empty) | - | - |
logsFolder | Logs folder for map volume to /var/log/nginx/ | optional | - | - |
dependsOnServiceNames | Depends on services | optional | - | - |
ports | Ports | optional | - | - |
networks | Network, if not set networkNames have project name and driver=bridge. | optional | - | - |
PostgreSQL (Postgres) is an open source object-relational database known for reliability and data integrity. ACID-compliant, it supports foreign keys, joins, views, triggers and stored procedures. (Generator for databases in docker-compose.yml for https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/libs/infrastructure/docker-compose)
An example you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-prisma-flyway or https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-prisma.
1import { 2 DefaultNestApplicationInitializer, 3 DefaultNestApplicationListener, 4 PACKAGE_JSON_FILE, 5 ProjectUtils, 6 bootstrapNestApplication, 7} from '@nestjs-mod/common'; 8import { DOCKER_COMPOSE_FILE, DockerCompose, DockerComposePostgreSQL } from '@nestjs-mod/docker-compose'; 9import { join } from 'path'; 10 11export const flywayPrismaFeatureName = 'flyway-prisma'; 12 13const rootFolder = join(__dirname, '..', '..', '..'); 14const appFolder = join(rootFolder, 'apps', 'example-prisma-flyway'); 15 16bootstrapNestApplication({ 17 modules: { 18 system: [ 19 ProjectUtils.forRoot({ 20 staticConfiguration: { 21 applicationPackageJsonFile: join(appFolder, PACKAGE_JSON_FILE), 22 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 23 envFile: join(rootFolder, '.env'), 24 }, 25 }), 26 DefaultNestApplicationInitializer.forRoot(), 27 DefaultNestApplicationListener.forRoot({ 28 staticConfiguration: { 29 // When running in infrastructure mode, the backend server does not start. 30 mode: isInfrastructureMode() ? 'silent' : 'listen', 31 }, 32 }), 33 ], 34 infrastructure: [ 35 DockerCompose.forRoot({ 36 configuration: { 37 dockerComposeFileVersion: '3', 38 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 39 }, 40 }), 41 DockerComposePostgreSQL.forRoot(), 42 DockerComposePostgreSQL.forFeature({ 43 featureModuleName: flywayPrismaFeatureName, 44 }), 45 ], 46 }, 47});
After connecting the module to the application and npm run build
and starting generation of documentation through npm run docs:infrastructure
, you will have new files and scripts to run.
New scripts mostly package.json
1{ 2 "scripts": { 3 "_____db_____": "_____db_____", 4 "db:create": "./node_modules/.bin/nx run-many -t=db-create" 5 }, 6 "scriptsComments": { 7 "db:create": ["Creation all databases of applications and modules"] 8 } 9}
Additional commands in the nx application project.json
1{ 2 "targets": { 3 "db-create": { 4 "executor": "nx:run-commands", 5 "options": { 6 "commands": [ 7 "./node_modules/.bin/pg-create-db --force-change-username=true --force-change-password=true --root-database-url=${EXAMPLE_PRISMA_FLYWAY_ROOT_DATABASE_URL} --app-database-url=${EXAMPLE_PRISMA_FLYWAY_FLYWAY_PRISMA_DATABASE_URL}" 8 ], 9 "parallel": false, 10 "envFile": "./.env", 11 "color": true 12 } 13 } 14 } 15}
Add database options to docker-compose file for application docker-compose.yml
with real credenionals and add it to .gitignore
file
1version: '3' 2services: 3 example-prisma-flyway-postgre-sql: 4 image: bitnami/postgresql:15.5.0 5 container_name: example-prisma-flyway-postgre-sql 6 volumes: 7 - example-prisma-flyway-postgre-sql-volume:/bitnami/postgresql 8 ports: 9 - 5432:5432 10 networks: 11 - example-prisma-flyway-network 12 healthcheck: 13 test: 14 - CMD-SHELL 15 - pg_isready -U postgres 16 interval: 5s 17 timeout: 5s 18 retries: 5 19 tty: true 20 restart: always 21 environment: 22 POSTGRESQL_USERNAME: postgres 23 POSTGRESQL_PASSWORD: postgres_password 24 POSTGRESQL_DATABASE: postgres 25networks: 26 example-prisma-flyway-network: 27 driver: bridge 28volumes: 29 example-prisma-flyway-postgre-sql-volume: 30 name: example-prisma-flyway-postgre-sql-volume
Add database options to docker-compose file for application docker-compose-example.yml
with fake credenionals
1# Do not modify this file, it is generated using the DockerCompose module included with NestJS-mod. 2version: '3' 3services: 4 example-prisma-flyway-postgre-sql: 5 image: bitnami/postgresql:15.5.0 6 container_name: example-prisma-flyway-postgre-sql 7 volumes: 8 - example-prisma-flyway-postgre-sql-volume:/bitnami/postgresql 9 ports: 10 - 5432:5432 11 networks: 12 - example-prisma-flyway-network 13 healthcheck: 14 test: 15 - CMD-SHELL 16 - pg_isready -U postgres 17 interval: 5s 18 timeout: 5s 19 retries: 5 20 tty: true 21 restart: always 22 environment: 23 POSTGRESQL_USERNAME: value_for_postgresql_username 24 POSTGRESQL_PASSWORD: value_for_postgresql_password 25 POSTGRESQL_DATABASE: value_for_postgresql_database 26networks: 27 example-prisma-flyway-network: 28 driver: bridge 29volumes: 30 example-prisma-flyway-postgre-sql-volume: 31 name: example-prisma-flyway-postgre-sql-volume
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
rootDatabaseUrl | Connection string for PostgreSQL with root credentials (example: postgres://postgres:postgres_password@localhost:5432/postgres?schema=public, username must be "postgres") | obj['rootDatabaseUrl'] , process.env['ROOT_DATABASE_URL'] | isNotEmpty (rootDatabaseUrl should not be empty) | - | - |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
image | Docker image name | optional | bitnami/postgresql:15.5.0 | - |
networks | Network, if not set networkNames have project name and driver=bridge. | optional | - | - |
externalPort | External port for sharing contai |
No vulnerabilities found.
No security vulnerabilities found.