Data & Storage Architecture
How user data flows across TAKTARI's 3 products, where it's stored, and how multi-tenancy works.
Figure 1: Platform Data Flow
ENTRY POINTS AUTH LAYER TENANT ISOLATION STORAGE LAYER
============ ========== ================ =============
taktari.com ----+ +-- Turso (libSQL)
| +----------------+ +------------------+ | 357 tables
cornybot.com ----+--------> | Hono Middleware | ------> | JWT -> user_id | ----------->| All structured data
| | | | user_id -> biz_id | |
justinbrownvs --+ | Magic Link | | biz_id scopes | +-- Cloudflare R2
.com (custom) | Google OAuth | | ALL queries | Audio renders
| API Key | +------------------+ Cover art, OG images
| CLI Token | | Training samples
+----------------+ | Research PDFs
| |
v v +-- Box (cold archive)
+----------------+ +------------------+ | 4.65 TB (unlimited)
| users table | | businesses table | | Voice inference
| id, email, | | id, owner_user_id| | Model weights
| user_type, |<------->| domains, config | | Session logs
| stripe_cust_id | 1:1 | status | | Training data
+----------------+ +------------------+
| +-- Google Workspace
| (consulting only)
+-----------+-----------+ Email, calendar
| | | Document collab
v v v
TAKTARI CORNYBOT CONSULTING
(founder) (artist) (client)
Figure 2: Per-Product Data Ownership
TAKTARI (Founder/Operator)
user_type: 'operator' | 'admin'
orchestrator_runs
research_papers
rd_activities
evolution_scores
pipeline_items
innovation_claims
launch_simulations
Research PDFs
Cold archive
CORNYBOT (Artist/Musician)
user_type: 'creator'
cornybot_generations
songs
voice_models
audio_renders
pes_scores
song_collaborators
vault_uploads
Audio (TTS/SVC)
Cover art
CONSULTING (Client/Founder)
user_type: 'founder'
founder_tech_stack
business_formations
business_obligations
consulting_revenue
escalations
Email (delegated)
Calendar
Figure 3: User Lifecycle (Auth -> Provision -> Store)
SIGNUP PROVISION ONGOING DATA CREATION
====== ========= =====================
Magic Link / OAuth Auto on first login: Per business_id:
| | |
+-> users +-> businesses (1:1) +-> CORNYBOT
| id: user_abc | id: biz_xyz | cornybot_generations
| email: foo@bar | owner_user_id: user_abc | songs, voice_models
| user_type: creator | domains: cornybot.com | audio_renders -> R2
| | | pes_scores
+-> sessions +-> licenses |
| token: jwt_... | tier: free +-> TAKTARI
| expires_at: +30d | features: [...] | orchestrator_runs
| | | research_papers
+-> magic_links +-> onboarding_sessions | rd_activities
token: mlk_... | stage: welcome |
expires_at: +15m | +-> CONSULTING
+-> voice_models (paid tiers) | founder_tech_stack
| arch: rvc-v2, status: stub | business_formations
| | business_obligations
+-> api_keys (pro+ tiers) | consulting_revenue_ledger
tier: pro, hashed: sha256
STRIPE UPGRADE WEBHOOK
======================
checkout.session.completed -> provisionUserForTier(tier)
|
+-> licenses: UPDATE tier
+-> voice_models: CREATE (if missing)
+-> api_keys: CREATE (if missing)
+-> cornybot_generations: UPDATE business_id from 'public' to actual
Figure 4: Storage Location Matrix
| Data Type | Primary Storage | Cold Archive | Scope | Status |
|---|---|---|---|---|
| User identity + auth | Turso | - | All products | Live |
| Business entities | Turso | - | All products | Live |
| Verse generations | Turso | - | CornyBot | Live |
| Songs + metadata | Turso | - | CornyBot | Live |
| Audio renders (WAV) | R2 | Box | CornyBot | Live |
| Voice model weights | R2 | Box | CornyBot | Live |
| Cover art + OG images | R2 | - | CornyBot | Live |
| R&D activities | Turso | - | TAKTARI | Live |
| Research papers | Turso + R2 | - | TAKTARI | Live |
| Tech stack costs | Turso | - | Consulting | Live |
| Business formations | Turso | - | Consulting | Live |
| Consulting revenue | Turso | - | Consulting | New table added |
| Client email/docs | Google Workspace | - | Consulting | Live (delegated DNS) |
| Session logs | Local | Box | Internal | Migrating to Box |
| RVC v2 tooling | Local | Box | Internal | Migrating to Box |
Figure 5: Multi-Tenancy Isolation Model
ISOLATION BOUNDARY: business_id
================================
Every user-created record is scoped by business_id:
users (1) -------> (1) businesses -------> (*) all content tables
owner_user_id business_id on every row
Query pattern (enforced at route level):
SELECT * FROM songs WHERE business_id = ? AND ...
INSERT INTO cornybot_generations (business_id, ...) VALUES (?, ...)
Cross-business access (consulting/managed artists):
managed_artists table:
admin_user_id (consultant) -> can READ artist_user_id's business content
Routes: NOT YET wired (gap to close)
Public content:
business_id = 'public' -> demo/reference data, visible to all
Upgraded users: bulk UPDATE from 'public' to actual business_id
Product separation:
NOT stored in DB (no product_id column)
Handled by:
1. Domain routing (cornybot.com vs taktari.com vs custom)
2. products.js page guard (client-side)
3. user_type field ('creator' vs 'founder' vs 'operator')
Figure 6: Storage Provider Architecture
+-------------------+ +-------------------+ +-------------------+
| Turso (libSQL) | | Cloudflare R2 | | Box (4.65 TB) |
| PRIMARY DATA | | BINARY ASSETS | | COLD ARCHIVE |
+-------------------+ +-------------------+ +-------------------+
| 357 tables | | Audio WAV files | | Voice inference |
| All structured | | Cover art (JPG) | | Model weights |
| User + business | | OG images (PNG) | | Training data |
| Songs, verses | | Training samples | | Session logs |
| R&D, compliance | | Research PDFs | | Historical output |
| | | | | |
| Cost: ~$20/mo | | Cost: ~$2/mo | | Cost: $65/mo |
| (included in plan)| | (free egress) | | (unlimited) |
+-------------------+ +-------------------+ +-------------------+
| | |
v v v
+-------------------+ +-------------------+ +-------------------+
| Google Workspace | | Solana | | Arweave |
| CLIENT COLLAB | | IP TIMESTAMPS | | PERMANENT WEB3 |
+-------------------+ +-------------------+ +-------------------+
| Email (delegated) | | Memo transactions | | Immutable catalog |
| Calendar, Docs | | ip_timestamps tbl | | vault_uploads |
| Per-client domain | | Cost: ~$0.001/tx | | Not yet live |
| | | | | |
| Cost: $17/mo/user | | On-demand only | | On-demand only |
+-------------------+ +-------------------+ +-------------------+
Architecture Validation
Live checks against the API to confirm data flow is operational.