How betorobson/nodejs-environment-development-in-docker works
Project type and purpose
• This is a boilerplate “development-environment template” rather than a user-facing application. Its goal is to provide a consistent, Docker-based NodeJS (and optional PHP) environment for developers, complete with VSCode debugging support, automatic rebuilds via nodemon, and version-bump CI workflows.
File structure
• Top-level Docker orchestration:
• Dockerfile + docker-compose.yml at project root define your NodeJS service (and any dependencies you add).
• php/Dockerfile + php/docker-compose.yml define a side-by-side PHP service.
• NodeJS source under src/:
• src/index.ts is the main entry point.
• src/helpers houses shared utilities (api-response.js, teste.ts, workers.js).
• tsconfig.json + tsconfig.worker.json configure your main process and worker builds.
• Configuration files:
• nodemon.json drives hot-reload in the Node container.
• .eslintrc, .prettierrc standardize linting/formatting.
• CI/CD:
• .github/workflows/*.yml handle bumping versions, tests, and master/develop branch automations.
README for additional insights
• Emphasis on “docker-compose up” to stand up the entire stack.
• VSCode debug configuration named “My NodeJS: Attach to Docker.”
• Minimal external dependencies aside from Docker and Node.
• PHP is optional but provided for polyglot demos—therefore treated as a separate service.
a. Main components
• Developer Workstation (VSCode + Docker CLI)
• Docker Engine (running locally)
• Container A: NodeJS Service
– Entrypoint: src/index.ts
– Hot-reload via nodemon
– Worker threads/processes (tsconfig.worker.json)
– Helpers library
• Container B: PHP Service (optional)
– Entrypoint: php/src/index.php
• Network: Docker Compose bridge network
• CI/CD GitHub Actions (version-bump, test pipelines)
b. Relationships and interactions
• Developer triggers “docker-compose up” → Docker Engine
• Docker Engine launches NodeJS container and PHP container
• VSCode attaches (via remote debugger) to NodeJS container’s debug port
• NodeJS container mounts host src/ directory for live code updates
• Optionally, NodeJS ↔ PHP container could communicate over HTTP if configured
c. Architectural patterns
• Service-based separation: each language/service in its own container
• Volume-mounted source directories for 1:1 parity dev environment
• Clear config segregation: tsconfig vs. tsconfig.worker for multi-process builds
• CI/CD pipelines external to runtime (GitHub Actions)
d. Key technologies/frameworks
• Docker & Docker Compose
• NodeJS + TypeScript + nodemon
• VSCode Remote Debugger
• PHP (via official PHP image)
• ESLint, Prettier, EditorConfig for code quality
• GitHub Actions for CI/CD
Detail without overthinking
• Break the NodeJS container into sub-components: entrypoint, hot-reload, workers, helper modules.
• Optional PHP service as a parallel container.
• Continuous integration pipeline triggering on bump-version commits.
• Cross-cutting concerns (lint, format, debug).