- Update Docker base images: node:22-alpine → node:24-alpine - Add engines.node >=24.0.0 to package.json files - Create .nvmrc files with 24.15.0 - Update CI workflow to use node-version: 24.15.0 - Fix jest-e2e.json for uuid@13 ES Module compatibility Validation: - Backend unit tests: 340/340 passed - Frontend unit tests: 137/137 passed - Frontend build: successful (39 static pages)
4.1 KiB
Research: Node.js v24.15.0 Upgrade
Research Topics Completed
RT-001: Node.js v24 Breaking Changes
Decision: Use Node.js v24.15.0 LTS
Rationale:
- v24.15.0 is the current LTS (Long Term Support) version
- Extended support through April 2027
- Security patches and performance improvements over v22.x
Breaking Changes Assessment:
| Change | Impact on NAP-DMS | Action Required |
|---|---|---|
| Permission Model experimental changes | None | ไม่ใช้ permission model |
Buffer() constructor deprecation |
Low | Check legacy code; migrate to Buffer.from() |
| Crypto algorithm deprecations | Low | Verify hash usage in auth modules |
url.parse() deprecation |
None | ใช้ new URL() อยู่แล้ว |
| Test runner changes | None | Jest ไม่ใช้ Node.js native test runner |
Alternatives Considered:
- v23.x (not LTS, not suitable for production)
- Stay on v22.x (End-of-Life April 2026, security risk)
RT-002: Native Module Compatibility
Decision: Current native dependencies are compatible with Node.js v24
Rationale: N-API v8+ provides stability across Node.js versions
Compatibility Matrix:
| Package | Current Version | Node v24 Support | N-API Level |
|---|---|---|---|
| bcrypt | ^5.1.1 | ✅ Supported | N-API v8 |
| sharp | ^0.33.x | ✅ Supported | N-API v8 |
| sqlite3 | ^5.1.6 | ✅ Supported | node-gyp |
| argon2 | ^0.40.0 | ✅ Supported | N-API |
| @nestjs/platform-socket.io | ^10.x | ✅ Supported | Pure JS |
| class-validator | ^0.14.x | ✅ Supported | Pure JS |
Validation Plan:
- Run
pnpm rebuildin staging environment - Verify all native modules load without errors
- Run integration tests involving native modules
Alternatives Considered:
- Use pure-JS alternatives (slower performance)
- Pin to older native module versions (security risk)
RT-003: pnpm Compatibility
Decision: pnpm 9.x fully supports Node.js v24
Rationale: pnpm maintains compatibility across Node.js LTS versions (18, 20, 22, 24)
Findings:
- pnpm 9.0.0+ officially supports Node.js 18-24
- No known issues with pnpm on Node.js v24
- Lockfile format v9 is compatible
Alternatives Considered:
- Switch to npm (unnecessary disruption, slower)
- Switch to yarn (no significant benefit)
RT-004: Docker Image Availability
Decision: Use node:24.15.0-alpine3.21
Rationale:
- Alpine-based images are ~190MB compressed (vs ~1GB for full image)
- Alpine 3.21 is the latest stable
- Includes
libc6-compatfor native module compatibility
Image Options Compared:
| Image | Size | Pros | Cons |
|---|---|---|---|
node:24.15.0-alpine3.21 |
~190MB | Small, secure | Need libc6-compat for some native modules |
node:24.15.0-slim |
~250MB | Debian-based, more compatible | Larger |
node:24.15.0 |
~1GB | Full compatibility | Very large, unnecessary |
Dockerfile Updates Required:
# Before
FROM node:22.20.0-alpine3.20
# After
FROM node:24.15.0-alpine3.21
Additional Findings
NestJS Compatibility
- NestJS 10.x fully supports Node.js v24
- No breaking changes in NestJS core
- @nestjs/swagger, @nestjs/typeorm work correctly
Next.js Compatibility
- Next.js 14.x supports Node.js v24
- Next.js 15.x optimized for Node.js v24+ (future upgrade opportunity)
- Build performance may improve on v24
Performance Expectations
Node.js v24 improvements vs v22:
- ~5-10% faster HTTP throughput
- Improved memory management
- Faster startup time for ES modules
Target: Stay within 5% of baseline (may actually improve)
Research Conclusion
✅ All research topics resolved - upgrade is safe to proceed
No blockers identified. All major dependencies are compatible with Node.js v24.15.0.
Key files to update:
backend/Dockerfile- base imagefrontend/Dockerfile- base imagebackend/package.json- engines.nodefrontend/package.json- engines.nodebackend/.nvmrc- version pinfrontend/.nvmrc- version pin.gitea/workflows/ci-deploy.yml- CI node version