← Back to courses

Course

Node.js

206 lessons across 14 modules

Beginner to production, assuming JavaScript and ES6+. The runtime and event loop, modules and npm, the core library, files and streams, async, HTTP from scratch, Express, REST design, PostgreSQL, auth and security, production operations, and testing - ending in a multi-tenant learning platform API. The road is laid out in full; lessons are being written one at a time.

Course14 modules206 lessonsEach heading below is a module (one topic). Each card under it is a lesson. Start with Module 1.
Solid: ready (0)Dashed: coming soon (206)
Module 1 of 1412 lessonsComing soon

Node.js Fundamentals

What Node is, and getting a first program running

Prerequisite: the JavaScript course →

What is Node.js?

1

A JavaScript runtime built for servers and tools, not a framework.

The same function running outside a browser

Lesson 1planned

Why Node.js?

2

Non-blocking I/O, one language front to back, and a huge ecosystem.

A server holding ten thousand idle connections cheaply

Lesson 2planned

Node.js vs Browser JavaScript

3

Same language, different globals - no DOM, but a file system.

window missing and process present

Lesson 3planned

Node.js Use Cases

4

Where it shines, and the CPU-heavy work where it does not.

An API server against a video encoder

Lesson 4planned

Node.js Architecture Overview

5

V8, libuv, and bindings - the three layers in one picture.

Following fs.readFile down through the layers

Lesson 5planned

Installing Node.js

6

LTS against current, and installing without admin rights.

Choosing a version for a production server

Lesson 6planned

Node.js Version Management

7

nvm and friends, and pinning the version per project.

An .nvmrc that makes every machine agree

Lesson 7planned

Running Your First Node.js Program

8

A script, run from the terminal, printing to stdout.

Reading a command-line argument and greeting it

Lesson 8planned

Node.js REPL

9

The interactive prompt, and what it is actually good for.

Checking how a built-in behaves in five seconds

Lesson 9planned

node Command

10

Flags worth knowing - watch, env-file, inspect.

Restarting on save without installing anything

Lesson 10planned

Understanding package.json

11

Reading one to understand what a project is and how to run it.

Opening an unfamiliar repo and knowing where to start

Lesson 11planned

Node.js Project Structure

12

Where code, config, and tests live in a small project.

A layout that still makes sense at fifty files

Lesson 12planned
Module 2 of 1412 lessonsComing soon

Node.js Runtime and Architecture

Why Node behaves differently from other backends

Watch the event loop step by step →

Node.js Runtime

13

Everything around the engine that makes JavaScript a server language.

What Node adds that V8 alone does not have

Lesson 13planned

V8 JavaScript Engine

14

Parsing, JIT compilation, and garbage collection.

A function that gets faster after it has run a few times

Lesson 14planned

Event-Driven Architecture

15

Reacting to events rather than waiting in a loop.

A server that does nothing until a request arrives

Lesson 15planned

Single-Threaded Model

16

One thread for your code - and what that makes easy and hard.

No locks needed, and one slow loop blocking everyone

Lesson 16planned

Non-Blocking I/O

17

Starting work and being told when it is done.

Three file reads overlapping instead of queueing

Lesson 17planned

Event Loop

18

The phases the runtime cycles through, and what runs in each.

Timers, poll, check, and close, drawn as a cycle

Lesson 18planned

Call Stack

19

The work happening right now, and why it must empty before anything else runs.

A callback that waits for a long function to finish

Lesson 19planned

Callback Queue

20

Where finished I/O waits for the stack to clear.

A completed read queued behind a busy loop

Lesson 20planned

Microtask Queue

21

The queue that drains completely between every other step.

Promise callbacks jumping ahead of a timer

Lesson 21planned

libuv

22

The C library behind the loop, and its thread pool.

Why four slow crypto calls run in parallel and a fifth waits

Lesson 22planned

Worker Threads

23

Where real parallelism fits in the architecture.

A second thread with its own event loop

Lesson 23planned

Node.js Process Model

24

One process, its memory, and scaling out with more of them.

One process per core behind a load balancer

Lesson 24planned
Module 3 of 1417 lessonsComing soon

Modules and NPM

Splitting code into files, and depending on other people

Node.js Modules

25

Every file is a module with its own scope.

A variable that does not leak between files

Lesson 25planned

CommonJS

26

The original Node module system, still everywhere.

Reading a CommonJS file from an older package

Lesson 26planned

require()

27

Synchronous loading, resolution rules, and the module cache.

A module that runs once however many times it is required

Lesson 27planned

module.exports

28

What a module hands back, and the exports shorthand trap.

Reassigning exports and exporting nothing

Lesson 28planned

ES Modules

29

The standard module system, and turning it on in Node.

"type": "module" and the .mjs extension

Lesson 29planned

import

30

Static and dynamic imports, and file extensions being required.

An import that fails for want of ".js"

Lesson 30planned

export

31

Named and default exports from an ES module.

A module with a small, deliberate public surface

Lesson 31planned

CommonJS vs ES Modules

32

The differences that bite - __dirname, top-level await, interop.

A package that one system can load and the other cannot

Lesson 32planned

Built-in Modules

33

What ships with Node, and the node: prefix.

node:fs against an npm package called fs

Lesson 33planned

NPM

34

The registry and the client, and what installing really does.

Tracing where a package lands on disk

Lesson 34planned

package.json

35

Every field that matters - scripts, engines, exports, type.

An exports map that hides internal files

Lesson 35planned

Dependencies

36

What your code needs to run in production.

A production install missing a package it needed

Lesson 36planned

Dev Dependencies

37

Tools needed only to build and test.

A test runner that should never reach a server

Lesson 37planned

Semantic Versioning

38

Major, minor, patch - and what ^ and ~ allow.

A caret range that pulled in a breaking change

Lesson 38planned

package-lock.json

39

Exact versions, committed, so every install is identical.

npm ci against npm install in a pipeline

Lesson 39planned

NPM Scripts

40

Naming the commands a project runs, and pre and post hooks.

dev, build, test, and start as the project contract

Lesson 40planned

npx

41

Running a package without installing it globally.

Scaffolding a project with a one-off command

Lesson 41planned
Module 4 of 1410 lessonsComing soon

Node.js Core Modules

The standard library that ships with every install

path

42

Building paths that work on every operating system.

A hard-coded slash that breaks on Windows

Lesson 42planned

os

43

CPU count, memory, and platform details.

Sizing a worker pool from the core count

Lesson 43planned

url

44

Parsing and building URLs with the WHATWG URL class.

Reading query parameters without string splitting

Lesson 44planned

events

45

EventEmitter - the pattern much of Node is built on.

A job queue that emits started, done, and failed

Lesson 45planned

util

46

promisify, inspect, and types - the useful few.

Turning a callback API into one you can await

Lesson 46planned

crypto

47

Hashing, random values, and what not to build yourself.

A secure random token for a password reset

Lesson 47planned

process

48

Arguments, exit codes, signals, and the current process.

Exiting with a non-zero code so a script fails a pipeline

Lesson 48planned

Environment Variables

49

process.env - reading configuration from outside the code.

A port that differs per environment

Lesson 49planned

child_process

50

Running other programs, and the shell-injection risk.

exec with user input, and the safer execFile

Lesson 50planned

buffer

51

Raw binary data, and encodings.

A UTF-8 string and its byte length disagreeing

Lesson 51planned
Module 5 of 1414 lessonsComing soon

File System and Streams

Reading, writing, and processing data too big for memory

File System Module

52

The three APIs - callback, sync, and promises - and which to use.

The same read written all three ways

Lesson 52planned

Reading Files

53

Reading text and binary, and handling a missing file.

A config file that may not exist yet

Lesson 53planned

Writing Files

54

Writing, appending, and writing atomically.

A crash mid-write leaving a half-written file

Lesson 54planned

Updating Files

55

Read, change, write - and the race when two do it at once.

Two processes updating one JSON file

Lesson 55planned

Deleting Files

56

Removing files and directories safely.

A recursive delete that needs a guard

Lesson 56planned

Synchronous vs Asynchronous File Operations

57

Sync is fine at startup and a disaster in a request handler.

A readFileSync freezing every other request

Lesson 57planned

Promises API

58

fs/promises with async/await, the modern default.

Reading a directory of files concurrently

Lesson 58planned

Buffers

59

Buffers as the unit of file I/O, and when to decode them.

A file read that returns bytes, not text

Lesson 59planned

Streams

60

Processing data piece by piece instead of all at once.

A 4 GB file handled in a few megabytes of memory

Lesson 60planned

Readable Streams

61

Data events, async iteration, and paused against flowing.

Reading a large log with for await

Lesson 61planned

Writable Streams

62

Writing in chunks, and backpressure.

A fast producer and a slow disk, handled correctly

Lesson 62planned

Transform Streams

63

Changing data as it flows through.

Uppercasing a file without loading it

Lesson 63planned

Piping

64

pipeline(), and why it beats pipe() for error handling.

Compressing a file in one line that cleans up on failure

Lesson 64planned

Large File Processing

65

Streams, lines, and batches, applied to a real file.

A CSV processor that validates and transforms a million rows

Lesson 65planned
Module 6 of 1416 lessonsComing soon

Asynchronous Node.js

Writing async code, and predicting when it runs

Synchronous vs Asynchronous

66

Blocking against non-blocking, in a server specifically.

One slow handler slowing every user

Lesson 66planned

Callbacks

67

Error-first callbacks, the original Node convention.

Reading the (err, data) signature correctly

Lesson 67planned

Callback Hell

68

Nesting, lost errors, and why the pattern had to change.

Four nested reads and an error nobody handles

Lesson 68planned

Promises

69

Values that arrive later, chained and flattened.

The same four reads, flat

Lesson 69planned

async/await

70

Promises that read top to bottom.

A sequential await that should have been parallel

Lesson 70planned

Error Handling

71

try/catch with await, and unhandled rejections crashing the process.

A forgotten await turning an error into a crash

Lesson 71planned

Promise.all

72

Running in parallel, and failing fast.

Three queries at once, one failure losing the rest

Lesson 72planned

Promise.allSettled

73

Every result, success or failure.

A batch job reporting exactly which items failed

Lesson 73planned

Promise.race

74

The first to settle wins - and building a timeout from it.

A request abandoned after two seconds

Lesson 74planned

Event Loop

75

Reading code and predicting the order it will actually run in.

A six-line puzzle, answered by reasoning rather than running

Lesson 75planned

Timers

76

What a timer guarantees - a minimum, never an exact time.

A 100 ms timer firing at 140 ms under load

Lesson 76planned

setTimeout

77

Delaying work, and setTimeout zero not meaning now.

A zero delay running after everything already queued

Lesson 77planned

setImmediate

78

Running after I/O, in the check phase.

setImmediate beating setTimeout inside an I/O callback

Lesson 78planned

process.nextTick

79

Before everything else - and starving the loop with it.

A recursive nextTick that stops I/O entirely

Lesson 79planned

Microtasks

80

Promise callbacks and queueMicrotask, and when they drain.

A microtask running before a timer due now

Lesson 80planned

Macrotasks

81

Timers, I/O, and immediates - one at a time between microtasks.

The full ordering of all five scheduling tools

Lesson 81planned
Module 7 of 1414 lessonsComing soon

HTTP and Web Servers

The protocol, and a server with no framework

HTTP Fundamentals

82

Request and response, over a connection, as text.

A raw HTTP request typed by hand

Lesson 82planned

HTTP Methods

83

GET, POST, PUT, PATCH, DELETE - and safety and idempotence.

Why a retried POST can charge a card twice

Lesson 83planned

HTTP Status Codes

84

What the classes mean - 2xx, 3xx, 4xx, 5xx.

A 200 with an error body, and why that is wrong

Lesson 84planned

HTTP Headers

85

Metadata about the message - content, caching, auth.

A missing Content-Type breaking a JSON client

Lesson 85planned

Request

86

The incoming request object - method, URL, headers, body stream.

Logging everything a request carries

Lesson 86planned

Response

87

Status, headers, body, and ending it exactly once.

A response never ended, and a client hanging

Lesson 87planned

Creating an HTTP Server

88

http.createServer with no framework at all.

A JSON endpoint in twelve lines

Lesson 88planned

Routing

89

Matching method and path by hand.

A router that shows exactly what Express saves you

Lesson 89planned

Query Parameters

90

Parsing the query string with URL.

A search endpoint reading page and limit

Lesson 90planned

Path Parameters

91

Extracting ids from the path yourself.

Matching /users/42 without a library

Lesson 91planned

Request Body

92

The body arrives as a stream, and must be collected.

Reading a POST body chunk by chunk

Lesson 92planned

JSON

93

Parsing input safely and serialising output.

Invalid JSON crashing a server that did not catch it

Lesson 93planned

Content Types

94

Telling the client what you sent, and checking what you got.

A form post that is not JSON

Lesson 94planned

HTTP Error Handling

95

Failing with the right status and a useful body.

An unexpected error becoming a clean 500

Lesson 95planned
Module 8 of 1416 lessonsComing soon

Express.js

The framework most Node APIs are built on

What is Express?

96

A thin layer over http - routing and middleware.

The Module 7 server rewritten in a third of the code

Lesson 96planned

Express Application

97

Creating the app, and separating it from listening.

An app exported without listening, so tests can use it

Lesson 97planned

Routes

98

Method and path handlers, and order mattering.

A catch-all route declared too early

Lesson 98planned

Route Parameters

99

req.params, and Express doing the matching for you.

/users/:id with the id already extracted

Lesson 99planned

Query Parameters

100

req.query, and every value arriving as a string.

A page number that is "2", not 2

Lesson 100planned

Request Body

101

Body-parsing middleware, and size limits.

A body that is undefined because no parser ran

Lesson 101planned

Middleware

102

Functions in a chain, and next().

A request passing through four middleware in order

Lesson 102planned

Custom Middleware

103

Writing your own for logging, timing, and auth.

A request-id middleware used by every log line

Lesson 103planned

Router

104

Grouping routes into mountable modules.

A users router mounted at /api/users

Lesson 104planned

Controllers

105

Keeping handlers thin, and HTTP out of business logic.

A handler that parses, calls a service, and responds

Lesson 105planned

Error Middleware

106

The four-argument handler, and one place for every error.

A central handler mapping errors to statuses

Lesson 106planned

Async Error Handling

107

Rejected promises in handlers, and Express 5 catching them.

An async throw that hangs a request in Express 4

Lesson 107planned

Static Files

108

Serving files, and caching headers for them.

A public folder with long-lived cache headers

Lesson 108planned

CORS

109

Configuring the cors middleware for the origins you allow.

A frontend on another port blocked, then allowed

Lesson 109planned

Request Validation

110

Validation middleware that rejects bad input before a handler runs.

A schema check returning 400 with field errors

Lesson 110planned

Express Project Structure

111

Routes, controllers, services, repositories - and why.

A layout where each layer has one job

Lesson 111planned
Module 9 of 1417 lessonsComing soon

REST API Development

Designing an API other people can use

REST Architecture

112

Resources, representations, and statelessness.

An RPC-style API redesigned around resources

Lesson 112planned

Resource Design

113

Nouns, nesting, and plural collection names.

/courses/12/lessons against /getLessonsForCourse

Lesson 113planned

GET

114

Reading collections and single resources, safely.

A list and a detail endpoint for one resource

Lesson 114planned

POST

115

Creating, and returning 201 with a Location.

A create endpoint that tells you where the new thing is

Lesson 115planned

PUT

116

Replacing a resource entirely, idempotently.

A PUT that wiped fields the client did not send

Lesson 116planned

PATCH

117

Partial updates, and which fields are allowed to change.

Updating one field without touching the rest

Lesson 117planned

DELETE

118

Removing, soft deletes, and 204.

A delete that can be undone

Lesson 118planned

HTTP Status Codes

119

Choosing the right code when designing an API.

400, 401, 403, 404, 409, and 422 each used correctly

Lesson 119planned

Pagination

120

Offset against cursor, and returning the next link.

A cursor that stays stable while rows are inserted

Lesson 120planned

Filtering

121

Filter parameters that map cleanly to queries.

?status=active&level=beginner

Lesson 121planned

Sorting

122

Sort parameters, allowed fields, and a stable tiebreaker.

?sort=-createdAt with a whitelist behind it

Lesson 122planned

Searching

123

Text search that stays fast, and when it needs its own index.

A LIKE query that works until the table grows

Lesson 123planned

API Validation

124

Validation errors as part of the API contract.

A consistent error shape clients can render

Lesson 124planned

API Error Handling

125

One error format across every endpoint.

Problem Details responses from a single handler

Lesson 125planned

API Response Standards

126

Envelopes, field naming, dates, and consistency.

Two endpoints that disagree about date formats

Lesson 126planned

API Documentation

127

Documentation developers will actually read.

An example request and response for every endpoint

Lesson 127planned

OpenAPI and Swagger

128

A machine-readable spec, and the tools it unlocks.

Interactive docs and a generated client from one file

Lesson 128planned
Module 10 of 1415 lessonsComing soon

Database Integration

PostgreSQL first, MongoDB as the alternative

SQL in depth →

Database Fundamentals

129

Relational against document, and choosing for the data.

The same course data modelled both ways

Lesson 129planned

Node.js and PostgreSQL

130

The pg driver, and running a first query.

Listing courses from a real table

Lesson 130planned

Node.js and MongoDB

131

The official driver, and where documents fit better.

An activity feed stored as documents

Lesson 131planned

Database Connection

132

Connecting once at startup, and failing loudly if you cannot.

A server that refuses to start without its database

Lesson 132planned

Connection Pooling

133

Reusing connections, and sizing the pool.

A pool exhausted by a leaked client

Lesson 133planned

CRUD Operations

134

Create, read, update, and delete in SQL from Node.

A users table with all four operations

Lesson 134planned

Transactions

135

All or nothing - and releasing the client on every path.

An enrollment and a payment that must both succeed

Lesson 135planned

SQL Injection

136

Parameterised queries, and never concatenating input.

A search box that dropped a table

Lesson 136planned

ORM Concepts

137

What an ORM does for you, and what it hides.

One ORM call and the several queries it really ran

Lesson 137planned

Prisma

138

Schema-first, type-safe access, and generated clients.

A schema file producing a typed client

Lesson 138planned

Sequelize

139

Model-first ORM, still common in existing code.

Reading and maintaining a Sequelize model

Lesson 139planned

Migrations

140

Versioned schema changes, applied the same way everywhere.

Adding a column without downtime

Lesson 140planned

Relationships

141

One-to-many, many-to-many, and loading them efficiently.

Courses with lessons without an N+1

Lesson 141planned

Database Error Handling

142

Unique violations, timeouts, and mapping them to HTTP.

A duplicate email returning 409 rather than 500

Lesson 142planned

Repository Pattern

143

Data access behind an interface, so services stay clean.

Swapping the database under a service that never noticed

Lesson 143planned
Module 11 of 1421 lessonsComing soon

Authentication and Security

Who the user is, what they may do, and keeping attackers out

Authentication vs Authorization

144

Who you are against what you may do.

A logged-in user who still gets a 403

Lesson 144planned

User Registration

145

Creating accounts, validating input, and duplicate emails.

A sign-up endpoint that does not leak who is registered

Lesson 145planned

Password Hashing

146

Why hashing, why slow, and why never encryption.

A leaked table of fast hashes cracked in minutes

Lesson 146planned

bcrypt

147

Salts, cost factors, and comparing safely.

Choosing a cost factor for your hardware

Lesson 147planned

Login

148

Verifying credentials without revealing which part was wrong.

One error message for a bad email and a bad password

Lesson 148planned

JWT

149

Signed claims - what they prove and what they do not.

A token that cannot be revoked before it expires

Lesson 149planned

Access Tokens

150

Short-lived tokens, verified on every request.

An auth middleware that sets req.user

Lesson 150planned

Refresh Tokens

151

Long-lived, stored server-side, and rotated on use.

Detecting a stolen refresh token by reuse

Lesson 151planned

Cookies

152

httpOnly, Secure, SameSite - each one earning its place.

A session cookie JavaScript cannot read

Lesson 152planned

Sessions

153

Server-side sessions, and when they beat tokens.

Logging a user out everywhere instantly

Lesson 153planned

Protected Routes

154

Requiring authentication, applied once per router.

A whole router guarded by one line

Lesson 154planned

RBAC

155

Roles mapped to permissions, checked on the server.

An admin-only route enforced by middleware

Lesson 155planned

Permissions

156

Finer than roles - and checking ownership of the resource.

A user editing only their own records

Lesson 156planned

CORS

157

What CORS protects, and the many things it does not.

Why a permissive CORS policy is not a vulnerability by itself

Lesson 157planned

Helmet

158

Security headers set sensibly in one line.

The headers Helmet adds, read one by one

Lesson 158planned

Rate Limiting

159

Slowing brute force and abuse, per user and per IP.

A login endpoint that locks out after repeated failures

Lesson 159planned

Input Validation

160

Validation as a security control, not just a courtesy.

Rejecting unexpected fields before they reach the database

Lesson 160planned

SQL Injection

161

Injection in the wider threat model - SQL, NoSQL, and commands.

A MongoDB query injected through a JSON body

Lesson 161planned

XSS

162

The server role in XSS - escaping and content security policy.

A stored comment that runs script in other browsers

Lesson 162planned

CSRF

163

Cookie authentication and forged requests.

SameSite and a token closing the hole

Lesson 163planned

Security Best Practices

164

The checklist worth running before every release.

An audit of a real API against the list

Lesson 164planned
Module 12 of 1420 lessonsComing soon

Production Node.js

Configuration, observability, scaling, and deployment

Node performance in depth →

Environment Configuration

165

One build, configured per environment from outside.

The same image running in staging and production

Lesson 165planned

.env

166

Local configuration files, and never committing them.

A .env.example that documents every variable

Lesson 166planned

Configuration Management

167

Validating configuration once, at startup, with types.

A missing variable failing at boot rather than at 2am

Lesson 167planned

Logging

168

Structured logs, levels, and what never to log.

A JSON log line you can search by request id

Lesson 168planned

Winston

169

A configurable logger with transports and formats.

Pretty logs in development, JSON in production

Lesson 169planned

Error Monitoring

170

Capturing errors with context and alerting on them.

An error report with the request that caused it

Lesson 170planned

Health Checks

171

Liveness against readiness, and what each should test.

A readiness check that fails while the database is down

Lesson 171planned

Graceful Shutdown

172

Finishing in-flight requests before exiting.

A deploy that drops no requests

Lesson 172planned

Process Management

173

Keeping a process alive, and restarting it when it dies.

A crash recovered from in under a second

Lesson 173planned

PM2

174

A process manager for servers without an orchestrator.

Running, restarting, and tailing logs on one VM

Lesson 174planned

Clustering

175

One process per core, sharing a port.

Using all eight cores instead of one

Lesson 175planned

Worker Threads

176

Moving CPU-bound work off the event loop in production.

Image resizing that no longer blocks the API

Lesson 176planned

Caching

177

What to cache, for how long, and invalidating it.

A slow endpoint served from cache in two milliseconds

Lesson 177planned

Redis

178

An in-memory store for caching, sessions, and rate limits.

A cache shared by every instance of the API

Lesson 178planned

Message Queues

179

Moving slow work out of the request path.

An email sent after the response, not before it

Lesson 179planned

RabbitMQ

180

Queues, exchanges, acknowledgements, and retries.

A worker that retries a failed job without losing it

Lesson 180planned

Dockerizing Node.js

181

Small, secure images with multi-stage builds.

An image that went from 1 GB to 150 MB

Lesson 181planned

Node.js in Kubernetes

182

Probes, resource limits, and shutdown signals in a cluster.

A pod killed mid-request, and the fix

Lesson 182planned

CI/CD

183

Lint, test, build, and deploy on every merge.

A pipeline that blocks a failing build from shipping

Lesson 183planned

Production Best Practices

184

The decisions worth making before launch, not after.

A pre-launch review of a real service

Lesson 184planned
Module 13 of 1412 lessonsComing soon

Testing Node.js

Its own module, not a footnote to production

Testing Fundamentals

185

What a test buys you, and the tests that buy nothing.

A test that breaks on every refactor and catches no bugs

Lesson 185planned

Unit Testing

186

Testing one unit in isolation, fast.

A pricing function tested at every boundary

Lesson 186planned

Jest and Vitest

187

Runners, matchers, and the node:test built-in.

The same test in all three

Lesson 187planned

Testing Services

188

Business logic tested without HTTP or a database.

A service tested against a fake repository

Lesson 188planned

Testing Controllers

189

Checking the translation between HTTP and services.

A controller that maps a service error to 404

Lesson 189planned

Mocking

190

Replacing what is slow or external - and not mocking too much.

A test so heavily mocked it tests nothing

Lesson 190planned

API Testing

191

Testing endpoints as a client would see them.

Status, headers, and body asserted together

Lesson 191planned

Supertest

192

Driving an Express app in tests without opening a port.

The exported app from lesson 97 paying off

Lesson 192planned

Integration Testing

193

Several layers together, where the real bugs are.

Register, log in, and fetch in one test

Lesson 193planned

Database Testing

194

A real database per run, and resetting it between tests.

Tests in a transaction that is rolled back

Lesson 194planned

Test Coverage

195

What coverage measures, and what it cannot.

100 per cent coverage and a bug still shipping

Lesson 195planned

Test Environment

196

Configuration, fixtures, and tests that run anywhere.

A suite that passes on a laptop and in CI alike

Lesson 196planned
Module 14 of 1410 lessonsComing soon

Real-World Project

A multi-tenant learning platform API

Architecture and Setup

197

Express, PostgreSQL, and Redis, with the layered src/ structure.

config, routes, controllers, services, repositories - agreed first

Lesson 197planned

Authentication

198

Registration, login, tokens, and refresh.

A full auth flow with rotated refresh tokens

Lesson 198planned

Users and Tenants

199

Every query scoped to a tenant, enforced below the service layer.

A repository that cannot forget the tenant id

Lesson 199planned

Roles and Permissions

200

Per-tenant roles, and middleware that enforces them.

The same user an admin in one tenant and a learner in another

Lesson 200planned

Courses, Modules, and Lessons

201

A three-level hierarchy with relationships loaded efficiently.

A course outline fetched in two queries, not two hundred

Lesson 201planned

Enrollments and Progress

202

Writes that must be correct under concurrency.

A lesson completed twice counted once

Lesson 202planned

Quizzes

203

Scoring on the server, never trusting the client.

A submission that cannot be tampered with

Lesson 203planned

Caching with Redis

204

Caching the hot reads and invalidating them correctly.

A course page cached until its content changes

Lesson 204planned

Testing the API

205

Integration tests across auth, tenancy, and progress.

A test proving one tenant cannot read another

Lesson 205planned

Deployment and Review

206

Dockerised, deployed, monitored, and reviewed against the plan.

The finished API, and what you would change next time

Lesson 206planned