Node.ts

Node.JS (TypeScript) Practice

Build real HTTP APIs in Node, one skill at a time. Easy → Hard: routing, validation, responses, middleware, data access — up to auth, caching, jobs, concurrency, transactions, streaming, resilience. Every challenge is API-only and test-driven: implement the missing piece until the supertest suite (in-memory SQLite, seeded) passes.

nodejs-24Node.js 24
Read the Node.js overview
Module 1

Routing & Controllers

Map each verb and path to its handler, resolve ids from the URL, and return the status that matches the outcome - created, updated, deleted, not-found, method-not-allowed. Covers nested resources and route precedence.

4
About this challenge

A bike rental shop's web service. Staff list bikes, add one, and view, edit or remove a single bike. It must reply with the right "found / created / deleted / not-found" signals instead of misleading ones.

About this challenge

A training provider lists modules that live inside a course. A module is only valid under its own course, so asking for it through the wrong course returns "not found", and malformed ids are rejected before any lookup.

About this challenge

A reporting service where a fixed page (`/reports/summary`) keeps being mistaken for a generic "report by id" page. Routes must be ordered so named pages win, with a clean JSON not-found for anything unmatched.

About this challenge

An office room-booking service. Users filter rooms and request a reservation. It checks the times and party size make sense before accepting, and tells the user exactly which field was wrong.

Module 2

Request Data & Validation

Read and check what comes in —-query params, JSON bodies, request headers. Apply defaults, coerce types, clamp limits, and reject bad input with the status that names the bad field (400/422) or header problem (401/403/415). Covers paging/filters/sort, schema validation with per-field errors, and request-header handling.

4
About this challenge

Sign up to see what this challenge asks.

About this challenge

A dental booking form that currently saves whatever it's sent. It must check the submitted data against a set of rules, report every bad field at once, and quietly drop fields it doesn't recognise.

About this challenge

A print-order service that ignores the metadata clients attach to a request. It must require an access key, accept only the right data format, and honour how the client wants the answer returned.

About this challenge

A supplier sign-up that says "OK" to everything, so clients can't tell success from rejection. Each outcome - accepted, invalid, duplicate, too-large — gets its own clear signal in one consistent response shape.

Module 3

Responses & Status Codes

Shape what goes out - map each outcome to its status and set the headers that go with it (Location, Accept, Cache-Control, request-id), with one consistent body and error shape. Covers redirects and idempotency, JSON/CSV content negotiation, and response-shaping middleware.

4
About this challenge

A community-garden plot service that hides errors inside "success" replies. Every outcome must carry the correct signal, with one consistent error shape and no body where none belongs.

About this challenge

A maintenance work-order service where clients can't find an item after creating it. Replies must point clients to the new item's address, and repeating an action must not double it up.

About this challenge

An organisation wants the same employee directory as JSON for its intranet app and as a spreadsheet (CSV) for HR. The service returns whichever the client asks for, correctly formatted and escaped.

About this challenge

A pricing service that should shape every reply the same way - a tracking id, caching hints, a consistent wrapper - without each route repeating the code. Handlers return data; a shared step finishes the response.

Module 4

Middleware Basics

Write the shared steps that wrap every request - logging, access control, timing through an injected dependency rather than a hard-coded one, and compose them in front of the routes. Log method/path/final-status/duration, gate writes by token and scope (401/403), stamp a latency header, and stack them all in front of a data-backed API with paged, injection-safe queries. Covers logging, authentication/authorization, timing, and middleware composition.

4
About this challenge

A billing service that logs nothing, so failures can't be traced. A shared step records who asked for what and how it ended errors included - while skipping the health-check noise.

About this challenge

A back-office console whose write actions are open to anyone with the link. A shared gate checks the caller's token and permissions before the action runs, and lets read-only and public pages through.

About this challenge

An engineering team can't see which checkout steps are slow. A shared step times each request and reports the duration back on the response, for both successes and failures.

About this challenge

A sales CRM's contact-activity feed behind one guarded, logged surface. Reads are paged and safe from injection, writes are blocked unless authorised, and every call is recorded.

About this path

This path builds HTTP APIs in Node.js with TypeScript, starting with routing and controllers, request validation, status codes and middleware. You should be comfortable with basic TypeScript or JavaScript. No earlier backend experience is needed. The middleware module includes a request audit log and an access gate for an admin console.

From the blog

7
Bun 1.4 Updates: Rust Runtime, Native APIs, and MoreBun updates in the latest release bring a Rust rewrite, native APIs, stronger Node.js compatibility, and new package tooling.REST vs GraphQL: picking an API styleAn honest, trade-off-first comparison of REST and GraphQL — over/under-fetching, caching, versioning, and the cost GraphQL adds — so you pick by project shape, not hype.How to paginate an API properlyBuild a pagination contract that scales — page/limit vs cursor, a field whitelist for sorting, consistent page metadata, and the edge cases that break offset paging.Why your Express async errors slip throughA rejected promise in an async route handler never reaches your Express error middleware. Here's why the default error handler misses it, and three ways to fix it.Securing an Express APIExpress security best practices as a pre-ship checklist — authentication, rate limiting, input validation, security headers, and secret handling.How to handle API errors consistentlyOne error envelope, one middleware, one shape — a practical pattern for API error handling that clients can rely on, with status-code mapping and safe messages.REST API design done rightThe REST API checklist to run before you ship — resource naming, status codes, error shapes, pagination, versioning, and auth.

Frequently asked questions

4

What will I practice in this path?

4 modules: Routing & Controllers, Request Data & Validation, Responses & Status Codes and Middleware Basics.

How many challenges are there, and how hard are they?

16 challenges, all easy.

What does this path run on?

Challenges run on Node.js 24.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.