Skip to content

Releases: mraxays/node-express-ejs-tailwindcss-starter

v2.0.0 – ES Modules and Tailwind CSS v4.3

Choose a tag to compare

@mraxays mraxays released this 11 Oct 13:17

v2.0.0 – ES Modules and Tailwind CSS v4.3

This release moves the starter from CommonJS to ES Modules (ESM), updates Tailwind CSS to v4.3, and refreshes the homepage and documentation.

Looking for the CommonJS version? Use v1.0.0.

⚠️ Breaking Changes

  • The project now uses ES Modules ("type": "module" in package.json).
  • require() / module.exports are replaced with import / export.
  • Relative imports must include the .js extension (for example, ./routes/index.js).
  • __dirname and __filename are not available in ESM. app.js now defines them with fileURLToPath(import.meta.url).
  • Node.js 20 or later is now required.

What's Changed

Added

  • ES Modules support across app.js, bin/www and routes/.
  • Tailwind CSS v4.3 with @tailwindcss/cli ^4.3.0.
  • Updated index.ejs with an improved HTML structure and Tailwind CSS classes.
  • README badges for license, latest release and views.
  • Documentation for how the project works, changing the port, and the optional dotenv setup.

Changed

  • app.js and bin/www now use ESM imports, and the app is exported with export default app.
  • routes/index.js and routes/users.js now use export default router.
  • The Tailwind source file public/stylesheets/tailwind.css now uses the Tailwind v4 layers, and compiles to public/stylesheets/styles.css.
  • README rewritten to match the ESM setup, current dependencies and project structure.

Fixed

  • ReferenceError: __dirname is not defined in ES module scope.

Upgrading from v1.x

  1. Add "type": "module" to your package.json.
  2. Replace require() with import and module.exports with export default.
  3. Add .js extensions to relative imports.
  4. Define __dirname if you use it:
   import { fileURLToPath } from "url";
   import { dirname } from "path";

   const __filename = fileURLToPath(import.meta.url);
   const __dirname = dirname(__filename);
  1. Update Tailwind to v4 and rebuild your CSS with npm run buildcss.

Getting Started

git clone git@github.com:mraxays/node-express-ejs-tailwindcss-starter.git
cd node-express-ejs-tailwindcss-starter
npm install
npm run dev

The server runs at http://localhost:3000/.

Full Changelog: v1.0.0...v2.0.0

commonjs - Node Express Final Version

Choose a tag to compare

@mraxays mraxays released this 11 Oct 12:36
665849d

v1.0.0 – Initial Release

First release of the Node.js Express EJS Tailwind CSS Starter, a starter template for building modern web applications with Express, EJS, and Tailwind CSS. This version uses CommonJS (require / module.exports).

Features

  • Express.js server setup with the latest Express version
  • EJS templating for dynamic pages
  • Tailwind CSS integration through @tailwindcss/cli
  • Organized project structure with routes/, views/, and public/
  • Built-in middleware for JSON and URL-encoded request parsing, cookies, and request logging
  • Error handling with a 404 handler and a custom error.ejs page
  • Development workflow with Nodemon and Tailwind CSS watch mode
  • Production-ready, minified CSS build
  • Prettier setup with the Tailwind CSS class-sorting plugin

Included Scripts

Command Description
npm start Start the application
npm run dev Run the server with Nodemon and Tailwind CSS watch mode
npm run dev:server Run only the development server
npm run devcss Compile Tailwind CSS and watch for changes
npm run buildcss Build and minify Tailwind CSS for production

Project Structure

├── bin/www
├── public/
│   ├── images/
│   ├── javascripts/
│   └── stylesheets/tailwind.css
├── routes/
│   ├── index.js
│   └── users.js
├── views/
│   ├── index.ejs
│   └── error.ejs
├── app.js
└── package.json

Getting Started

git clone https://github.com/mraxays/node-express-ejs-tailwindcss-starter.git
cd node-express-ejs-tailwindcss-starter
npm install
npm start

The server runs at http://localhost:3000/.

Dependencies

Express, EJS, Tailwind CSS (@tailwindcss/cli), Morgan, Cookie Parser, Debug, HTTP Errors

Dev dependencies: Nodemon, Prettier, Prettier Plugin Tailwind CSS

License

Released under the MIT License.