CLAUDE.md says display amounts MUST go through useDisplayCurrency(). Reality: 11 user-facing sites hand-formatted Bitcoin with .toFixed(8) + ' BTC', ignoring the CHF preference 95% of European users will pick. A wallet balance of 0.001 BTC shown as "0.00100000 BTC" instead of "CHF 86.00" is the kind of thing you don't notice until a real user complains. Client components — drop in useDisplayCurrency().formatAmountBtc(): - src/components/ai-chat/AIChatMessage.tsx — AI cost per message - src/components/profile/ProfileOverviewTab.tsx — totalRaised stat These now render in whatever currency the user picked. CHF user sees "CHF 86.00"; BTC user sees "100,000 sat" (the hook's BTC mode formats in sats with thousands separators). Server components — drop in displayBTC() from the currency service: - src/components/wallets/WalletManager/components/WalletCard.tsx (×2 — balance + goal progress) - src/app/wishlists/[id]/page.tsx (×4 — totals + per-item) - src/app/(authenticated)/dashboard/wishlists/[id]/page.tsx (×2) - src/app/(authenticated)/dashboard/wishlists/[id]/_components.tsx (×2) - src/app/(authenticated)/dashboard/ai-assistants/[id]/page.tsx - src/app/(authenticated)/dashboard/research/[id]/page.tsx Server components can't call React hooks. displayBTC() at least strips the trailing zeros so "0.00100000 BTC" becomes "0.001 BTC" — ugly factor down. Full currency-preference support for server pages needs a `formatAmountForUser(amount, supabase)` helper that reads `profiles.currency` and converts; tracked as a follow-up (separate commit, separate scope, biggest blocker is the per-render DB lookup cost). Skipped intentionally: - DynamicSidebar.tsx (BTC↔sats unit breakdown — both are correct raw displays, user is explicitly converting units) - CurrencyInput.tsx / useCurrencyInput.ts (input formatters — raw BTC is the right unit for an input) - CurrencyDisplay.tsx (utility primitive — its own internal logic) - AnalyticsInsights.tsx (toFixed(4) for stat compactness; different context, doesn't go through the share / display surface) tsc clean, eslint clean, 501/501 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OrangeCat
Your AI economic agent — and the platform where it operates.
The Problem
Economic participation still requires gatekeepers. To sell, fund, lend, invest, or govern collectively, you need banks, payment processors, platforms that take cuts and dictate terms. Pseudonymous participation is impossible. AI agents can't transact on your behalf.
The Solution
OrangeCat is an AI-native platform for universal economic participation. Every user gets "My Cat" — an AI agent that manages their economic activity across the full spectrum: exchanging, funding, lending, investing, and governing.
- Any identity: Human, pseudonymous, or AI — all are first-class economic participants
- Any currency: Bitcoin/Lightning is native and preferred, but any payment method (Twint, PayPal, Monero, local methods worldwide) is supported
- Full economic spectrum: From gifts (no strings) to loans (some strings) to investments (more strings)
- Private where needed, transparent where chosen: E2E encrypted messaging, on-chain transparency when appropriate
What Works Today
- Commerce: Products and services with Bitcoin Lightning payments
- Funding: Transparent project funding, cause support, wishlists, and research funding
- Lending: Peer-to-peer loans with repayment tracking
- Assets: Real estate, collateral, and rentable asset management
- Groups: Organizations with shared wallets, governance proposals, and collective decision-making
- AI Assistants: Autonomous economic actors as first-class entities
- Events: Time-bound coordination with ticketing
- Documents: Structured context for the AI agent
- Cross-product customers: Live example of FleetCrown (production) as customer of OrangeCat (economic), using typed stakeholder edges + shared wallets + profiles as projects.
Live at orangecat.ch. FleetCrown is a live "customer" of OrangeCat (see projects "OrangeCat" and "FleetCrown" under Mao Nakamoto). Shared BTC wallet. The stakeholder_relationships feature (8 kinds incl. customer) was made production-ready here for this use case — works for all.
Architecture
13 entity types, one registry. One ownership model (actors), one permission layer (database RLS). Adding a new entity type requires 2-3 files.
Technical details
Entity Registry Pattern
src/config/entity-registry.ts — single source of truth for all 13 entity types. Drives CRUD, navigation, forms, and validation. No entity-specific switch statements.
Actor System
Users and groups both have actors. All entities reference actor_id. One ownership model, one permission check — works for individuals, organizations, and (future) AI agents.
Middleware Composition
export default compose(withAuth(), withRateLimit('write'), withValidation(schema))(handler);
Functional composition replaces inheritance. Each middleware does one thing.
Security
- Row Level Security (RLS) at the database level — bugs in app code can't bypass authorization
- Zod schemas as SSOT — TypeScript types derived from schemas, never separate
- Structured API responses across all 40+ routes
Tech Stack
| Layer | Technology |
|---|---|
| Framework | Next.js 15, React 18, TypeScript 5.8 |
| Styling | Tailwind CSS, shadcn/ui |
| Database | Supabase (PostgreSQL + RLS) |
| Bitcoin | Lightning Network, LNURL, bitcoinjs-lib |
| Auth | Supabase Auth, JWT, Row Level Security |
| Deployment | Vercel, GitHub Actions CI/CD |
Quick Start
Prerequisites
- Node.js 20+
- A Supabase project (remote — no local Docker needed)
Setup
git clone https://github.com/g-but/orangecat.git
cd orangecat
npm install
cp .env.example .env.local
# Fill in Supabase credentials
npm run dev
Dev server starts at http://localhost:3000.
Environment Variables
See .env.example for the full list. Key variables:
NEXT_PUBLIC_SUPABASE_URL— Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY— Supabase anonymous keySUPABASE_SERVICE_ROLE_KEY— Server-side Supabase key
Project Structure
src/
config/entity-registry.ts -- SSOT: all 13 entity types
lib/api/ -- Middleware composition, generic CRUD
domain/ -- Business logic (no HTTP, no UI)
services/ -- Currency, search, notifications, groups
features/ -- Messaging, auth
app/api/ -- API routes (thin, composed from middleware)
components/ -- UI components (shadcn/ui based)
Testing
17 test suites, 74 tests. Pre-push hooks run type-check, lint, and the full test suite before any code reaches the remote.
Security
See SECURITY.md for reporting vulnerabilities.
License
Proprietary. All Rights Reserved. See LICENSE.