Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Stranger Says

Decision fatigue is real. Stranger Says outsources your minor life choices to a random human on the internet. You type two options, a stranger clicks one, you live with it.

No AI. No algorithm. No recommendation engine quietly nudging you toward the "better" choice. Just one person deciding for another, in real time, with zero context and zero stakes.

Next.js TypeScript Tailwind CSS Supabase Hackathon

The rule that matters

This project has exactly one non-negotiable rule: nothing in this app is allowed to make a decision on its own. Every verdict comes from a real person clicking a real button. If you're extending this project, keep it that way. The entire point disappears the moment a machine starts picking sides.

How it works

There are two roles, and anyone can be either one at any time.

Route Who it's for What happens
/ask People with a decision to outsource Submit two options, wait, get a verdict pushed to your screen the moment a stranger picks one
/choose People willing to decide for a stranger Pull the oldest dilemma out of the queue, pick an option with zero context, move to the next one

The moment a choice is made, it's pushed back to the asker over a live WebSocket connection. No refreshing, no polling on their end, the verdict just appears.

sequenceDiagram
    participant Asker
    participant Queue
    participant Chooser

    Asker->>Queue: Submit dilemma (status: waiting)
    Chooser->>Queue: Open queue
    Queue->>Chooser: Claim oldest waiting dilemma (status: matched)
    Chooser->>Queue: Pick an option (status: resolved)
    Queue-->>Asker: Live update over Supabase Realtime
Loading

Tech stack

  • Next.js (App Router), TypeScript
  • Tailwind CSS v4, using the @theme directive for design tokens
  • Supabase for the database and for Realtime (Postgres change subscriptions over WebSockets)
  • Server Actions for all writes, no separate API layer

Getting started

Prerequisites

  • Node.js 18 or newer
  • pnpm
  • A Supabase project (the free tier is enough)

1. Install dependencies

pnpm install

2. Set up the database

In your Supabase project's SQL editor, run the schema below. Row Level Security is enabled with deliberately open policies, since this app has no login and no auth by design: anyone can ask, anyone can answer.

Show the setup SQL
create extension if not exists "pgcrypto";

create table dilemmas (
  id uuid primary key default gen_random_uuid(),
  option_a text not null,
  option_b text not null,
  status text not null default 'waiting'
    check (status in ('waiting', 'matched', 'resolved')),
  chosen_option text,
  created_at timestamptz not null default now()
);

alter table dilemmas enable row level security;

create policy "Anyone can submit a dilemma"
  on dilemmas for insert
  with check (true);

create policy "Anyone can read dilemmas"
  on dilemmas for select
  using (true);

create policy "Anyone can update a dilemma"
  on dilemmas for update
  using (true);

-- Required for the asker's screen to receive live updates
alter publication supabase_realtime add table dilemmas;

3. Configure environment variables

Copy the example file and fill in your Supabase project's URL and anon key, both found under Project Settings > API.

cp .env.example .env.local
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url_here
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key_here

4. Run it

pnpm dev

Open two browser windows: put one on /ask and submit a dilemma, put the other on /choose and answer it. Watch the first window update on its own.

Project structure

app/
├── layout.tsx       Root layout, fonts, page metadata
├── page.tsx         Landing page, pick a role
├── globals.css      Tailwind v4 theme and design tokens
├── actions.ts       Server actions: submit, claim, resolve
├── ask/
│   └── page.tsx     Submit a dilemma, wait, see the verdict
└── choose/
    └── page.tsx     Pull a dilemma from the queue, decide it

How a dilemma moves through the queue

A dilemma has three states: waiting, matched, resolved. The step from waiting to matched is the one that matters most, because it's the only place two people can collide. If two choosers open the queue at the same instant, both could be handed the same dilemma unless the claim is atomic.

The fix used here: fetch a handful of the oldest waiting dilemmas, then attempt to claim one at a time with a single-row conditional update, id matches and status is still waiting. Postgres only lets one of those updates succeed. Whoever loses the race just moves on to the next candidate. No locks, no queues, no extra infrastructure, just a compare-and-swap on a status column.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages