Skip to content

Conversation

@djunehor
Copy link

@djunehor djunehor commented Nov 9, 2025

Adds comprehensive VS Code dev container configuration to enable one-click development environment setup. The devcontainer includes Node.js 20 LTS, TypeScript tooling, and essential development services (Redis, NATS, MySQL) with pre-configured VS Code extensions and settings.

Closes #15864

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Contributors need to manually set up their local development environment, including Node.js version, dependencies, services (Redis, NATS, MySQL), and VS Code extensions/settings. This creates friction for new contributors and can lead to inconsistent development environments.

Issue Number: #15864

What is the new behavior?

Contributors can now use VS Code's "Reopen in Container" feature to automatically set up a complete, consistent development environment with:

  • Node.js 20 LTS with npm
  • Pre-installed dependencies with legacy peer deps handling
  • Essential development services (Redis, NATS, MySQL) in isolated containers
  • 15+ pre-configured VS Code extensions for TypeScript, ESLint, Prettier, Docker, etc.
  • Optimized VS Code settings for the NestJS codebase
  • Automated workspace permission handling
  • Comprehensive documentation in .devcontainer/README.md
  • Manual integration test services startup to maintain reliability

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The devcontainer configuration is purely additive and doesn't affect existing development workflows. Developers can continue using their local setup if preferred. Integration test services are available via npm run test:docker:up but are not started automatically to ensure container reliability.

The implementation follows VS Code dev container best practices and includes robust error handling for permission issues and npm installation failures that commonly occur in containerized environments.

Adds comprehensive VS Code dev container configuration to enable one-click development environment setup. The devcontainer includes Node.js 20 LTS, TypeScript tooling, and essential development services (Redis, NATS, MySQL) with pre-configured VS Code extensions and settings.

Closes nestjs#15864
@coveralls
Copy link

coveralls commented Nov 9, 2025

Pull Request Test Coverage Report for Build a79e1bef-a856-4cb1-8b31-900ac30e3cbf

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.927%

Totals Coverage Status
Change from base Build a397f2a5-d066-4bae-a4e2-52cdc757a397: 0.0%
Covered Lines: 7324
Relevant Lines: 8236

💛 - Coveralls

nodemon \
# Testing tools
mocha \
nyc \
Copy link
Member

@kamilmysliwiec kamilmysliwiec Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need some of these packages to be installed globally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - these don't need to be global. They're already in devDependencies and can be accessed via npm scripts or npx. I'll update the Dockerfile to remove the global installations of mocha, nyc, nodemon, ts-node, and other dev tools.

The only global package that might be justified is npm-check-updates for convenience, but I can remove that too if you prefer. Would you like me to keep just the base Node image and rely entirely on the local node_modules?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i'd say the fewer global deps the better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I've removed all global npm package installations from the Dockerfile. The devcontainer now relies entirely on local node_modules - all tools (typescript, ts-node, mocha, nyc, eslint, prettier, concurrently, cross-env, lerna, gulp-cli) are accessible via npx or npm scripts.

Removed global npm package installations (typescript, ts-node, mocha, nyc, eslint, prettier, concurrently, cross-env, lerna, gulp-cli) from the devcontainer Dockerfile. These packages are already available in devDependencies and can be accessed via npm scripts or npx, eliminating the need for global installations.

This change aligns with the principle of minimizing global dependencies and relying on local node_modules instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[discussion]: Add .devcontainer for simplified development setup

5 participants