Web Development · Node.js Projects
Node.js Projects for Beginners to Build Portfolio
Quick summary — Node.js projects for beginners
The best Node.js projects for beginners start with small command-line tools, move to Express REST APIs, and finish with a database-backed app that has authentication, tests and a live deployment. Three well-documented projects that grow in difficulty show recruiters real backend skill.
In this guide you will learn:
- Project ideas by level — from scripts to full apps.
- Express API patterns — with working code.
- Database and auth basics — for portfolio apps.
- A README template — to document each project.
- Node.js interview questions — with answers.
SECTION 01Level 1: Node.js starter projects
Start without frameworks. Small command-line tools teach how Node.js handles files, modules and asynchronous code, which every later project depends on. Good starter ideas include:
| Project | What it does | Node.js skills | Stretch goal |
|---|---|---|---|
| File organiser | Sorts files into folders by extension | fs, path, async/await | Dry-run mode |
| Word counter CLI | Counts words in a text file | process.argv, streams | Top 10 words |
| Weather fetcher | Gets weather for a city from an API | fetch, JSON, error handling | Cache results to a file |
| Expense logger | Saves expenses to a JSON file | Reading and writing JSON | Monthly summary |
// node organise.js ./downloads
const fs = require("fs/promises");
const path = require("path");
async function organise(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isFile()) continue;
const ext = path.extname(entry.name).slice(1).toLowerCase() || "other";
const target = path.join(dir, ext);
await fs.mkdir(target, { recursive: true });
await fs.rename(path.join(dir, entry.name), path.join(target, entry.name));
console.log(`moved ${entry.name} -> ${ext}/`);
}
}
organise(process.argv[2] || ".").catch((err) => {
console.error("Error:", err.message);
process.exit(1);
});
// node wordcount.js notes.txt
const fs = require("fs");
const file = process.argv[2];
if (!file) {
console.error("Usage: node wordcount.js <file>");
process.exit(1);
}
const text = fs.readFileSync(file, "utf8");
const words = text.toLowerCase().match(/[a-z']+/g) || [];
const counts = {};
for (const w of words) counts[w] = (counts[w] || 0) + 1;
const top = Object.entries(counts).sort((a, b) => b[1] - a[1]).slice(0, 10);
console.log(`Total words: ${words.length}`);
console.table(top);
SECTION 02Level 2: REST API projects with Express
Most Node.js jobs involve building APIs. An Express project shows you understand routes, HTTP methods, status codes and validation. Choose one of these and build it carefully:
| API project | Endpoints | Skills shown | Extra credit |
|---|---|---|---|
| Task manager API | CRUD for tasks | Routing, status codes, validation | Filtering and pagination |
| Library API | Books, members, loans | Related resources | Overdue report endpoint |
| URL shortener | Create and redirect short links | Redirects, unique IDs | Click counting |
| Quiz API | Questions and scoring | Business logic | Random question sets |
// npm init -y && npm install express
const express = require("express");
const app = express();
app.use(express.json());
let tasks = [];
let nextId = 1;
app.get("/tasks", (req, res) => res.json(tasks));
app.post("/tasks", (req, res) => {
const { title } = req.body;
if (!title || !title.trim()) {
return res.status(400).json({ error: "title is required" });
}
const task = { id: nextId++, title: title.trim(), done: false };
tasks.push(task);
res.status(201).json(task);
});
app.patch("/tasks/:id", (req, res) => {
const task = tasks.find((t) => t.id === Number(req.params.id));
if (!task) return res.status(404).json({ error: "not found" });
if (typeof req.body.done === "boolean") task.done = req.body.done;
res.json(task);
});
app.delete("/tasks/:id", (req, res) => {
const before = tasks.length;
tasks = tasks.filter((t) => t.id !== Number(req.params.id));
res.status(before === tasks.length ? 404 : 204).end();
});
app.listen(3000, () => console.log("API on http://localhost:3000"));
# Start the server
node server.js
# Create a task
curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Write README"}'
# List tasks
curl http://localhost:3000/tasks
# Mark task 1 as done
curl -X PATCH http://localhost:3000/tasks/1 \
-H "Content-Type: application/json" -d '{"done": true}'
# Delete task 1
curl -X DELETE -i http://localhost:3000/tasks/1
SECTION 03Level 3: Full Node.js apps with database and auth
Your strongest portfolio piece should store data in a real database, protect routes with authentication, include a few tests and run on a live server:
| Feature | Why it matters | Common choice | Beginner pitfall |
|---|---|---|---|
| Database | Data survives restarts | MongoDB with Mongoose or PostgreSQL | No schema validation |
| Authentication | Protects user data | Hashed passwords and JWT | Storing plain-text passwords |
| Tests | Confidence when changing code | Jest or Node's test runner with Supertest | No tests at all |
| Configuration | Safe secrets and settings | Environment variables | Committing secrets to GitHub |
// npm install bcrypt jsonwebtoken
const bcrypt = require("bcrypt");
const jwt = require("jsonwebtoken");
const SECRET = process.env.JWT_SECRET; // never hard-code secrets
async function hashPassword(plain) {
return bcrypt.hash(plain, 10);
}
async function login(user, plain) {
const ok = await bcrypt.compare(plain, user.passwordHash);
if (!ok) return null;
return jwt.sign({ sub: user.id }, SECRET, { expiresIn: "1h" });
}
function requireAuth(req, res, next) {
const token = (req.headers.authorization || "").replace("Bearer ", "");
try {
req.user = jwt.verify(token, SECRET);
next();
} catch {
res.status(401).json({ error: "unauthorised" });
}
}
module.exports = { hashPassword, login, requireAuth };
// npm install --save-dev jest supertest
// server.js should export the app: module.exports = app;
const request = require("supertest");
const app = require("./server");
test("rejects a task without a title", async () => {
const res = await request(app).post("/tasks").send({});
expect(res.status).toBe(400);
});
test("creates a task", async () => {
const res = await request(app).post("/tasks").send({ title: "Test" });
expect(res.status).toBe(201);
expect(res.body.title).toBe("Test");
});
// run: npx jest
SECTION 04Node.js project README and checklist templates
Good documentation makes your projects easy to review. Use these templates for every Node.js project:
# Task Manager API
A REST API for managing tasks, built with Node.js and Express.
## Features
- Create, list, update and delete tasks
- Input validation and proper status codes
- JWT authentication (protected routes)
## Run locally
```
npm install
cp .env.example .env
npm start
```
## Endpoints
| Method | Path | Description |
|--------|-------------|---------------|
| GET | /tasks | List tasks |
| POST | /tasks | Create a task |
## Tests
`npm test`
## Live demo
[link]
Before publishing a Node.js project:
[ ] package.json has start and test scripts
[ ] .env.example present, .env in .gitignore
[ ] node_modules in .gitignore
[ ] Input validation on every write endpoint
[ ] Errors return JSON with a clear message
[ ] At least 5 tests
[ ] README with setup, endpoints, live link
[ ] Code formatted consistently
Project | Level | Status | Tests | Deployed | Repo link
--------|-------|--------|-------|----------|----------
| 1 | | | |
| 2 | | | |
| 3 | | | |
Goal: one finished project per level before applying.
SECTION 05Tips to make Node.js projects stand out
Small details separate a portfolio project from a tutorial copy:
- Solve a real problem — build something you or people you know would use.
- Handle errors everywhere — never let the server crash on bad input.
- Write tests early — even a few tests show professional habits.
- Deploy it — a live link lets recruiters try your work instantly.
- Explain trade-offs — note in your README why you chose a database or library.
SECTION 06Interview Q&A — Node.js projects
Q1What is the event loop in Node.js?
It lets Node.js handle many operations on a single main thread by offloading I/O to the system and running callbacks when results are ready, so the server is not blocked while waiting.
Q2What is middleware in Express?
A function that runs during the request-response cycle, with access to req, res and next. It is used for logging, parsing JSON, authentication and error handling.
Q3Why should passwords be hashed?
So that stored passwords cannot be read directly if the database leaks. Libraries like bcrypt add salts and are deliberately slow to resist guessing.
Q4What is the difference between require and import?
require is the CommonJS module system traditionally used in Node.js. import is the ES module syntax; Node.js supports both, depending on configuration.
Q5How do you keep secrets out of your code?
Store them in environment variables, use a .env file locally that is listed in .gitignore, and provide a .env.example with placeholder values.
SECTION 07Test yourself — Node.js projects quiz
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
What are good Node.js projects for beginners?
A file organiser or word counter CLI, a weather fetcher, a task manager REST API, a URL shortener, and a full app with a database, authentication and tests.
How many Node.js projects do I need for a portfolio?
Three well-documented projects of increasing difficulty are usually enough: a small tool, a REST API and a full app with a database and deployment.
Should I use MongoDB or SQL with Node.js?
Both work well. MongoDB is common in Node.js tutorials; PostgreSQL or MySQL teach relational design. Try one deeply and understand when the other fits.
Where can I deploy Node.js projects for free?
Several cloud platforms offer free or trial tiers for small Node.js apps. Check current limits, use environment variables for secrets and set up a simple health check.
Do I need to learn Express for Node.js jobs?
Express is widely used and a good first framework. Learning it well also makes other Node.js frameworks easier to pick up later.
SECTION 09Related reads
Classroom & online · Noida
Pair backend skills with data skills
Developers who understand data stand out. Our Data Analytics Training Course teaches SQL, Excel and dashboards with projects and mentor support, a useful complement to backend work.
₹15,500 · full programme- SQL for app data
- Dashboards and reporting
- Project-based learning
- Weekday & weekend batches