Action for Happiness
Log in

View source on GitHub →

Database schema

The schema is split across five focused docs — one per domain. Pick the one closest to what you're working on; each starts with its own ER diagram and table descriptions, and links out to neighbouring domains where the relationships cross over.

Domains

  • theme — top-level subject areas; the spine that courses, forums, and expert videos hang off.
  • user — accounts, the action log, and the champion pipeline.
  • course — curriculum: courses, modules, content/question blocks, and learner answers.
  • cohort — reusable groups and per-learner enrollments that bind users to courses.
  • nudge — interventions: messages, schedules, and the delivery log.
  • recipe — named sequences of nudges + the audience they target (group sends; one-off API sends bypass the recipe).

Full ER diagram

Open questions and roadmap

Big forks in the road, schema TODOs, and features the current model doesn't yet support. Discussion items — not commitments.

Features for retention (not currently modeled)

  • Gamification. Badges that reward interaction with themes.
  • Wellbeing assessments. Pre/post survey with a profile chart showing change. Each assessment can trigger its own journey:
    • Low score → "what / why / take action like this" path.
    • High score → "reflect on the main mover" path.
  • Accountability buddies / small groups.
    • Mutual visibility into actions each person has taken.
    • Peer-to-peer nudges.
    • Individual score plus a shared group/pair score, so dropping off hurts the group too — not just you.

Forks in the road

Theme membership cadence — evergreen or time-based?

  • Idea: start evergreen with optional rolling waves. Promote an enrollment time (e.g. a podcast-release date) but don't enforce it; the cohort exists, the user can join any time.

Nudge triggers — action-based, scheduled, or both?

  • Idea: support both. Action-based examples: "finished watching a video", "inactive for 2 weeks". Scheduled: "once a week".
  • Cost: more nudges become driven by external code — e.g. a Sentry-style event hits our trigger_type=webhook endpoint. Need: client code aligned with USER_ACTION.action_type semantics, cascade schema updates, dedupe duplicate events for the same user.

How do themes relate to each other?

  • Idea: a "year of transformation" arc — either 4 themes (one per season) or 12 themes (one per month). Would need an ordering/grouping concept the schema doesn't have today.

Schema TODOs

Question types are limited. QUESTION_BLOCK.format supports only freeform and multiple_choice today. That's fine for MVP, but it doesn't yet handle:

  • multiple select (pick many)
  • scale / rating questions
  • reflection prompts
  • assessments
  • scored surveys
  • branching questions
  • file uploads
  • ordered answers (ranking)
  • matrix questions