Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
The Node.js Module System: CommonJS vs ES Modules, "type", "exports" and require(esm)
Node.js loads a file as CommonJS or as an ES module based on its extension (.mjs/.cjs) and the "type" field in the nearest package.json; since require(esm) is stable in Node 26, the two worlds can now load each other, except for top-level await. With real errors: extensionless imports, ERR_REQUIRE_ASYNC_MODULE, named imports from CommonJS, paths closed by exports, the dual package hazard, and #-aliases plus JSON import attributes in the Bookstore API.
Installing Node.js and Your First Project: Version Managers, .nvmrc, package.json, node --watch and --env-file
The right way to start a Node.js project is to install Node with a version manager, pin the version with .nvmrc and the engines field in package.json, and keep scripts in package.json. With real output: the EBADENGINE error engine-strict gives on Node 24, npm init and the anatomy of package.json, restarts with node --watch, the shell value overriding .env with --env-file, 0.04 versus 0.11 seconds for node --run and npm run, and the Bookstore API's first GET /health endpoint.