SelfscribeDownloadOpen the app

Book club

Books, ratings and members linked together, so scores and averages work themselves out.

Interactive · Advanced · uses cards, totals, form, chart

Edit it in the playgroundRead the file

What it shows

Link tables together, so one table's totals come from another's rows.

What you learn

Records written as field: value lines, a column that picks from another table, a score averaged from linked rows, cards coloured by a column, a form that adds a row, a board and a chart of the same records, a list of meetings, a poll and a countdown.

Try this

  • Give Klara and the Sun five stars with the form under "Rate a book", and its score and that member's average both rise.
  • Click an option in the poll, and a tally mark is added to its line in the text.
examples/book-club.self · 226 lines
~~~ selfscribe
# Lesson: Link tables together, so one table's totals come from another's rows.
# You learn: records written as field: value lines, a column that picks from another table, a score averaged from linked rows, cards coloured by a column, a form that adds a row, a board and a chart of the same records, a list of meetings, a poll and a countdown.
# Try this: give Klara and the Sun five stars with the form under "Rate a book", and its score and that member's average both rise.
# Try this: click an option in the poll, and a tally mark is added to its line in the text.
# summary: Books, ratings and members linked together, so scores and averages work themselves out.
# category: apps
# tags: interactive, advanced, social
# uses: cards, totals, form, chart
use data
set title Book club
set style sans

# A book cover keeps its colours on a dark page, so cover and spine have no dark shade.
palette
  plum   #862e9c  dark #e599f7
  cover  #3b2463
  spine  #1f1336

# ---- "next …" under the title: when the club meets, in a quiet coloured line -------------
line   next _              -> p.bc-next  { font: 600 0.95em/1.5 var(--doc-font-ui); color: var(--plum); margin: -0.5em 0 1.4em }  as bc-next

# ---- "now label | title | author | note | when": the book we are reading, as its cover ---
line   now _               -> div.bc-now  split "|" span.bc-part  { display: grid; grid-template-columns: 1fr auto; column-gap: 2em; row-gap: 0.3em; align-items: center; margin: 0 0 2em; padding: 1.4em 1.8em 1.5em 2.2em; border-radius: 4px 14px 14px 4px; color: #fff; background: linear-gradient(135deg, var(--cover), var(--spine)); box-shadow: inset 12px 0 0 rgba(0, 0, 0, 0.25), 0 10px 24px rgba(20, 10, 40, 0.25) }  as bc-now
class bc-part:first-child  { font: 700 0.7em/1.4 var(--doc-font-ui); letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.7 }
class bc-part:nth-child(2)  { font: 600 2.3em/1.1 Georgia, "Times New Roman", serif; letter-spacing: -0.01em }
class bc-part:nth-child(3)  { font: italic 1.1em/1.4 Georgia, "Times New Roman", serif; opacity: 0.85; margin-bottom: 0.6em }
class bc-part:nth-child(4)  { font-size: 0.92em; opacity: 0.85 }
class bc-part:last-child  { grid-column: 2; grid-row: 1 / span 4; font: 600 1.15em/1.4 var(--doc-font-ui) }

# ---- "```events": one meeting per line, a date, a time, a title and "@ place" -----------
block  ``` events ... ```  -> events  verbatim
# ---- "```poll": a question, then options with their votes as tally marks -------------------
block  ``` poll ... ```    -> poll    verbatim
# ---- "((2026-12-03 Piranesi at Ana's))" in a sentence: how long until that date ---------
inline ((_))               -> until   verbatim
~~~
# The Long Shelf

next A book club of six. First Thursdays at 19:30, in someone's front room or the back of the Bell.

now Reading now | Piranesi | Susanna Clarke | Ana's pick for the dark evenings · 245 pages | ((2026-12-03 We meet at Ana's))

view: books as board by status columns title, author, score, picked sort score desc tone genre plain

## The meetings

```events
title: First Thursdays, 19:30
2026-11-05 19:30 Klara and the Sun @ Femi's, 3 Wren Close
2026-12-03 19:30 Piranesi @ Ana's, 14 Elm Row
2027-01-07 19:30 The book the vote picks @ The Bell, back room
2027-02-04 19:30 Book to be chosen in January @ Greta's, 27 Park Terrace
2027-03-04 19:30 Book to be chosen in February @ Joe's, 8 Mill Lane
```

## Vote for January's book

Click the one you would most like to read over the holidays. The vote closes at the December
meeting.

```poll
What shall we read for January?
- Small Things Like These, Claire Keegan |||
- The Dawn of Everything, Graeber and Wengrow ||
- Demon Copperhead, Barbara Kingsolver ||||
- Ariel, Sylvia Plath |
```

## Best first

view: books as table filter status = discussed columns title, author, picked, met, score sort score desc plain

## Rate a book

Everyone gives each book they finished up to five stars. Add yours here after a meeting.

view: ratings as form layout book | member, stars, note

```data ratings as table group book
book:choice(from books.title), member:choice(from members.name), stars:rating, note
The Dispossessed, Lin, 5, The best argument we have had all year
The Dispossessed, Rosa, 4,
The Dispossessed, Joe, 4, Slow first hundred pages
The Dispossessed, Ana, 5,
Middlemarch, Rosa, 5, Worth the whole summer
Middlemarch, Greta, 4,
Middlemarch, Femi, 3, Finished it on the bus to the meeting
Middlemarch, Joe, 4,
Braiding Sweetgrass, Greta, 5,
Braiding Sweetgrass, Ana, 4, The chapter on the pecans
Braiding Sweetgrass, Lin, 4,
Braiding Sweetgrass, Femi, 4,
The Overstory, Joe, 5, I looked at trees differently after
The Overstory, Rosa, 3, Too many people to follow
The Overstory, Greta, 4,
The Overstory, Lin, 3,
Klara and the Sun, Femi, 4,
Klara and the Sun, Ana, 4, Quietly sad
Klara and the Sun, Joe, 3,
Klara and the Sun, Rosa, 4,
```

view: ratings as chart hbar by book avg stars plain

## Every book

Each book is a few `field: value` lines, with a blank line between books. When the vote is in,
drag its card on the board at the top from shortlist to reading.

```data books records as table columns title, author, pages, genre, picked, met, score sort met
% title, author, pages:number, picked:choice(from members.name), status:choice(reading|discussed|shortlist), met:date, genre:choice(novel|science fiction|classic|nature|fantasy|history|poetry), score = avg(ratings.stars)
title: The Dispossessed
author: Ursula K. Le Guin
pages: 387
picked: Lin
status: discussed
met: 2026-06-04
genre: science fiction

title: Middlemarch
author: George Eliot
pages: 880
picked: Rosa
status: discussed
met: 2026-07-02
genre: classic

title: Braiding Sweetgrass
author: Robin Wall Kimmerer
pages: 391
picked: Greta
status: discussed
met: 2026-09-03
genre: nature

title: The Overstory
author: Richard Powers
pages: 502
picked: Joe
status: discussed
met: 2026-10-01
genre: novel

title: Klara and the Sun
author: Kazuo Ishiguro
pages: 303
picked: Femi
status: discussed
met: 2026-11-05
genre: science fiction

title: Piranesi
author: Susanna Clarke
pages: 245
picked: Ana
status: reading
met: 2026-12-03
genre: fantasy

title: Small Things Like These
author: Claire Keegan
pages: 116
status: shortlist
genre: novel

title: The Dawn of Everything
author: David Graeber and David Wengrow
pages: 704
status: shortlist
genre: history

title: Demon Copperhead
author: Barbara Kingsolver
pages: 560
status: shortlist
genre: novel

title: Ariel
author: Sylvia Plath
pages: 96
status: shortlist
genre: poetry
```

## Who we are

`picks` and `given` count each person's books and stars, and `average` is how kind they are
with them.

```data members as table
name, hosts:toggle, phone, picks = count(books), given = count(ratings), average = avg(ratings.stars)
Ana, yes, 07700 900311
Femi, yes, 07700 900482
Greta, yes, 07700 900127
Joe, yes, 07700 900764
Lin, no, 07700 900539
Rosa, no, 07700 900218
```

## How it's made

Three data blocks hold the club: the books, the ratings and the members. Nobody types a score.

- Each rating picks its book with `book:choice(from books.title)`, and its member the same way.
- A book's `score = avg(ratings.stars)` averages every rating that points at it. A member's
  `average` does the same for the stars they gave.
- The board at the top is `view: books as board by status … sort score desc tone genre plain`:
  best first, each card coloured by its genre, with no bar of buttons.
- The cover over it is one line, `now Reading now | Piranesi | …`, cut at each `|`. A `class`
  line sets each part in its own size.
- The books are written as records, a `field: value` per line, because a book has too much for
  one CSV line. The `%` line at the top names the fields and types them.

## Try it yourself

1. Under "Every book", change Piranesi's `status: reading` to `status: discussed`. On the
   board at the top it moves to the discussed column.
2. Add a rating `Piranesi, Ana, 5, Read it twice`. Piranesi gets a score, and Ana's `given`
   count goes up by one.
3. Add `picked: Joe` to Small Things Like These. Joe's `picks` count goes up.
4. Add `2027-04-01 19:30 Book to be chosen in March @ Lin's, 5 Orchard Way` to the meetings. A
   new meeting appears in April.

Next: *Habit tracker* keeps a log of days; *Club noticeboard* has more small pictures like the
poll and the countdown.