DEV Community

Cover image for Why Your Brain Does That: behavior explanations on Next.js
kyisaiah47
kyisaiah47

Posted on Originally published at thecompound.tech

Why Your Brain Does That: behavior explanations on Next.js

whyyourbrain.thecompound.tech

Why Your Brain Does That is a searchable index of named experiences and the reasons behind them, built on Next.js and React. People use it to find a sentence about something they do, then read the explanation on its own entry page.

The problem

A short clip can explain why someone forgets why they entered a room, then disappear from view. Why Your Brain Does That keeps those spoken lines on pages that wait.

The doorway example makes the boundary clear. The entry says the forgetting is real, while a 2021 study across four experiments found no reliable doorway effect.

The site also states what it does not do. It does not tell anyone what they have, and it directs larger problems toward a person rather than an archive.

The front page shows the searchable index and its image wall.

How it works

The product keeps a searchable corpus of titles, spoken lines, captions, images, categories and source findings. A search keeps every entry in place, enlarges matching entries to the width they earned, and reduces the rest to their smallest width.

  1. You type a word, a room you were in, or a thing you do into the search field. SearchField trims the value, encodes it, and routes it to the whole index with a q parameter.

  2. The Next.js route reads the query and maps every entry into a tile with its title, still, category, line count and searchable text.

  3. SheetBody lowercases the query, checks each tile's hay string, and records matching slugs without removing the other tiles.

  4. The live archive layer reads published rows from Supabase, merges them over the committed corpus, and orders the result by publication time.

The app uses Next.js 15.5.25, React 19.1.1, TypeScript, @supabase/supabase-js and posthog-js. The committed corpus comes from phenomena.json, and the derive script writes the rendered corpus to generated/corpus.json.

The whole index keeps every tile while matching entries receive the accent and their earned width.

A worked example

Search for procrastination. The sheet keeps the whole index and marks the entry titled "procrastination isn't laziness. it's your brain avoiding a feeling" as a match.

Opening that entry returns four spoken lines. The second line names boredom, judgment and the chance of failing as emotions attached to the task. The page also carries the entry's still and its caption, "it was never about discipline."

The entry page shows the title, spoken explanation, still and caption.

How it compares

The School of Life publishes articles organised around themes such as Calm, Relationships, Self-Knowledge and Work. Pick it when you want a longer article library organised by subject rather than a searchable entry with spoken lines and a still.

Headspace provides guided meditations, expert-led exercises, sleep content and AI-powered support. Its listed plans include a 14-day trial, $69.99 annual access and $12.99 monthly access. Pick it when you want guided practice for stress, sleep or mindfulness instead of an explanation archive.

Preveal moves through Notice, Understand and Consider What Comes Next, then keeps reflection history in local storage without requiring an account. Pick it when you want to reflect on a body signal and choose your own next action. Why Your Brain Does That gives you a named experience and its explanation instead.

Why Your Brain Does That keeps the input small and the output fixed: a phrase goes into the index, matching entries stay visible, and an entry page holds the explanation.

Limits

Why Your Brain Does That is not therapy, diagnosis or a personal assessment. It does not assign a label to a body signal, and it does not replace professional help.

The site also does not promise that every explanation is established. Its register includes findings where a source differed from the entry, including the doorway explanation.

Try it

Type a word you remember, a room you were in, or a thing you do. Then choose Ask the index.

whyyourbrain.thecompound.tech

Top comments (0)