$ show justrach/turboAPI
TurboAPI is a high-performance web framework designed as a drop-in replacement for FastAPI. It achieves significant performance improvements (7-22x faster according to benchmarks) by integrating a Zig-based HTTP core (turbonet) while maintaining full API compatibility. The framework uses a hybrid architecture where application logic remains in Python but network I/O, request parsing, validation, and optionally database operations are handled by Zig components. Key features include FastAPI-compatible routing and dependency injection, middleware support, WebSocket capabilities, OpenAPI automatic generation, and optional zero-Python execution paths for maximum performance. The project includes several reusable Zig libraries: dhi (validation), pg.zig (PostgreSQL client), metrics collection, and a high-performance radix trie router.
The LLM identified 4 files worth highlighting for reuse:
A Pydantic-style data validation library for Zig that provides declarative schema definition with compile-time validation generation. Features SIMD-accelerated string validators, combinators (Optional, Default, Transform), batch validation for multiple records, and WebAssembly API exports. Demonstrates non-obvious skill in SIMD programming and compile-time metaprogramming in Zig. Could be extracted for use in any Zig project requiring data validation.
A native Zig PostgreSQL client with connection pooling, prepared statement caching with LRU eviction, and query result caching with TTL-based invalidation. Handles the PostgreSQL wire protocol directly, supports SASL/MD5 authentication, and provides efficient binary data transfer. Demonstrates expertise in network protocol implementation, connection pooling strategies, and caching mechanisms. Could be extracted for use in any Zig application requiring PostgreSQL connectivity.
A high-performance HTTP router implementation using a prefix-compressed radix trie with method-indexed trees for O(1) child lookup. Features priority-based routing (hot routes checked first), raw string path walking without segment splitting, zero-alloc route parameters using fixed-size stack arrays, and custom HTTP method handling with lazy map allocation. Demonstrates advanced data structure optimization and algorithmic efficiency. Could be extracted for use in any HTTP server or framework requiring high-performance routing.
A Prometheus-compatible metrics library for Zig providing thread-safe counter, gauge, and histogram implementations with label support. Uses atomic operations for thread safety and provides efficient metric collection with minimal overhead. Demonstrates skill in concurrent programming and metric aggregation patterns. Could be extracted for use in any Zig application requiring metrics collection and monitoring.