Blog / Build with AI /
Building a reading tracker with AI
Some people track books in a notebook. Some use an app that wants an account, a subscription and your reading goals. A simple page that you control sits comfortably between those, and it’s an excellent beginner build: the data is friendly, the features are obvious, and you’ll learn real skills along the way.
The finished thing in one line: a page where you add books with a status (want to read, reading, finished), a rating and notes, filter by status, and see how many you finished this year.
Why this is a good first or second project
- The data is easy to picture. A book has a title, an author and a status.
- There’s a natural order of features. Start with a list, then add statuses, ratings, filters and stats.
- You’ll use it. That keeps you motivated through the fiddly bits.
- It teaches records, filters and counts, which show up in almost every tool you’ll ever build.
Step 1: describe one book
Before you prompt, decide the fields:
| Field | Example | Notes |
|---|---|---|
| Title | “The Alchemist” | Required |
| Author | “Paulo Coelho” | Required |
| Status | want / reading / finished | A fixed list |
| Rating | 1 to 5 | Only for finished books |
| Date finished | 2026-07-06 | Optional |
| Notes | “Short and thoughtful” | Optional |
Keep the status as a fixed list rather than free text. Typing “Finnished” or “done” would otherwise create a mess when you filter.
Step 2: the first prompt
Build a reading tracker as a single HTML file with inline CSS and JavaScript, no libraries. A form collects title, author, status (a dropdown: want to read, reading, finished), rating (1 to 5, optional), date finished (optional) and notes. Store books in localStorage as an array of objects with a unique id. Show books in a list, newest added first, each with Edit and Delete buttons. Validate that title and author aren’t empty. Comment the code.
Two phrases to notice: “a unique id” and “a dropdown”. The id lets you edit or delete a specific book safely; matching by title would break the moment you own two editions. The dropdown keeps statuses consistent.
Step 3: understand the unique id
Ask the AI how it created the id. Common approaches:
const id = Date.now().toString();
That uses the current time in milliseconds. It’s simple and fine for one person adding books by hand. If you ever import many books at once, two could get the same id, so then you’d want something sturdier, such as crypto.randomUUID() in modern browsers.
When you delete or edit a book, the code finds it by id:
books = books.filter(book => book.id !== idToDelete);
That line says: keep every book except the one with this id. If you can read it, you understand deletion.
Step 4: filter by status
Now add the feature that makes the list useful:
Add three buttons above the list: All, Want to read, Reading, Finished. Clicking one shows only books with that status. Highlight the active button. Show the number of books in each group in brackets.
Filtering is a filter() call again, and the counts come from the same idea:
const counts = {
want: books.filter(b => b.status === 'want').length,
reading: books.filter(b => b.status === 'reading').length,
finished: books.filter(b => b.status === 'finished').length
};
Notice the pattern: filter, then count. Spreadsheets and databases work the same way, which makes this a good project for learning ideas you can reuse. If you’re curious, SQL basics for builders, learned with AI shows the same questions asked of a table.
Step 5: a small stats panel
Add a stats panel showing: books finished this year, average rating of finished books (one decimal place), and the number of books currently being read.
This is where edge cases bite. Test:
- No books at all: the average should show a dash, not “NaN”.
- Finished books with no rating: should they count in the average? Decide. The sensible rule is to ignore unrated books.
- A book finished last year: shouldn’t count toward this year.
- A finished book with no date: how should “this year” treat it? Maybe prompt for a date when someone sets the status to finished.
Telling the AI each decision makes the code predictable. “Ignore books with no rating when calculating the average” is a one-line rule that prevents wrong numbers.
Step 6: make it work on a phone
You’ll probably add books from your phone, standing in a bookshop or finishing a chapter in bed. Ask for:
- Large tap targets.
- A form that doesn’t zoom awkwardly on phones.
- The status dropdown near the top.
Test it on an actual phone instead of a shrunken desktop window.
Step 7: protect your data
A page like this stores books in the browser. Remember:
- Clearing site data erases the list.
- A different browser or device has its own, separate list.
- Add an export button that downloads the list as a JSON or CSV file, and an import button to bring it back.
Ask for it in a separate prompt, once the basics work: “Add an Export button that downloads the books as a JSON file, and an Import button that loads a file of the same shape. Validate the file before replacing existing data.” The validation matters. Without it, importing a wrong file wipes your list.
Ideas for later versions
- Search by title or author.
- Tags such as “fiction”, “tech”, “re-read”.
- A reading goal for the year, with a progress bar.
- Cover images, though these need an outside source, with its own terms and complications.
- A printable “books I read this year” list.
Pick one at a time, test, then continue. Prompt chaining: building in steps describes that rhythm.
What to watch
- Free text in data fields causes trouble later. Where you can, offer choices.
- HTML in notes. If you display notes using
innerHTML, a note containing markup could break the page. Ask fortextContentinstead, which treats notes as plain text. - Don’t add accounts and syncing until you’ve used the simple version for a while. They bring security and privacy work.
- Don’t ask the AI for book summaries as facts inside the tool without checking. It can invent details.
Key takeaways
- Define one record and a fixed list of statuses before prompting.
- Use unique ids for editing and deleting.
- Filter then count; handle empty and missing values.
- Add export and import to protect your data.
- Add features one at a time.
FAQ
Do I need a database?
Not for a personal tracker. Browser storage is enough, as long as you export backups.
Can I use a spreadsheet instead?
Of course. Build the page if you want the practice or a nicer phone experience.
Is it fine to share it with friends?
Each friend would have their own separate list in their own browser. Sharing a combined list needs a server.
Related reading
- Building a team holiday tracker with AI
- Building a countdown timer with AI
- Building a workout log with AI
What’s the one statistic about your reading you’d like to see at the end of the year?