The Inverter Cycle β Complete Distribution Platform
A unified audiobook, ebook, and companion document distribution platform with user accounts, automated purchases, and DRM protection.
π Complete Collection
The Inverter Cycle Trilogy (3 Books)
| Book | Audio | Ebook | Extras | Bundle Price |
|---|---|---|---|---|
| WILDFLOWER (Book 1) | β Hybrid, Cinematic, Immersive | β EPUB | β Research Notes | $19.99 |
| TALLY (Book 2) | β Hybrid | β EPUB | β Maps | $19.99 |
| COGITO (Book 3) | β (or coming soon) | β EPUB | β Tech Specs | $19.99 |
**Trilogy Bundle: 19.94)
The Convergence Protocol (40 Nodes)
From They Can All Bird, Chapter 18 β 40 practice nodes organized into 5 suites:
| Suite | Name | Nodes | Theme |
|---|---|---|---|
| I | Recognition | 1-8 | Perception Hygiene |
| II | Resistance | 9-16 | Response Protocols |
| III | Reconstruction | 17-24 | Meaning-Making |
| IV | Relationship | 25-32 | Social Cognition |
| V | Renewal | 33-40 | Maintenance |
API: /api/suites β Browse all suites and nodes
Standalone Companion
| Book | Audio | Ebook | Extras | Price |
|---|---|---|---|---|
| They Can All Bird | Ch 18 FREE | On Kindle | β Field Notes | Ch 18 FREE |
| Podcast | β All episodes | β | β | FREE |
They Can All Bird Chapter 18 free here β full book on Amazon Kindle
π Whatβs Free
- Chapter 18 of WILDFLOWER (audio + ebook sample)
- Chapter 18 of They Can All Bird (audio preview)
- 40 Nodes from Convergence Protocol (all nodes browsable)
- Podcast (all episodes)
- Sample chapters from each book
π Quick Start
Deploy
cd ~/Nosos/inverter_cycle/infrastructure/audiobook-worker
./deploy.sh # Creates infrastructure + sets up auth secrets
./upload.sh # Uploads all audiobooks, ebooks, and extrasConfigure Stripe (for automated purchases)
-
Create products in Stripe:
- βWILDFLOWER Bundleβ - $19.99 (metadata:
book=wildflower) - βTALLY Bundleβ - $19.99 (metadata:
book=tally) - βComplete Collectionβ - $49.99 (metadata:
book=wildflower,tally,cogito)
- βWILDFLOWER Bundleβ - $19.99 (metadata:
-
Add webhook:
- URL:
https://audio.kbird.ai/webhooks/stripe - Events:
checkout.session.completed
- URL:
-
Done! Customers get instant access after paying.
π‘ API Endpoints
Content Access
GET /audio/:book/:format/:file.mp3 # Stream audiobook
GET /ebook/:book/:file.epub # Download EPUB
GET /extras/:book/:file.pdf # Download companion docs
GET /covers/:file # Cover images
Examples:
# Free content (no auth)
curl https://audio.kbird.ai/audio/wildflower/hybrid/CHAPTER_18_*.mp3
curl https://audio.kbird.ai/ebook/they_can_all_bird/They_Can_All_Bird.epub
# Premium (requires auth)
curl -H "Authorization: Bearer TOKEN" \
https://audio.kbird.ai/ebook/wildflower/WILDFLOWER.epubAuthentication
POST /auth/register
POST /auth/login
POST /auth/logout
POST /auth/refresh
GET /auth/me
POST /auth/forgot-password
POST /auth/reset-password
Library & Catalog
GET /api/library # Your purchased content
GET /api/catalog # Browse all books
GET /api/books # Book metadata
GET /api/free-content # List free downloads
π Authentication
User Registration
curl -X POST https://audio.kbird.ai/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123",
"firstName": "Jane"
}'Login
curl -X POST https://audio.kbird.ai/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "securepassword123"}'Response includes:
token- Access token (15 min expiry)refresh_tokencookie - For getting new access tokens
Using Tokens
# Include in all authenticated requests
curl -H "Authorization: Bearer ACCESS_TOKEN" \
https://audio.kbird.ai/api/libraryWhen token expires:
# Refresh using cookie (no auth header needed)
curl -X POST https://audio.kbird.ai/auth/refresh
# Returns new access tokenπ Purchase Integration
Automated (Recommended)
The webhook handlers automatically:
- Create user account (if new customer)
- Record purchase in database
- Grant access to audio + ebook + extras
- (You add) Send welcome email
Manual (For gifts/review copies)
# Generate access token
curl -X POST https://audio.kbird.ai/api/admin/generate-token \
-H "Authorization: Bearer $JWT_SECRET" \
-d '{
"email": "[email protected]",
"book": "wildflower",
"includes_audio": true,
"includes_ebook": true,
"includes_extras": true,
"tier": "review"
}'
# Or create purchase directly
curl -X POST https://audio.kbird.ai/api/admin/create-purchase \
-H "Authorization: Bearer $JWT_SECRET" \
-d '{
"userId": 1,
"book": "wildflower",
"includes_audio": true,
"includes_ebook": true,
"priceCents": 1999
}'π R2 Storage Structure
kbird-audiobooks/
βββ wildflower/
β βββ audio/
β β βββ hybrid/*.mp3
β β βββ cinematic/*.mp3
β β βββ immersive/*.mp3
β βββ ebook/WILDFLOWER.epub
β βββ extras/*.pdf
βββ tally/
β βββ audio/hybrid/*.mp3
β βββ ebook/TALLY.epub
β βββ extras/*.pdf
βββ cogito/
β βββ audio/hybrid/*.mp3
β βββ ebook/COGITO.epub
βββ they_can_all_bird/
β βββ ebook/They_Can_All_Bird.epub
βββ podcast/
βββ Ep*.mp3
ποΈ Database Schema
Key Tables
- users - Account info, password hashes
- sessions - Refresh tokens
- purchases - What each user bought
- access_tokens - Gift codes, review copies
- downloads - Download analytics
- books - Book metadata & pricing
- content_files - File inventory
Purchase Record
SELECT * FROM purchases WHERE user_id = 1;
-- Includes:
-- - book (wildflower/tally/cogito)
-- - includes_audio (true/false)
-- - includes_ebook (true/false)
-- - includes_extras (true/false)
-- - price_paid_cents
-- - purchased_atπ¨ Content Types Supported
| Type | Extensions | Access |
|---|---|---|
| Audio | .mp3, .m4a, .m4b, .ogg | Streaming + Download |
| Ebook | .epub | Download |
| Documents | .pdf, .md, .txt | Download |
π Analytics
-- Total revenue
SELECT SUM(price_paid_cents) / 100.0 as revenue FROM purchases;
-- Downloads by type
SELECT file_type, access_type, COUNT(*)
FROM downloads
GROUP BY file_type, access_type;
-- Popular content
SELECT * FROM popular_content LIMIT 10;
-- User library view
SELECT * FROM user_libraries WHERE user_id = 1;π° Pricing Strategy
| Product | Individual | Bundle Savings |
|---|---|---|
| Audio only | $14.99 | β |
| Ebook only | $9.99 | β |
| Bundle (Audio + Ebook + Extras) | $19.99 | Save $4.99 |
| Complete Collection (3 books) | $49.99 | Save $19.94 |
π Security
- Passwords: SHA-256 with unique salt
- JWT access tokens: 15 minute expiry
- Refresh tokens: HTTP-only cookies, 30 days
- Session revocation on logout
- Webhook signature verification (add your own)
π§ͺ Testing
# Test free content
curl https://audio.kbird.ai/api/free-content
# Test auth
curl -X POST http://localhost:8787/auth/register \
-d '{"email":"[email protected]","password":"password123"}'
# Test Stripe webhook locally
stripe listen --forward-to localhost:8787/webhooks/stripe
stripe trigger checkout.session.completedπ Deployment Checklist
- Run
./deploy.shto create infrastructure - Run
./upload.shto upload all content - Configure Stripe webhook
- Set up email sending (SendGrid/Postmark) for welcome emails
- Add domain
audio.kbird.aiin Cloudflare - Test purchase flow end-to-end
- Set up monitoring/alerts
π Cost Estimate
| Component | Cost |
|---|---|
| Cloudflare Worker | FREE (100K req/day) |
| R2 Storage (20GB) | ~$0.30/month |
| R2 Requests | ~$0.50/month |
| D1 Database | FREE (5M rows/day) |
| Total | ~$0.80/month |
π Related Documentation
- AUTOMATION_GUIDE.md - Detailed Stripe/LemonSqueezy/Gumroad setup
- convergence_app - Ebook production files
- inverter_cycle - Manuscripts and production materials
Built with The Convergence Protocol π¦