AT-Jet
High-performance HTTP + Protobuf API framework for mobile services.
Not just a wrapper - AT-Jet is an opinionated, production-ready foundation for mobile API development. See Architecture Rationale for why this project exists.
Why AT-Jet?
Building mobile APIs with Protobuf over HTTP requires solving the same problems repeatedly:
- Content-type negotiation
- Request body size limits
- Consistent error handling
- Client library generation
- Team coding conventions
Without AT-Jet (30+ lines per handler):
async
With AT-Jet (5 lines):
async
Features
- HTTP/1.1 and HTTP/2 support via axum
- Protobuf request/response handling with automatic content negotiation
- Dual-format support - Protobuf for production, JSON for debugging (with key authorization)
- CDN-friendly design for global mobile users
- Middleware support for authentication, logging, compression
- Type-safe routing with compile-time guarantees
- Efficient bandwidth - Protobuf is 60-70% smaller than JSON
- Schema evolution - Protobuf handles backward/forward compatibility
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1.35", = ["full"] }
= "0.13"
Server Example
use *;
async
async
async
async
Client Example
use *;
async
Dual-Format Support (Protobuf + JSON)
AT-Jet supports both Protobuf (production) and JSON (debugging) formats. JSON requires authorization via debug keys to prevent accidental use in production.
Why Require Authorization for JSON?
Protobuf provides schema evolution guarantees that JSON lacks:
- Field numbers enable backward/forward compatibility
- Unknown fields are preserved during deserialization
- Optional fields have well-defined defaults
If clients accidentally use JSON in production, they lose these guarantees and may break when the schema evolves. The debug key requirement ensures JSON is only used intentionally.
Configuring Debug Keys
use *;
async
Using Dual-Format Handlers
use *;
// Dual-format handler - accepts both Protobuf and JSON
async
Client Usage
# Protobuf request (production - no debug key needed)
# JSON request (debugging - requires valid debug key)
# JSON request without debug key → rejected with 415 Unsupported Media Type
Format Selection Rules
| Request Format | Response Format | Condition |
|---|---|---|
| Protobuf | Protobuf | Default (production) |
| JSON | JSON | Valid X-Debug-Format header |
| JSON | Error 415 | Missing/invalid debug key |
| Protobuf | JSON | Accept: application/json + valid debug key |
Architecture
Mobile Clients (iOS, Android, Web)
│
▼
CDN (Global)
│
▼
┌─────────────┐
│ AT-Jet │ ◄── HTTP + Protobuf
│ Server │
└─────────────┘
│
▼
┌─────────────┐
│ Backend │ ◄── ZUS-RS (internal RPC)
│ Services │
└─────────────┘
Why HTTP + Protobuf?
| Factor | JSON | Protobuf |
|---|---|---|
| Size | 100% | 30-40% (60-70% smaller) |
| Parse Speed | 100% | 10-20% (5-10x faster) |
| Schema Evolution | Manual | Built-in |
| Type Safety | Runtime | Compile-time |
Running Examples
# Start server
# In another terminal, run client
Documentation
- Architecture Rationale - Why AT-Jet exists and design decisions
- CLAUDE.md - Development guidance and coding conventions
- ZUS-RS Best Practices - When to use AT-Jet vs ZUS-RS
License
MIT OR Apache-2.0