- Elixir 89%
- CSS 7%
- JavaScript 2%
- TypeScript 1%
- HTML <1%
- 5 more languages <1%
Stance #
Portable daily stance badges for the AT Protocol.
Stance is a Phoenix LiveView app for a simple social ritual: every day there is one question, people answer it, and their answer becomes a color. If someone changes their mind during the day, their badge becomes a small chain of color bricks with arrows showing the change.
The long-term goal is not to trap that badge inside this website. Stance is being built as an AT Protocol-native app so the answer records can live in a user's own repo, and other AT Protocol clients can render the badge when they choose to support it.
alice.example [blue] -> [green] -> [yellow]
What This Repo Is #
This repository is the main Stance application and protocol workbench. It contains:
- A Phoenix LiveView web app for the daily question and answer flow.
- Ecto/Postgres storage for accounts, questions, answers, badge projections, proposals, votes, and indexer cursors.
- Draft AT Protocol lexicons under
priv/lexicons/app/stance/. - An AT Protocol OAuth configuration boundary.
- A PDS create-record client for publishing
app.stance.answerrecords. - A Jetstream consumer skeleton for indexing
app.stance.*records. - Planning docs for the public AppView API, third-party integrations, developer tooling, and adoption experiments.
The project is intentionally early, but it is already more than a mockup. The current build is moving from the local answer/PDS-write path into indexing, badge projections, public read endpoints, and integration docs.
Why Stance Exists #
AT Protocol gives users portable identity and public, user-owned data records. That makes it a good fit for lightweight social objects that should be readable outside one app.
Stance is exploring one of those objects: a daily, visible, changeable answer that can travel with a user across AT Protocol clients. A client should not need to understand Stance's whole product to show the badge. It should be able to either:
- Read public Stance records directly from AT Protocol repos, or
- Call the Stance AppView API for a ready-to-render badge projection.
There is no universal AT Protocol hook that forces every site to decorate usernames. Adoption has to be earned with a stable data model, fast public read endpoints, clear rendering rules, and copy-pasteable integration tools.
How It Works #
The intended production flow:
- Stance publishes the daily question.
- A user signs in with an AT Protocol account.
- The user answers the question in Stance.
- Stance stores the local answer event and assigns the configured color.
- Stance publishes an
app.stance.answerrecord to the user's PDS. - The Stance indexer reads public
app.stance.*records. - The AppView derives the user's current badge chain for the day.
- Third-party clients fetch or index that badge data and render the bricks.
Future convenience flows may include posting the daily question from an official Stance Bluesky/AT Protocol account and ingesting valid replies from connected accounts as answer events.
Integration Surface #
The public integration work is a first-class part of this repo, not a later afterthought.
Implemented public AppView endpoints:
GET /xrpc/app.stance.getBadge?actor=<did-or-handle>&day=YYYY-MM-DD[&community=<slug-or-global>]
POST /xrpc/app.stance.getBadges
GET /xrpc/app.stance.getQuestion?day=YYYY-MM-DD[&community=<slug-or-global>]
Contributor-facing artifacts:
docs/integration-contract.mdfor endpoint behavior, errors, cache headers, CORS, ETags, stale data, and batch limits.docs/direct-ingestion.mdfor clients that want to indexapp.stance.*records themselves.docs/versioning-policy.mdfor lexicon publication gates, compatibility states, release checks, and migration windows.docs/rendering-spec.mdfor client-owned badge UI, compact mode, overflow, contrast, labels, and fallback behavior.docs/share-link-contract.mdfor canonical public stance links, metadata, Takumi preview payloads, cache keys, and fallbacks.docs/share-link-privacy.mdfor what public link viewers see, hide/delete behavior, and preview refresh limits.docs/external-rendering-experiment.mdfor the first partner-client rendering experiment decision.docs/partner-client-onboarding.mdfor partner requirements, support channel, and launch criteria.docs/beta-distribution-scope.mdfor the beta decision that custom feeds and labelers remain post-beta experiments.docs/public-beta-checklist.mdfor observability, deployment, runtime configuration, alerting, and public beta gates.docs/reliability.mdfor the health endpoint, partner incident fields, and fail-closed availability guidance.docs/community-affiliation-spike.mdfor community-scoped questions, primary-broadcast behavior, and label-first community identity.- Badge response fixtures and a validator script.
- A tiny TypeScript client for badge reads.
- A framework-neutral brick renderer under
clients/bricks. - React, Vue/Svelte, and vanilla examples under
clients/examples. - Shareable Stance links with Takumi-rendered preview cards.
- A public developer page inside the Phoenix app.
See docs/integration-roadmap.md for the current adoption plan.
Current Status #
Completed foundations:
- Project, Tangled remote, automation, and Phoenix LiveView app shell.
- Core Stance lexicon drafts, local storage, AppView endpoints, and community selectors.
- AT Protocol OAuth handoff, PDS write boundaries, retry state, and safe token storage.
- Daily question, answer, proposal, voting, community, share-link, and developer integration surfaces.
- TypeScript client, framework-neutral brick renderer, framework examples, conformance fixtures, partner onboarding, reliability notes, and public beta hardening docs.
In progress / next:
- Phase 16 is polishing user-facing and developer-facing routes.
- Phase 17 will audit complete user flows from sign-in through answering, sharing, proposals, voting, communities, privacy, and developer handoff.
- Phase 18 will discover and prioritize post-beta enhancement opportunities.
- Public beta remains gated on deployment host selection, production metrics, alert routing, real-account PDS write verification, and staging checks.
The source of truth for work sequencing is docs/progress.md.
Running Locally #
Prerequisites:
- Elixir and Erlang managed through
mise. - Postgres available locally.
Setup:
mise exec -- mix setup
Start the app:
mise exec -- mix phx.server
Then visit http://localhost:4000.
Useful commands:
mise exec -- mix format
mise exec -- mix test
mise exec -- mix precommit
Contributing #
The most useful contributions right now are practical pieces that move Stance toward being a real AT Protocol app:
- AppView read endpoints and response tests.
- Badge projection logic from indexed answer records.
- Lexicon review and validation fixtures.
- API contract writing for third-party clients.
- Frontend polish for the daily question and badge UI.
- Proposal/voting board flows.
- TypeScript client and rendering examples.
- Abuse, moderation, privacy, and deletion/hide behavior.
- Deployment and observability work.
Before starting work, read:
- docs/phase-plan.md
- docs/progress.md
- docs/seed-spike.md
- docs/lexicon-validation.md
- docs/integration-roadmap.md
- docs/direct-ingestion.md
- docs/versioning-policy.md
- docs/rendering-spec.md
- docs/share-link-contract.md
- docs/share-link-privacy.md
- docs/external-rendering-experiment.md
- docs/partner-client-onboarding.md
- docs/beta-distribution-scope.md
- docs/public-beta-checklist.md
- docs/reliability.md
When changing behavior, add or update tests. For public protocol surfaces, also update the relevant docs and fixtures so other implementers do not have to infer behavior from Phoenix code.
Project Principles #
- User answers should be portable when users choose to publish them.
- Other clients should have a stable, documented way to render badges.
- The badge should be date-scoped; today's stance is not a permanent profile label.
- Stance changes should be append-only, not silent rewrites.
- Integration should work through public records and public APIs, not private coordination with this codebase.
- Privacy tradeoffs must be explicit because AT Protocol repo records are public.
Repository Map #
lib/stance_web/live/today_live.ex- daily question and answer UI.lib/stance/questions.ex- question lookup and seeding boundary.lib/stance/answers.ex- local answer persistence and PDS publish bridge.lib/stance/badges.ex- badge-chain derivation.lib/stance/atproto/- OAuth, identity, and PDS client boundaries.lib/stance/indexer/- Jetstream indexing boundary.priv/lexicons/app/stance/- draft Stance AT Protocol lexicons.docs/- research, plans, integration roadmap, and automation notes.
Links #
- Public repo: tangled.org/bleuropa.tngl.sh/stance
- AT Protocol: atproto.com
- Bluesky developer docs: docs.bsky.app