JavaScript on the server - one language for everything.
Node.js is a runtime that lets JavaScript - the language of the browser - run on a server. That means the same language you use for frontend interactivity can also handle requests, talk to databases, and build APIs. Express is the most popular Node web framework: a thin, flexible layer that maps URLs to functions and handles the request/response details.
Together they power one of the largest developer ecosystems in the world. npm, Node's package registry, has a library for nearly anything you'll ever want to do.
Node + Express is the natural backend if you're already learning JavaScript for the frontend - one language across the whole stack, and it pairs seamlessly with React or Vue. It's especially good for APIs and real-time apps. It's happiest on a VPS or platform service (only some shared plans can run Node apps, and on classic shared hosting PHP wins), and if you'd rather learn the most readable language first, Python + Flask is the gentler start.
package.json;
npm install fetches them into
node_modules.
app.get("/users", handler).
async/await so the server keeps handling other
requests meanwhile. This is Node's superpower and the biggest
beginner hurdle.
import express from "express";
const app = express();
app.use(express.json());
app.get("/api/hello", (req, res) => {
res.json({ message: "Hello from Express!" });
});
app.listen(3000, () => console.log("Running on port 3000"));
Run node server.js and you have a JSON API at
localhost:3000/api/hello - ready for a React or Vue
frontend to fetch from.
async.
npm init -y and npm install express in
a new folder.
require and import. Node supports CommonJS and ES modules. For new projects, add "type": "module" to package.json and use import throughout.
await. Without it you get a pending Promise instead of your data - often showing up as [object Promise] or an empty response.
async handlers itself; you no longer need try/catch around every route.
process.env.PORT.
node --watch replaces nodemon, node --env-file=.env replaces dotenv for most uses, and node --test is a built-in test runner.
Node apps need a host that runs a long-lived process: platform services like Render, Railway or Fly.io, or a VPS with a process manager. Some shared hosting plans offer a "Node.js app" option too, but support varies. Our Node + Express + PostgreSQL guide walks through a full deployment.