Complete Tauq Workflows
TQN for humans, TBF for transport. Write TQN on both sides.
TBF is the compact wire format that reduces 87 KB to 14 KB while staying transparent to the user
The Three Components
TQN
Tauq Notation - readable text format
- • 54% fewer tokens than JSON
- • Human-readable and editable
- • Best for LLMs and config
TBF
Tauq Binary Format - compact binary
- • 84% smaller than JSON
- • Columnar encoding
- • Best for storage/transport
TQQ
Tauq Query - data transformations
- • Filter and transform data
- • Flexible pipeline language
- • Compose queries
🚀 TBF: The Transport Layer
Why TBF for Transport?
- ✓ 84% smaller - 87 KB → 14 KB for 1000 records
- ✓ Transparent - Write TQN on both sides, TBF handles transport
- ✓ Fast parsing - Zero-copy deserialization in Rust
- ✓ Wire format - Perfect for APIs, network, databases
The Pattern
Write TQN ↓ Convert to TBF (compact) ↓ Send/Store TBF (84% smaller) ↓ Convert back to TQN ↓ Read TQN (user never sees binary)
Five Additional Workflows
PRIMARY: TQN ↔ TBF Transport
Write/read TQN on both ends. TBF is the compact transport layer.
Benefits:
Query → Multi-Format Output
Process with TQQ, output as both TQN and TBF
Benefits:
API Gateway: TBF Transport
Receive TQN, store as TBF, send as TBF
Benefits:
Data Lake Integration
Multi-source → TBF → Apache Iceberg
Benefits:
Configuration Management
Define in TQN, deploy as TBF
Benefits:
LLM Integration
Lower token costs with TQN format
Benefits:
Format Selection Matrix
| Use Case | Format | Why |
|---|---|---|
| Write data | TQN | 54% fewer tokens, human-readable |
| Display data | TQN | Easy to read and edit |
| Transform data | TQQ | Flexible query language |
| LLM context | TQN | 54% fewer tokens = lower cost |
| Store in DB | TBF | 84% smaller, indexed efficiently |
| Network transfer | TBF | 84% smaller, faster parse |
| Config files | TQN | Easy to version control |
| Data lakes | TBF | Native columnar format |
Code Examples
CLI: Convert TQN to TBF
# Write data in TQN
cat > users.tqn << 'EOF'
!def User id name age
1 Alice 30
2 Bob 28
EOF
# Convert to TBF (54→14 KB for 1000 records)
tauq build users.tqn --format tbf -o users.tbf
# Verify size
ls -lh users.*
Rust: TQN → JSON → TBF
use tauq::tbf;
// 1. Parse TQN text
let tqn_text = r#"!def User id name age
1 Alice 30
2 Bob 28"#;
let json = tauq::compile_tauq(tqn_text)?;
// 2. Convert to Rust types
#[derive(serde::Serialize, serde::Deserialize)]
struct User { id: u32, name: String, age: u32 }
let users: Vec<User> = serde_json::from_value(json)?;
// 3. Serialize as TBF (compact binary)
let tbf_bytes = tbf::to_bytes(&users)?;
// 4. Transport/store as binary
database.insert("users", tbf_bytes);
TypeScript: Receive & Parse TBF
import * as tauq from 'tauq';
// 1. Fetch TBF from API
const response = await fetch('/api/users');
const tbfBuffer = await response.arrayBuffer();
// 2. Parse TBF to JavaScript
const users = tauq.tbf.decode(
new Uint8Array(tbfBuffer)
);
// 3. Use immediately (84% smaller than JSON)
users.forEach(user => {
console.log(`${user.name}: ${user.age}`);
});
Rust: API with Format Negotiation
use actix_web::{web, HttpResponse};
use tauq::tbf;
#[post("/api/users")]
async fn create_users(
body: web::Bytes,
query: web::Query<std::collections::HashMap<String, String>>
) -> HttpResponse {
// Parse input (TQN → JSON)
let tqn = String::from_utf8(body.to_vec()).unwrap();
let json = tauq::compile_tauq(&tqn).unwrap();
let users: Vec<User> = serde_json::from_value(json).unwrap();
// Store as TBF (84% smaller)
for user in &users {
db.insert(user.id, tbf::to_bytes(user).unwrap());
}
// Return format based on query param
let response = match query.get("format").map(|s| s.as_str()) {
Some("tqn") => tauq::format_to_tauq(&serde_json::to_value(&users).unwrap()),
_ => String::from_utf8(tbf::to_bytes(&users).unwrap()).unwrap(),
};
HttpResponse::Ok().body(response)
}
Common Integration Patterns
Microservices
Flow: Service A → TBF (compact) → Network → TBF → Service B
Benefit: 84% smaller messages, faster serialization
Example: Microservices communicating over gRPC with TBF
LLM Integration
Flow: Data → TQN (54% tokens) → LLM → TQN → Parse
Benefit: Lower API costs, more context in same budget
Example: Fit 2x data in LLM context, half the cost
Time-Series Analytics
Flow: Sensors → TQN → TQQ (aggregate) → TBF → Iceberg
Benefit: Log compactly, analyze efficiently, query with SQL
Example: IoT sensors logging metrics to data lake
Configuration Management
Flow: Write TQN → Validate → Deploy TBF → Load → Parse
Benefit: Human-readable source, efficient deployment
Example: Kubernetes ConfigMap with TBF payload
Performance Summary (1000 Records)
Tokens
Binary Size
Parse Time
Ready to Build with Tauq?
Choose your entry point: