Article & guide
Read the full article
## A useful first web app Start with one job: keep track of what you want to build. This version lets you add a title, choose Planned, Building or Finished, and remove an entry. It uses browser storage rather than a server, so there is no account or cross-device sync. ## Components - A computer with a modern browser - A plain-text code editor - An optional local development server ## What the data means Each record contains a title and a status. Saved JSON is checked when the page loads: the app accepts only a bounded array of records with string titles and known status values. User titles are inserted with textContent rather than interpreted as HTML. This matters even in a small prototype: a project called <script> should stay text. Storage can be unavailable or cleared by the user or browser. The interface reports save failures and continues in memory. This is a personal prototype, not a backed-up project management service. Avoid putting passwords or sensitive information in it. ## Reference Browser storage behaviour: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API DOM creation: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement ## Cover note The AI-generated cover illustrates a project-planning workspace; it is not an exact screenshot of this starter interface.
1. Create the file
Save the complete example below as index.html using a plain-text editor. Open it in a browser. For consistent origin-based storage, serve the folder from a local development server; file:// storage behaviour varies between browsers.
2. Add the interface and behaviour
```html <!doctype html> <html lang="en"><meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>My project tracker</title> <style> body{max-width:42rem;margin:3rem auto;padding:1rem;background:#f6f0e3;color:#222;font:16px system-ui} input,button,select{font:inherit;padding:.6rem}li{margin:1rem 0;display:flex;gap:.6rem;align-items:center;flex-wrap:wrap}li span{flex:1;overflow-wrap:anywhere} </style> <h1>My project tracker</h1> <form id="form"><label for="title">Next project</label> <input id="title" required maxlength="120"><button>Add project</button></form> <p id="notice" role="status"></p><ul id="list"></ul> <script> const key = 'lwr-projects-v1'; const form = document.querySelector('#form'); const input = document.querySelector('#title'); const list = document.querySelector('#list'); const notice = document.querySelector('#notice'); const states = ['Planned', 'Building', 'Finished']; let tasks = []; try { const saved = JSON.parse(localStorage.getItem(key) || '[]'); if (Array.isArray(saved)) tasks = saved.filter(t => t && typeof t.title === 'string' && t.title.length <= 120 && states.includes(t.state)).slice(0, 100); } catch { notice.textContent = 'Saved projects could not be loaded.'; } function persist() { try { localStorage.setItem(key, JSON.stringify(tasks)); notice.textContent = 'Saved in this browser.'; } catch { notice.textContent = 'Storage unavailable. Changes last only while this page stays open.'; } } function render() { list.replaceChildren(); tasks.forEach((task, index) => { const row = document.createElement('li'); const title = document.createElement('span'); title.textContent = task.title; const select = document.createElement('select'); select.setAttribute('aria-label', 'Status for ' + task.title); states.forEach(state => { const option = document.createElement('option'); option.value = state; option.textContent = state; select.append(option); }); select.value = task.state; select.onchange = () => { task.state = select.value; persist(); }; const remove = document.createElement('button'); remove.textContent = 'Remove'; remove.setAttribute('aria-label', 'Remove ' + task.title); remove.onclick = () => { tasks.splice(index, 1); persist(); render(); }; row.append(title, select, remove); list.append(row); }); } form.onsubmit = event => { event.preventDefault(); const title = input.value.trim(); if (!title || title.length > 120 || tasks.length >= 100) { notice.textContent = 'Use 1–120 characters and at most 100 projects.'; return; } tasks.push({title, state: 'Planned'}); persist(); render(); input.value = ''; input.focus(); }; render(); </script></html> ```
3. Check the main journey
Add a project, change its status and refresh the page on the same origin. Remove it and refresh again. Try a blank title, a 120-character title and a title containing angle brackets. Confirm they behave as described without executing markup.
4. Test the limits
Try private browsing or blocked storage and watch the status message. Check keyboard operation and a narrow mobile viewport. Before sharing widely, add export/import and a recovery or undo path for deletion. A future shared version needs a backend with server-side validation and ownership checks.