Skip to content

Commit bf99d90

Browse files
committed
feat: centralize Node.js version management with .nvmrc as SSOT (#476)
- Update .nvmrc to v24.11.0 (Node.js 24 LTS/Krypton) - Add engines field to package.json requiring >=24.11.0 - Configure CI/CD workflows to read from .nvmrc via node-version-file - Remove hardcoded NODE_VERSION env vars from workflows - Align .coderabbit.yaml to reference 24.11.0 - Document .nvmrc as single source of truth in AGENTS.md - Update README.md Prerequisites to reference .nvmrc - Enhance README.md Features section with detailed descriptions - Fix Tech Stack table alignment for markdownlint compliance - Add commit message format guidelines to copilot-instructions.md
1 parent 7be431b commit bf99d90

File tree

8 files changed

+64
-36
lines changed

8 files changed

+64
-36
lines changed

.coderabbit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ reviews:
119119
- path: "package.json"
120120
instructions: |
121121
- Verify "type": "module" is set (ESM)
122-
- Check Node.js version matches LTS/Krypton (24.11.1)
122+
- Check Node.js version matches LTS/Krypton (24.11.0)
123123
- Ensure scripts are correctly defined
124124
- Validate dependencies are up to date
125125
- Check that test script uses NODE_OPTIONS for experimental VM modules

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
- **Async**: All I/O operations use async/await
2020
- **Testing**: Jest with ESM experimental VM modules
2121
- **Formatting**: Prettier (4 spaces, single quotes, 127 width)
22+
- **Commit Messages**: Follow Conventional Commits with issue number suffix
23+
- Format: `type(scope): description (#issue)` (max 80 chars)
24+
- Types: `feat`, `fix`, `chore`, `docs`, `test`, `refactor`
25+
- Example: `feat(api): add player search endpoint (#123)`
2226

2327
## 🏗️ Architecture at a Glance
2428

.github/workflows/node-cd.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- "v*.*.*-*"
1111

1212
env:
13-
NODE_VERSION: "lts/krypton"
1413
REGISTRY: ghcr.io
1514
IMAGE_NAME: ${{ github.repository }}
1615

@@ -29,7 +28,7 @@ jobs:
2928
- name: Set up Node.js
3029
uses: actions/setup-node@v6.2.0
3130
with:
32-
node-version: ${{ env.NODE_VERSION }}
31+
node-version-file: ".nvmrc"
3332
cache: "npm"
3433
cache-dependency-path: package-lock.json
3534

.github/workflows/node-ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
pull_request:
1010
branches: [master]
1111

12-
env:
13-
NODE_VERSION: "lts/krypton"
14-
1512
jobs:
1613
build:
1714
runs-on: ubuntu-latest
@@ -26,7 +23,7 @@ jobs:
2623
- name: Set up Node.js
2724
uses: actions/setup-node@v6.2.0
2825
with:
29-
node-version: ${{ env.NODE_VERSION }}
26+
node-version-file: ".nvmrc"
3027
cache: "npm"
3128
cache-dependency-path: package-lock.json
3229

@@ -53,7 +50,7 @@ jobs:
5350
- name: Set up Node.js
5451
uses: actions/setup-node@v6.2.0
5552
with:
56-
node-version: ${{ env.NODE_VERSION }}
53+
node-version-file: ".nvmrc"
5754
cache: "npm"
5855
cache-dependency-path: package-lock.json
5956

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22.15.0
1+
v24.11.0

AGENTS.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,36 @@ npm start
2929

3030
## Node.js Version
3131

32-
This project requires **Node.js 24 (LTS/Krypton)** specified in `.nvmrc`.
32+
This project uses **`.nvmrc` as the single source of truth** for Node.js version management.
3333

34-
If using nvm, asdf, or mise, the correct version activates automatically. Otherwise, ensure Node.js 24 is installed.
34+
**Current version:** Node.js 24.11.0 (LTS/Krypton)
35+
36+
**Philosophy:** This project tracks the latest Node.js LTS release. The specific version is always defined in `.nvmrc`.
37+
38+
### How It Works
39+
40+
- **Local development:** Version managers (nvm, asdf, mise) auto-activate from `.nvmrc`
41+
- **CI/CD pipelines:** GitHub Actions reads version using `node-version-file: '.nvmrc'`
42+
- **Version enforcement:** `package.json` engines field requires `>=24.11.0`
43+
- **Docker:** Uses `node:krypton-alpine` base image (aligned with Node.js 24)
44+
45+
### Updating Node.js Version
46+
47+
To update the Node.js version project-wide:
48+
49+
1. Edit `.nvmrc` with the new version (e.g., `v24.12.0`)
50+
2. Update `package.json` engines field if minimum version changes
51+
3. Test locally and in CI/CD
52+
4. Commit changes
53+
54+
**That's it!** No need to update workflow files - they automatically read from `.nvmrc`.
55+
56+
### Benefits
57+
58+
- **Consistency:** Same version across local dev, CI, and CD environments
59+
- **Maintainability:** Single file to update, no version duplication
60+
- **Developer experience:** Auto-activation eliminates manual version switching
61+
- **Enforcement:** npm warns if Node.js version requirement isn't met
3562

3663
## Development Workflow
3764

README.md

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,31 @@ Proof of Concept for a RESTful API made with [Node.js](https://nodejs.org/) [LTS
2828

2929
## Features
3030

31-
- 🔌 RESTful CRUD operations for football player data
32-
- 💿 Relational database with ORM
33-
- ⚡ In-memory caching (1-hour TTL)
34-
- 📚 Interactive API documentation
35-
- 🔒 Security headers and CORS
36-
- 🩺 Health check endpoint for monitoring
37-
- ✅ Comprehensive integration tests
38-
- 🐳 Full containerization support
39-
- 📃 TypeScript strict mode enabled
40-
- 🔄 Hot reload for development
31+
- 🏗️ **Modern TypeScript architecture** - Native ESM, strict mode, layered architecture with interface-based contracts
32+
- 📚 **Interactive API exploration** - Auto-generated OpenAPI docs with Swagger UI and Postman collection
33+
-**Performance optimizations** - In-memory caching with node-cache, Sequelize ORM, and efficient SQLite operations
34+
- 🧪 **Comprehensive integration tests** - Full endpoint coverage with Jest/Supertest and automated reporting to Codecov
35+
- 📖 **Token-efficient documentation** - AGENTS.md + auto-loaded Copilot instructions for AI-assisted development
36+
- 🐳 **Full containerization** - Multi-stage Docker builds with Docker Compose orchestration
37+
- 🔄 **Complete CI/CD pipeline** - Automated linting (ESLint/Prettier), testing, Docker publishing, and GitHub releases
38+
-**Football-themed semantic versioning** - Memorable, alphabetical release names using football terminology
4139

4240
## Tech Stack
4341

44-
| Category | Technology |
45-
|----------------------|------------|
46-
| **Runtime** | [Node.js 24 (LTS/Krypton)](https://github.com/nodejs/node) |
47-
| **Language** | [TypeScript 5.9](https://github.com/microsoft/TypeScript) |
48-
| **Module System** | Native ECMAScript Modules (ESM) - uses [tsx](https://github.com/privatenumber/tsx) for execution |
49-
| **Framework** | [Express.js 5](https://github.com/expressjs/express) |
50-
| **Database** | [SQLite3](https://github.com/sqlite/sqlite) with [Sequelize ORM](https://github.com/sequelize/sequelize) |
51-
| **Caching** | [node-cache](https://github.com/node-cache/node-cache) |
52-
| **Documentation** | [Swagger (OpenAPI 3.0)](https://github.com/swagger-api/swagger-ui) |
53-
| **Security** | [Helmet](https://github.com/helmetjs/helmet), [CORS](https://github.com/expressjs/cors) |
54-
| **Testing** | [Jest 30](https://github.com/jestjs/jest) with [Supertest](https://github.com/ladjs/supertest) |
55-
| **Containerization** | [Docker](https://github.com/docker) with multi-stage builds |
56-
| **Code Quality** | [ESLint](https://github.com/eslint/eslint), [Prettier](https://github.com/prettier/prettier), [Commitlint](https://github.com/conventional-changelog/commitlint) |
57-
| **Dev Tools** | [tsx](https://github.com/privatenumber/tsx) (TypeScript executor), [nodemon](https://github.com/remy/nodemon) |
42+
| Category | Technology |
43+
|------------------------|------------------------------------------------------------------------------------------------------------------------------|
44+
| **Runtime** | [Node.js 24 (LTS/Krypton)](https://github.com/nodejs/node) |
45+
| **Language** | [TypeScript 5.9](https://github.com/microsoft/TypeScript) |
46+
| **Module System** | Native ECMAScript Modules (ESM) - uses [tsx](https://github.com/privatenumber/tsx) for execution |
47+
| **Framework** | [Express.js 5](https://github.com/expressjs/express) |
48+
| **Database** | [SQLite3](https://github.com/sqlite/sqlite) with [Sequelize ORM](https://github.com/sequelize/sequelize) |
49+
| **Caching** | [node-cache](https://github.com/node-cache/node-cache) |
50+
| **Documentation** | [Swagger (OpenAPI 3.0)](https://github.com/swagger-api/swagger-ui) |
51+
| **Security** | [Helmet](https://github.com/helmetjs/helmet), [CORS](https://github.com/expressjs/cors) |
52+
| **Testing** | [Jest 30](https://github.com/jestjs/jest) with [Supertest](https://github.com/ladjs/supertest) |
53+
| **Containerization** | [Docker](https://github.com/docker) with multi-stage builds |
54+
| **Code Quality** | [ESLint](https://github.com/eslint/eslint), [Prettier](https://github.com/prettier/prettier), [Commitlint](https://github.com/conventional-changelog/commitlint) |
55+
| **Dev Tools** | [tsx](https://github.com/privatenumber/tsx) (TypeScript executor), [nodemon](https://github.com/remy/nodemon) |
5856

5957
> 💡 **Note:** While the repository name references `ts-node` (the original implementation), the project now uses [tsx](https://github.com/privatenumber/tsx) for faster, cleaner TypeScript execution without experimental flags.
6058
@@ -170,7 +168,7 @@ For complete endpoint documentation with request/response schemas, explore the [
170168

171169
Before you begin, ensure you have the following installed:
172170

173-
- Node.js 24 (LTS/Krypton) or higher
171+
- Node.js (latest LTS - specific version in `.nvmrc`)
174172
- npm (comes with Node.js)
175173
- Docker and Docker Compose (optional, for containerized setup)
176174

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
"keywords": [],
2121
"author": "Nano Taboada",
2222
"license": "MIT",
23+
"engines": {
24+
"node": ">=24.11.0"
25+
},
2326
"dependencies": {
2427
"body-parser": "^2.2.2",
2528
"cors": "^2.8.6",

0 commit comments

Comments
 (0)