Ga naar inhoud

Les 127 · Projects

Final project: build an accessible tool library app

Build a responsive, accessible tool library app with HTML, CSS, JavaScript, React, TypeScript and Git, using milestones, live checkpoints and a rubric.

The Maple Row Tool Library is a made-up neighborhood club. Members borrow drills, ladders and sewing machines instead of buying them. Today the list lives on a paper sheet by the door, so people walk over only to find that the tool they wanted is already out. The volunteers ask you for a small web app that works on a phone and on a laptop.

By the end, you will have a React and TypeScript app where a visitor can search the tools, filter them, borrow one with a short form and return it. It will work with only a keyboard, fit a narrow screen and have a Git history that explains how you built it. All names and data are invented.

This is the last step of the Front-End Developer path, so it combines all six tutorials. The checkpoints on this page let you try individual ideas in your browser. The site cannot grade your whole project. You build and judge that on your own computer, with the rubric near the end.

What you need first

Work through these tutorials, or review the parts you have forgotten:

  • HTML for structure, forms and meaning.
  • CSS for responsive layout and visible focus styles.
  • JavaScript for data, events and modules.
  • Git for commits and branches.
  • React for components, state and effects.
  • TypeScript for types that describe your data.

On your computer you also need Node.js, a code editor, Git and a modern browser.

The brief

  1. The app shows at least eight tools. Each has an id, a name, a category (garden, repair or craft) and a borrower, who is either a name or nobody.
  2. A visitor can search by name and filter by category. Both work together.
  3. The page says how many tools match, and shows a helpful message when none do.
  4. Borrowing needs a borrower name and a number of days from 1 to 14. Invalid input shows a clear message next to the field.
  5. A borrowed tool cannot be borrowed again. It can be returned.
  6. Loans survive a page reload. Damaged or missing saved data must not crash the app.
  7. Every action works with a keyboard, focus is always visible, and every field has a label.
  8. The layout works at 320 pixels wide without sideways scrolling.
  9. The code is TypeScript in strict mode, with no any.
  10. The project is in Git with small, descriptive commits and a README.

Milestones

1. Set up the project and the history

Create a React and TypeScript project with your build tool of choice, such as Vite. Initialize Git, check that .gitignore excludes node_modules and build output, and make your first commit. Write a README with one paragraph about the app and the commands to run it.

Why: a clean start lets you undo any later experiment. From here on, finish each milestone on a short branch and merge it when it works.

Hint: run git status before your first commit and read every file name in it.

Done when: the starter app runs locally and git log shows a commit without installed packages.

2. Build the page with meaningful HTML

Before adding behavior, write the structure with fixed data: one h1, a main element, a labeled search field, a labeled category menu, a status line and a list of tools. Give each tool a heading and a button whose name says which tool it affects. Twelve buttons that all say "Borrow" are hard to tell apart in a screen reader's list of buttons.

Why: correct elements give you keyboard support and accessible names with little extra work. Adding them later usually means rewriting components.

Hint: a div with a click handler is not a button. Use button.

Done when: you can reach every control with the Tab key, in an order that matches the screen.

3. Make it responsive

Style the list as a grid that adds columns when there is room. Start with the narrow layout. Use relative units, keep buttons large enough to tap and never remove the focus outline without adding an equally clear one. Do not show availability by color alone. Write the words "Available" or "Borrowed by Sam".

Why: many members will check the list on a phone while standing in the shed.

Hint: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)) gives you a flexible grid without media queries.

Done when: at 320 pixels wide, and at 200% browser zoom, nothing is cut off.

Checkpoint 1. This preview shows a searchable, responsive list. Resize it, use only your keyboard, then add a category filter that works together with the search.

Searchable tool list

The code uses textContent, so text typed by a person is never treated as HTML. React escapes text in the same spirit when you render it in JSX.

4. Model state with React and TypeScript

Describe your data before writing components:

TypeScript
type Category = "garden" | "repair" | "craft";

type Tool = {
  id: string;
  name: string;
  category: Category;
  loan: { borrower: string; days: number } | null;
};

type Action =
  | { type: "borrow"; id: string; borrower: string; days: number }
  | { type: "return"; id: string };

Keep the tool array in one place, and change it with a reducer used by useReducer. Keep the search text and category in separate state. Calculate the visible tools and the match count during rendering. Do not store them as state.

Why: one source of truth cannot disagree with itself. A reducer is also a plain function, so you can test it without a browser.

Hint: use each tool's id as its React key, never its position in a filtered list.

Done when: borrowing and returning work, filters still behave, and the type check passes.

Checkpoint 2. The reducer below is incomplete. It lets a second person take a borrowed tool and accepts bad input. Fix it until all five lines say PASS. Return the original array when an action is not allowed, and never change the old objects.

JS Test the loan rules

Press Run (or Ctrl + Enter) to see the console output here.

No output.

5. Add the borrow form and saving

Build the form with real form, label and button elements. When submission fails, keep what the person typed, show a message beside the field, connect it with aria-describedby, set aria-invalid and move focus to the first invalid field. After success, announce the result in a status region that is already on the page. If a control that had focus disappears, move focus somewhere sensible.

Then save loans in localStorage. Treat what you read back as unknown. TypeScript types disappear when the code runs, so a type assertion cannot protect you from broken data. Parse inside try, check the shape and fall back to your starting data. Writing can fail too, so wrap it as well.

Why: forms and saved data are where real users find problems that your normal clicks never reach.

Hint: to avoid overwriting saved loans on the first render, read them in the initial-state function of your reducer.

Done when: loans survive a reload, and typing nonsense into the stored value still gives you a working page.

Checkpoint 3. Submit this form empty with the Enter key. Check where focus goes. Then add a second field for the number of days and give it the same treatment. Previews here cannot use browser storage, so test saving in your own project.

A form that explains its errors

6. Test, review and publish

Write tests for the reducer and the saved-data check first, since they hold your rules. Add a few component tests that find elements by role and label. Then test by hand: keyboard only, 320 pixels, 200% zoom and, if you can, a screen reader. Run an automated accessibility checker too. It finds some problems, not all of them. Run the production build and fix every type error.

Why: tests protect your rules, while manual checks show how the app feels to use.

Hint: ask someone to borrow a ladder without any instructions from you. Watch silently.

Done when: tests and build pass from a fresh clone of your repository. Publishing it online is optional. If you do, use only invented names, and remember that localStorage is private to one browser, so it cannot share loans between members.

Check your work

Criterion What good looks like
Features All requirements work, including empty results and repeat borrowing
Accessibility Keyboard use works, focus is visible and managed, fields and buttons have clear names
Responsive design No sideways scrolling or hidden content at 320 pixels or 200% zoom
React One source of truth, derived values calculated, stable keys, no state mutation
TypeScript Strict mode passes, no any, unknown data checked while the app runs
Resilience Broken or blocked storage leaves a usable page
Git and README Small commits with clear messages; a fresh clone runs by following the README

Common mistakes

Do not copy the filtered list into state and update it with an effect. It adds an extra render and gives the two lists a chance to disagree. Calculate it from the tools, the search text and the category.

Do not add ARIA to repair the wrong element. A native button, input or select already has behavior that a role alone does not provide.

Take it further

  • Add due dates and mark overdue loans with text. Pass today's date into your function so tests stay predictable.
  • Add a page for each tool with a router, and set a useful document title.
  • Replace the fixed data with a JSON file loaded by fetch, with loading, error and retry states.
  • Run your type check and tests automatically on each push.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. Which value should you usually not store as React state?

    You can calculate the matches from the tools and the filters, so storing them creates a second copy that can become wrong.
  2. 2. Why check saved data while the app runs, even in TypeScript?

    Types help while you write and build. Data from storage or a server can have any shape.
  3. 3. What should happen when a person submits the form with an empty name?

    Text explains the problem without relying on color, the link makes it available to assistive tools, and focus shows where to fix it.
  4. 4. What does a passing automated accessibility check prove?

    Automated tools cover only part of accessibility. You still need manual testing.
  5. 5. Which key is best for a tool in a filtered React list?

    A stable id keeps each item's identity when filtering changes positions.

Summary

  • Start with meaningful HTML and a narrow layout, then add behavior.
  • Keep one source of truth and calculate everything you can from it.
  • Put loan rules in a pure reducer that you can test.
  • Use TypeScript for your own code, and runtime checks for outside data.
  • Give forms visible errors, sensible focus and announced results.
  • Judge the finished project with the rubric, manual tests and a fresh clone.

Back to the path: Front-End Developer learning path

Volg je voortgang

Maak een gratis account om lessen af te vinken en op elk apparaat verder te gaan waar je gebleven was.