Web Development
Build from HTML, CSS and JavaScript to frontend, backend and full-stack concepts. Understand MERN and MEAN through one practical project.
A website is a set of documents and behaviours delivered to a browser. Start with something small enough to understand from the first request to the last rendered element.
This sequence builds a Resource Shelf: a page that displays useful learning links and filters them by topic. The first version needs only HTML, CSS and JavaScript; a backend is a later decision with clear responsibilities.
Before You Start
- A text editor, a browser and basic file management.
- No framework, hosting account or paid tool is needed for the first version.
YOUR PRACTICAL PROJECT
Build Your Resource Shelf
Build Resource Shelf from three plain files into a responsive, searchable page with a local add-resource form, remembered filter preferences, JSON loading and an optional read-only Node API. Keep a working version at every stage; no paid services or framework are required.
SECTION 01
Understand the Browser and Server
The browser requests a URL, receives a response and interprets its content. HTML provides structure, CSS controls presentation and JavaScript adds behaviour. A static website can deliver complete useful pages without generating a new page for each request. A server application can produce responses based on stored data, identity and business rules.
Frontend work focuses on what people interact with in the browser. Backend work focuses on server-side behaviour, persistence and access control. Full-stack work connects both. These are responsibilities rather than promises that one person must master every tool immediately.
Follow one action through the system: a visitor selects Cybersecurity, the browser reads the selection, JavaScript updates the list and the screen reader receives the result count. No server request is necessary for that filter. Later, fetching a JSON list adds a server conversation. Separating these two actions prevents a common beginner mistake: assuming every click needs a backend or that JavaScript in the browser can safely control database permissions.
Describe the Product Before Coding
# Resource Shelf
Audience: a beginner choosing one learning resource
Core task: search by title and filter by topic
Content: title, HTTPS link and topic
Baseline: readable links without JavaScript
Enhancements: local additions, remembered filters, JSON loading
Success: keyboard and mobile users can complete the core taskExpected Result
Save as README.md. This is the project brief that later tests will refer to.
Build Your Project · Step 1
Write a short brief: “Visitors can read resource titles, follow links and filter by topic without an account.” List the three behaviours you will test.
- Create a resource-shelf folder and save the brief.
- Sketch the heading, filters, result count and list on paper.
- Write which features need only the browser and which would need a shared server.
Keep This Deliverable
A short brief and a labelled interface sketch.
Common Mistakes and Fixes
- If the project feels too broad, keep the first release to browsing and filtering. Accounts and moderation are later architecture decisions.
Check Your Understanding
Which parts of filtering can happen without a new server request?
Reveal the explanation
HTML communicates structure, CSS presentation and JavaScript behaviour. A frontend can filter existing content without asking a server to regenerate the page.
Useful Links for This Step
SECTION 02
Set Up Files, Preview and Version Control
Use a simple folder so the browser’s file requests are easy to understand. Put public files inside public and keep README and later server code outside it. A local HTTP preview behaves more like hosting than opening a file directly; browser storage and fetch have important origin rules. Serve only the dedicated public directory.
Use an editor to create the three empty files shown below, then fill them in during the next steps. Python provides the initial preview; if you do not have Python, the official installation guide is linked. Git is useful for checkpoints but is not needed to make the first page render. Commit intentional project files, not environment secrets or unrelated directories.
Initial Folder Layout
resource-shelf/
README.md
public/
index.html
styles.css
app.jsExpected Result
Create these files with your editor. The subsequent HTML, CSS and JavaScript examples replace each file’s contents in order.
Start the Static Preview
cd resource-shelf/public
python3 -m http.server 8000 --bind 127.0.0.1Expected Result
Run from the directory containing resource-shelf. On Windows use py instead of python3. Open http://127.0.0.1:8000/ after adding the HTML; stop with Ctrl+C.
Record a Local Checkpoint
git init
git add README.md public
git commit -m "Start Resource Shelf"Expected Result
Run from resource-shelf after the first working page exists. Git may request your locally configured author identity. These commands create a local commit and do not publish anything.
Build Your Project · Step 2
Set up a repeatable edit-refresh-inspect loop.
- Create the folder tree and keep the server terminal open.
- Open browser developer tools and find Console and Network.
- Record the preview command and expected URL in README.
Keep This Deliverable
A project folder with a reproducible preview workflow.
Common Mistakes and Fixes
- A missing file in Network usually points to a wrong name or directory. Case differences can work on one OS and fail on a case-sensitive host.
Check Your Understanding
Why keep server code outside the static public directory?
Reveal the explanation
Static hosting serves files directly. Keeping private implementation and configuration outside the document root avoids making them downloadable by mistake.
Useful Links for This Step
SECTION 03
Build the Meaning with HTML
Semantic elements communicate purpose to browsers and assistive technology. Use one clear page heading, main for the central content, a real label for the filter and links for navigation. A button performs an action; an anchor takes the reader somewhere. Meaningful text makes the page usable even before CSS is added.
Create index.html in a new project folder. Start with two resources and two topic values. Keeping the data small makes it easier to spot mismatched labels or broken links. The page should already be useful when JavaScript is unavailable.
Replace public/index.html with this complete document. The viewport declaration lets mobile browsers use the device width. Each filter has a persistent label, and the initial resources are real links in HTML. The status region is polite so updates can be announced without taking focus. The deferred script runs after the document has been parsed. CSS and JavaScript can be empty for now: the document must still make sense.
public/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A small shelf of web and security learning resources.">
<title>Resource Shelf</title>
<link rel="stylesheet" href="styles.css">
<script src="app.js" defer></script>
</head>
<body>
<main>
<h1>Resource Shelf</h1>
<p>Choose one resource and practise what it teaches.</p>
<label for="q">Search resources</label>
<input id="q" type="search">
<label for="topic">Topic</label>
<select id="topic">
<option value="all">All topics</option>
<option value="web">Web development</option>
<option value="security">Cybersecurity</option>
</select>
<p id="status" role="status">2 resources available</p>
<ul id="resources">
<li data-topic="web"><a href="https://developer.mozilla.org/en-US/docs/Learn_web_development">MDN Web Development</a></li>
<li data-topic="security"><a href="https://portswigger.net/web-security">PortSwigger Web Security</a></li>
</ul>
</main>
</body>
</html>Expected Result
The page has one heading, labelled controls, a status and two working resource links. The controls become functional in the JavaScript step.
Build Your Project · Step 3
Replace the page title with your own descriptive title and add a sentence explaining who the shelf is for. Keep the labels and topic values consistent.
- Load the document with CSS and JS still empty.
- Use Tab to reach each control and link.
- Rename a resource to a longer meaningful title and confirm the structure still works.
Keep This Deliverable
A readable, semantic baseline page.
Common Mistakes and Fixes
- If the browser displays raw tags, ensure the filename ends in .html and the server returns it as HTML.
Check Your Understanding
Why use a real label instead of only a placeholder?
Reveal the explanation
A real label gives the field a stable accessible name. A placeholder disappears during input and is not a substitute for a label.
Useful Links for This Step
SECTION 04
Add Layout without Breaking the Content
CSS selectors choose elements and declarations describe their presentation. The box model includes content, padding, borders and margins; border-box sizing makes dimensions easier to reason about. Start with a single column, readable spacing and a visible focus indicator. Add columns only when the available space supports them.
A responsive layout adapts to content and viewport size. Test a long link title, zoomed text and a narrow screen. Avoid fixed heights on content cards because translated text or enlarged fonts can need more room. A contained outer width can organise the page without adding a second cap that unnecessarily squeezes paragraphs.
Replace public/styles.css with a small layout rather than styling every element separately. The list starts as a responsive grid; min(100%, 18rem) prevents its minimum column size from exceeding a narrow parent. The hidden rule is deliberate: grid display rules must not accidentally reveal filtered items. Focus remains visible for keyboard users, and overflow-wrap allows a long resource title to wrap without widening the page.
public/styles.css
* { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.6 system-ui, sans-serif; background: #f3f2ec; color: #17261f; }
main { max-width: 76rem; margin-inline: auto; padding: 1.5rem; }
label { display: block; margin-top: 1rem; }
input, select, button { font: inherit; padding: .65rem; max-width: 100%; }
input, select { width: 100%; }
a { color: #075e43; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #075e43; outline-offset: 3px; }
#resources { list-style: none; padding: 0; display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
#resources li { padding: 1rem; border: 1px solid #607568; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
form { border-block: 1px solid #607568; padding-block: 1rem; margin-block: 1.5rem; }Expected Result
The same page remains readable at a narrow viewport and on desktop. These styles belong to the learner’s Resource Shelf project; they do not change Hacktronian’s design.
Build Your Project · Step 4
Check the page at a phone-sized width and with browser zoom increased. Make one title deliberately long and confirm it stays inside its card.
- Check the page at 320px and a wider desktop width.
- Zoom text and verify that cards expand vertically.
- Tab through the page and inspect the focus indicator on every interactive element.
Keep This Deliverable
A responsive layout with no horizontal page overflow.
Common Mistakes and Fixes
- If hidden items remain visible, inspect whether another display declaration overrides hidden. If a card overflows, inspect its minimum width and unbroken content.
Check Your Understanding
Why avoid fixed heights for content cards?
Reveal the explanation
Fixed card heights assume a particular amount of text. Content-driven height lets longer titles, larger fonts and translations remain readable.
Useful Links for This Step
SECTION 05
Make the Filter Work
JavaScript listens for an event, reads the selected value and changes which list items are visible. The DOM is the browser’s representation of your document. Use textContent for ordinary text updates rather than building HTML from user input. The status element announces the new count without moving keyboard focus.
The function below reads existing HTML instead of replacing it with a framework. This gives you a working baseline and keeps the content available if the script fails. The browser runs a deferred script after parsing the document, so the elements exist when they are queried.
Use the same IDs as the HTML: q, topic, resources and status. The function queries current list items each time so resources added later are also filtered. It combines both conditions rather than allowing one control to overwrite the other. trim and toLowerCase make ordinary searches forgiving. Empty results produce a useful message while leaving the controls available for recovery.
public/app.js
const q = document.querySelector('#q');
const topic = document.querySelector('#topic');
const listEl = document.querySelector('#resources');
const statusEl = document.querySelector('#status');
function applyFilter() {
const query = q.value.trim().toLowerCase();
let count = 0;
for (const item of listEl.querySelectorAll('li')) {
const matchesTopic = topic.value === 'all' || item.dataset.topic === topic.value;
const matchesText = item.textContent.toLowerCase().includes(query);
item.hidden = !(matchesTopic && matchesText);
if (!item.hidden) count++;
}
statusEl.textContent = count ? count + ' resources found' : 'No resources match. Change the search or topic.';
}
q.addEventListener('input', applyFilter);
topic.addEventListener('change', applyFilter);
applyFilter();Expected Result
All Topics shows two items. Selecting Web Development shows MDN. Searching for an unmatched word shows the empty-state message; clearing it restores matching items.
Build Your Project · Step 5
Add a third resource with a valid data-topic and retest every filter. Temporarily misspell its topic value to see how a data error affects the UI.
- Test both filters together, including a mismatch such as topic=web and search=PortSwigger.
- Explain each variable and why the function increments count only for visible items.
- Temporarily break one selector, read the console error and restore it.
Keep This Deliverable
A working combined search and topic filter.
Common Mistakes and Fixes
- A null element usually means an ID mismatch or a script running before the HTML exists. Verify defer before adding arbitrary delays.
Check Your Understanding
How do the search and topic conditions combine?
Reveal the explanation
Both conditions must be true. A fresh item query also ensures later additions participate in the same filtering rules.
Useful Links for This Step
SECTION 06
Add a Resource with Validation and Safe Rendering
Forms turn several inputs into one intentional submission. Add the form below before the resources list, then load form.js after app.js with another deferred script tag. A submit event handles Enter as well as button clicks. Browser validation catches common mistakes; the JavaScript function also checks the shape and allows only HTTPS destinations.
Treat a title as text even when it contains angle brackets. createElement and textContent create the intended elements without interpreting the title as HTML. These checks improve this local interface but are not server-side security controls. New entries exist only in the current page until you build persistence. The later shared API must independently validate and authorise changes.
Add This Form Before the List
<form id="add-resource">
<h2>Add a Resource for This Session</h2>
<label for="title">Title</label>
<input id="title" name="title" maxlength="80" required>
<label for="url">HTTPS URL</label>
<input id="url" name="url" type="url" required>
<label for="new-topic">Resource topic</label>
<select id="new-topic" name="topic"><option value="web">Web development</option><option value="security">Cybersecurity</option></select>
<button type="submit">Add resource</button>
<p id="form-status" role="status"></p>
</form>Expected Result
Add <script src="form.js" defer></script> after the app.js tag in the head. Then create form.js with the following code.
public/form.js
function validResource(value) {
if (!value || typeof value.title !== 'string' || typeof value.url !== 'string') return false;
if (!value.title.trim() || value.title.trim().length > 80) return false;
if (!['web', 'security'].includes(value.topic)) return false;
try { const url = new URL(value.url); return url.protocol === 'https:' && !url.username && !url.password; }
catch { return false; }
}
function appendResource(value) {
if (!validResource(value)) throw new Error('Invalid resource');
const item = document.createElement('li');
item.dataset.topic = value.topic;
const link = document.createElement('a');
link.textContent = value.title.trim();
link.href = new URL(value.url).href;
item.append(link);
listEl.append(item);
}
const form = document.querySelector('#add-resource');
form.addEventListener('submit', event => {
event.preventDefault();
const value = Object.fromEntries(new FormData(form));
const message = document.querySelector('#form-status');
if (!validResource(value)) { message.textContent = 'Use a title of 1-80 characters, an HTTPS URL without credentials and a listed topic.'; return; }
appendResource(value);
applyFilter();
form.reset();
message.textContent = 'Added for this session. Your current filter may hide it.';
});Expected Result
Add an HTTPS learning link and see it join the filtered list. A title containing <strong> is displayed literally, not as bold HTML. An http: or javascript: URL is rejected.
Build Your Project · Step 6
Add controlled input handling to the same Resource Shelf.
- Try valid data, a blank title, an HTTP URL and a long title.
- Check keyboard submission and status feedback.
- Explain why client validation must be repeated by any future write API.
Keep This Deliverable
A local form with validated input, safe text rendering and recoverable errors.
Common Mistakes and Fixes
- If validResource is undefined in later steps, confirm form.js is loaded after app.js and before the script using it.
Check Your Understanding
Why does using textContent matter even after checking the title length?
Reveal the explanation
Length validation limits size, not HTML syntax. textContent keeps the value as text so markup-like input does not become executable page structure.
Useful Links for This Step
SECTION 07
Remember Preferences Without Storing Secrets
localStorage stores strings for one origin: scheme, host and port. It is useful for a topic preference, not a password vault or proof of identity. This project remembers the search and topic only. Session-added resources still disappear on reload; make that limitation explicit rather than implying a shared database.
Storage can fail or contain malformed data. Wrap access and parsing in try/catch, validate values after reading, and keep the page functional when persistence is unavailable. The two listeners below save only this project’s key. They do not clear other applications’ data. Add preferences.js as a deferred script after app.js; its calls reuse the same filter function.
public/preferences.js
const preferenceKey = 'resource-shelf-filters';
try {
const saved = JSON.parse(localStorage.getItem(preferenceKey) || 'null');
if (saved && typeof saved.q === 'string') q.value = saved.q.slice(0, 200);
if (saved && ['all', 'web', 'security'].includes(saved.topic)) topic.value = saved.topic;
} catch { /* Filtering still works if storage is unavailable. */ }
applyFilter();
function savePreferences() {
try { localStorage.setItem(preferenceKey, JSON.stringify({ q: q.value.slice(0, 200), topic: topic.value })); }
catch { /* Preferences are optional. */ }
}
q.addEventListener('input', savePreferences);
topic.addEventListener('change', savePreferences);Expected Result
Add a deferred preferences.js tag. Choose a topic and reload the same preview origin. The preference returns when storage is available; no account or server is involved.
Build Your Project · Step 7
Persist only the two harmless preferences.
- Verify reload persistence and explain why a different port starts with separate data.
- In developer tools, edit only resource-shelf-filters to invalid JSON and reload; the page should recover.
- Document that saved preferences are device-local and can be cleared by the browser.
Keep This Deliverable
A resilient preference feature and a clear storage note.
Common Mistakes and Fixes
- file: URLs do not provide a dependable shared storage model. Use the local HTTP origin and avoid treating private-mode persistence as guaranteed.
Check Your Understanding
Does localStorage prove that a user is an administrator?
Reveal the explanation
No. The user and page scripts can alter it. Authorisation must be established and enforced by the server for protected operations.
Useful Links for This Step
SECTION 08
Load JSON While Keeping a Useful Fallback
Fetching data is asynchronous: the page can be visible while a request is still pending. Keep the original HTML links until a replacement list has been fetched and validated. HTTP errors such as 404 do not automatically reject fetch, so check response.ok before parsing JSON. Network failure, HTTP failure and invalid JSON are distinct cases.
Create resources.json and remote.js in public. Add remote.js after form.js and preferences.js. The loader reuses validResource and appendResource, so fetched data receives the same shape and URL checks as form input. The static list remains available when loading fails. On success, filtering is reapplied to the new items. The loader temporarily disables the add form until the request settles, so a slow response cannot overwrite an item entered during loading. It re-enables the form after success or failure; existing HTML links remain usable throughout.
public/resources.json
[
{"title":"MDN Web Development","url":"https://developer.mozilla.org/en-US/docs/Learn_web_development","topic":"web"},
{"title":"PortSwigger Web Security","url":"https://portswigger.net/web-security","topic":"security"},
{"title":"OWASP Testing Guide","url":"https://wstg.owasp.org/stable/","topic":"security"}
]Expected Result
This seed data adds a third resource. Keep the keys and topic values consistent with the renderer.
public/remote.js
async function loadResources() {
const controls = [...form.elements];
controls.forEach(control => { control.disabled = true; });
form.setAttribute('aria-busy', 'true');
try {
const response = await fetch('resources.json');
if (!response.ok) throw new Error('HTTP ' + response.status);
const resources = await response.json();
if (!Array.isArray(resources) || !resources.every(validResource)) throw new Error('Invalid resource data');
listEl.replaceChildren();
resources.forEach(appendResource);
applyFilter();
} catch (error) {
document.querySelector('#form-status').textContent = 'Could not load the shared list. The HTML resources are still available.';
console.warn(error.message);
} finally {
controls.forEach(control => { control.disabled = false; });
form.removeAttribute('aria-busy');
}
}
loadResources();Expected Result
The list contains three items after a successful load. Rename the JSON file temporarily and reload: the two original HTML links remain and an understandable error appears.
Build Your Project · Step 8
Add a tested data-loading path without sacrificing the initial document.
- Confirm the request and Content-Type in the Network panel.
- Test successful JSON, a 404 and malformed JSON, restoring the valid file each time.
- Document that local additions are session-only and a fresh remote load replaces them.
Keep This Deliverable
A JSON-driven list with a working static fallback.
Common Mistakes and Fixes
- Unexpected token < often means the URL returned HTML rather than JSON. Check the response body and path instead of blindly changing JSON.parse.
Check Your Understanding
Why is try/catch alone insufficient for HTTP 404 handling with fetch?
Reveal the explanation
fetch normally resolves when it receives an HTTP response, even an error status. response.ok tells you whether the HTTP response was successful.
Useful Links for This Step
SECTION 09
Design a Backend Only When You Need One
Suppose visitors should submit resources and moderators should approve them. The application now needs shared storage, validation, identity and permissions. The browser should not hold a database password or decide whether someone is an administrator. A server validates the request and checks authorisation before changing data.
Describe the API contract before coding it: which route accepts which method, the shape of input, expected success and error responses, and who may perform the operation. Frontend validation improves usability, but the server must validate independently because requests can be sent without your UI.
Build a small read-only API before adding shared writes. Save server.mjs beside public, outside the served files. It uses only Node’s built-in modules and an explicit allowlist of static paths; requests cannot choose arbitrary files from your machine. Install a supported Node LTS release from the official site, stop the Python preview and run node server.mjs from resource-shelf. Open port 8001 and change remote.js to fetch /api/resources. The sample has no authentication, database or write endpoint and must remain a local teaching server.
server.mjs - Local Read-Only API
import { createServer } from 'node:http';
import { readFile } from 'node:fs/promises';
const publicRoot = new URL('./public/', import.meta.url);
const files = new Map([
['/', ['index.html', 'text/html; charset=utf-8']],
['/styles.css', ['styles.css', 'text/css; charset=utf-8']],
['/app.js', ['app.js', 'text/javascript; charset=utf-8']],
['/form.js', ['form.js', 'text/javascript; charset=utf-8']],
['/preferences.js', ['preferences.js', 'text/javascript; charset=utf-8']],
['/remote.js', ['remote.js', 'text/javascript; charset=utf-8']],
['/resources.json', ['resources.json', 'application/json']],
['/api/resources', ['resources.json', 'application/json']]
]);
const server = createServer(async (request, response) => {
if (request.method !== 'GET') {
response.writeHead(405, { Allow: 'GET', 'Content-Type': 'text/plain' });
response.end('Method not allowed'); return;
}
let pathname;
try { pathname = new URL(request.url, 'http://127.0.0.1').pathname; }
catch { response.writeHead(400); response.end('Invalid request URL'); return; }
const file = files.get(pathname);
if (!file) { response.writeHead(404); response.end('Not found'); return; }
try {
const body = await readFile(new URL(file[0], publicRoot));
response.writeHead(200, { 'Content-Type': file[1], 'X-Content-Type-Options': 'nosniff' });
response.end(body);
} catch { response.writeHead(500); response.end('Could not read the configured file'); }
});
server.listen(8001, '127.0.0.1', () => console.log('Resource Shelf: http://127.0.0.1:8001/'));Expected Result
node server.mjs serves the UI and GET /api/resources on the same origin. A POST returns 405 and an unknown path returns 404. Stop with Ctrl+C. Preferences on port 8000 do not automatically transfer to 8001.
Build Your Project · Step 9
Run the supplied read-only API and document its GET, 404 and 405 responses. Sketch a future write contract that validates title, URL and topic and checks moderator permissions; the current API does not implement that contract.
- Start the server and change only the fetch destination to /api/resources.
- Inspect the API JSON and the page response separately.
- Write a future POST contract covering authentication, input validation, moderation and error responses; do not assume the current form sends to the API.
Keep This Deliverable
A working local read-only API plus an honest future-write contract.
Common Mistakes and Fixes
- EADDRINUSE means another process uses the port. Stop your earlier copy rather than changing an unrelated service. The preview host must support Node to run this backend; a static host cannot.
Check Your Understanding
Why must a write API repeat validation and enforce authorisation?
Reveal the explanation
Client-side validation is editable and bypassable. Any write API must validate the data and the authenticated user’s permission independently.
Useful Links for This Step
SECTION 10
Frontend, Backend, MERN and MEAN
MERN combines MongoDB, Express, React and Node.js. MEAN replaces React with Angular. MongoDB is a document database, Express is a server framework, React is a UI library, Angular is an application framework and Node.js is a JavaScript runtime. A stack acronym describes a combination; it does not automatically provide secure authentication, accessible forms or correct data handling.
The Resource Shelf could also use a relational database, another backend language or no backend at all. Learn components, state, routing and data fetching when the interface becomes complex enough to benefit. Learn database constraints and transactions when the data requires them. Keep the user problem in view instead of choosing a stack because its name is popular.
Map your existing files to a possible stack before rewriting them: HTML and DOM rendering could become React components or Angular templates, applyFilter becomes derived UI state, the read-only route could become an Express handler, and resource records could move to a database. Each move should solve a real problem. A database also needs a schema, constraints, backups and queries; replacing JSON with MongoDB does not provide those decisions automatically.
- Frontend milestone: render resource data, filter it and handle loading, empty and error states accessibly.
- Backend milestone: validate requests, enforce permissions and return predictable responses.
- Database milestone: model relationships, avoid duplicate records and test updates and deletion.
- Full-stack milestone: follow one request through browser, server and storage, then diagnose a failure at each boundary.
Plan a Full-Stack Data Model
CREATE TABLE resources (
id INTEGER PRIMARY KEY,
title VARCHAR(80) NOT NULL,
url TEXT NOT NULL,
topic VARCHAR(20) NOT NULL CHECK (topic IN ('web', 'security')),
approved INTEGER NOT NULL DEFAULT 0 CHECK (approved IN (0, 1))
);Expected Result
This is a small SQLite-compatible design exercise, not a required change to the running Node sample. URL validation and authenticated moderator permissions still belong in server logic.
Build Your Project · Step 10
Write a one-paragraph technology decision for the current static shelf and another for a moderated shared shelf. Explain what changed in the requirements.
- Map frontend, backend and persistence responsibilities to your current files.
- Describe a MERN and a MEAN alternative without changing the learning objective.
- Write a decision note: which complexity would justify adopting a framework or database?
Keep This Deliverable
An architecture map and a schema sketch.
Common Mistakes and Fixes
- Do not install four technologies just to match an acronym. First identify the feature your current implementation cannot handle cleanly.
Check Your Understanding
What responsibility does each part of MERN or MEAN have?
Reveal the explanation
React and Angular address UI structure; Express handles server routes; MongoDB stores documents; Node runs server-side JavaScript. None makes access-control policy automatic.
Useful Links for This Step
SECTION 11
Test Accessibility, Security and Performance
Test behaviour that matters to the reader: the initial list, every filter, a long title, a missing script and keyboard-only use. Read the browser console and Network panel when something fails. A visual match is not enough if controls cannot be operated or content disappears on a phone.
For the shared version, use parameterised database queries, appropriate output encoding and server-side permission checks. Store secrets on the server, not in frontend bundles. Use HTTPS in production, restrict dependencies to what you need and keep them maintained. Measure performance before optimising: a small static page often needs fewer resources than a large application shell.
Test negative cases alongside the happy path: empty results, malformed JSON, blocked storage and an invalid resource URL. Keyboard testing checks whether controls can be reached and activated in a sensible order. Responsive testing checks the content, not just a device screenshot. In the form, a title that resembles HTML should appear as literal text. For the optional API, test unknown routes and unsupported methods. Keep a short test log with expected and actual results rather than marking a feature “done” because it worked once.
Exercise the Validation Boundary
console.assert(validResource({title:'Guide', url:'https://example.com/', topic:'web'}));
console.assert(!validResource({title:' ', url:'https://example.com/', topic:'web'}));
console.assert(!validResource({title:'Guide', url:'javascript:alert(1)', topic:'web'}));
console.assert(!validResource({title:'Guide', url:'https://example.com/', topic:'unknown'}));
console.assert(!validResource(null));
console.log('Validation checks completed');Expected Result
Run in the Resource Shelf developer console after form.js loads. Successful assertions are silent and the final message appears. The javascript: string is test data and is never executed.
Build Your Project · Step 11
Create a checklist with expected results. Test at narrow width and with keyboard navigation. Without JavaScript, the two original HTML links remain readable; filtering, fetching and adding resources require JavaScript. The add form is not a working server submission endpoint.
- Run the validation checks, then repeat keyboard and 320px layout checks.
- Test the missing-JSON fallback and reload after corrupted preference JSON.
- Use the Network panel to explain every local request; check that private project files are not served.
Keep This Deliverable
A repeatable quality checklist with actual results.
Common Mistakes and Fixes
- A console message saying completed does not override an earlier assertion failure. Read all output and fix the failed condition.
Check Your Understanding
What can a screenshot fail to prove about the page?
Reveal the explanation
Test failures tell you which requirement broke. A screenshot cannot prove keyboard access, input validation or correct API behaviour.
Useful Links for This Step
SECTION 12
Document, Publish and Keep Learning
Use Git to record small meaningful changes and keep a README with setup steps, features and known limits. A static host can serve the current project directly. A Node backend requires a runtime or compatible service; ordinary static hosting does not execute your server code simply because you upload a JavaScript file.
Before releasing, check internal links, document titles, descriptions, favicon, mobile layout and the actual hosting path. Keep development-only files and secrets out of the public folder. After release, use real feedback to choose the next feature. A complete small project is a stronger foundation than an unfinished collection of frameworks.
Choose a delivery mode explicitly. The static version uses resources.json and runs on ordinary static hosting; the API version fetches /api/resources and needs a Node process. Do not upload the API version to a static host and expect the route to appear. Keep an acceptance checklist and a known-limitations paragraph with the project. Useful next extensions include persistent resource storage, authenticated moderation and tests for cross-user permissions, but each should begin with a requirement and a small change.
Document the Finished Project
## Run
Static: serve public on loopback port 8000.
API: run node server.mjs and open loopback port 8001.
## Verify
Search and topic combine; keyboard focus is visible.
Invalid URLs are rejected; titles render as text.
JSON failure preserves the original links.
## Limits
New form entries last only for the current page session.
Preferences are local to this browser origin.
The API is read-only and has no database or authentication.Expected Result
Place this beside the project brief and update it to match the delivery mode you actually finished.
Build Your Project · Step 12
Finish the README and a screenshot of the working filter. Record whether you completed the static or optional API variant, its fetch URL and its limits. Make a final local checkpoint before planning accounts or shared write operations.
- Reproduce the project from a fresh folder using your own instructions.
- Choose the static or API variant and record its correct fetch URL.
- Create a final local Git checkpoint and list one well-scoped next feature.
Keep This Deliverable
A runnable Resource Shelf with setup, tests and known limitations.
Common Mistakes and Fixes
- A 404 for /api/resources on static hosting means the server route is absent. Use the JSON variant or an actual Node-capable runtime.
Check Your Understanding
What must another learner know to reproduce your finished project?
Reveal the explanation
The finished project is reproducible when another learner can start it, exercise the main features and understand its limits without guessing.
Useful Links for This Step
Check Your Finished Project
- The HTML remains useful without JavaScript.
- Both topic filters and the count work with keyboard input.
- Long text and zoom do not cause horizontal page overflow.
- You can explain where server-side validation and permissions belong.
- Follow the numbered project tasks and retain the named deliverable from each step.
- Record actual example results, failed cases and any environment-dependent tests you could not perform.
Access and Offline Reading
The complete guide is free to read here. Linked providers may require accounts or offer paid features; check their own access conditions.
The guide text, examples and illustrations are included in this website’s local copy. External documentation, platform accounts, downloads and hosted labs need an internet connection.
References and Further Learning
- MDN Learn Web Development
- React Learn
- Angular Tutorials
- Node.js Introduction
- Express Routing
- MongoDB Documentation
- OWASP Cheat Sheet Series
- MDN: Core Web Development
- Python: Local HTTP Server
- Git: Getting a Repository
- MDN: Label Element
- MDN: CSS Grid Layout
- MDN: DOM Introduction
- MDN: Form Validation
- MDN: localStorage
- MDN: Using Fetch
- Node.js: HTTP API
- Node.js Downloads
- React: Thinking in React
- Angular Essentials
- MongoDB Data Modeling
- MDN: Accessibility

