Agent-specific documentation for working on Twelve Cash.
Twelve Cash is a BIP-353 implementation that encodes Bitcoin payment instructions (BOLT12 offers, on-chain addresses, LNURLs) into DNS TXT records. Users get human-readable payment addresses like alice@twelve.cash that resolve to their Bitcoin payment details via DNSSEC-validated DNS lookups.
Live site: https://twelve.cash
| Component | Technology |
|---|---|
| Framework | Next.js 15 (App Router) |
| Language | TypeScript |
| Package Manager | pnpm (v9.15.2+) |
| Database | PostgreSQL via Prisma ORM |
| API | tRPC |
| Styling | Tailwind CSS |
| DNS Provider | Cloudflare API |
| Auth | JWT-based (via @moneydevkit/nextjs) |
# Install dependencies
pnpm install
# Start the database (Docker required)
./start-database.sh
# Generate Prisma client and push schema
pnpm postinstall
pnpm db:push
# Start development server
pnpm devsrc/
├── app/ # Next.js App Router pages and API routes
│ ├── record/ # V2 API endpoint for creating payment records
│ └── ...
├── components/ # React components
├── lib/ # Shared utilities
├── server/ # tRPC routers and server-side code
└── styles/ # Global CSS
prisma/
└── schema.prisma # Database schema
public/ # Static assets
src/app/record/route.ts- Main API endpoint for DNS record creationprisma/schema.prisma- Database models.env.sample- Required environment variables
Copy .env.sample to .env and configure:
DATABASE_URL- PostgreSQL connection stringCLOUDFLARE_API_TOKEN- API token with DNS edit permissionsCLOUDFLARE_ZONE_ID- Zone ID for your domainJWT_SECRET- Secret for JWT token signing
pnpm testpnpm db:push # Push schema changes (dev)
pnpm db:migrate # Run migrations (prod)
pnpm db:studio # Open Prisma Studio GUI
pnpm db:reset # Reset database (caution!)pnpm lintPayment addresses follow the format: username@domain.com
These resolve via DNS TXT records at: username.user._bitcoin-payment.domain.com
The TXT record contains a Bitcoin URI with payment instructions:
bitcoin:?lno=<bolt12_offer>&sp=<silent_payment>&b=<onchain_address>
POST /v2/record
Content-Type: application/json
{
"domain": "twelve.cash",
"lno": "lno1...", // BOLT12 offer (optional)
"sp": "sp1...", // Silent payment address (optional)
"onChain": "bc1...", // On-chain address (optional)
"custom": [ // Custom fields (optional)
{ "prefix": "lnurl", "value": "lnurl1..." }
]
}
Important: When making major changes to the codebase:
- Update this
AGENTS.mdfile with relevant changes - Update the corresponding Cursor rules in
.cursor/rules/ - Keep documentation in sync with actual implementation
This ensures future AI agents (and human developers) have accurate context.