Introduction
Welcome to the official documentation for Conduit, a statically typed, domain-specific programming language tailored for web services, data processing pipelines, and modular applications. Conduit source files use the .cdt extension.
Conduit is designed from first principles with a strong focus on runtime performance, compile-time safety, simplicity, and zero external dependency footprint.
Core Guarantees & Philosophy
Zero External Dependencies The entire Conduit toolchain—including the lexer, parser, static type checker, monomorphizer, IR compiler, register bytecode VM, and standard libraries—is implemented exclusively using the Rust standard library (
std). No third-party crates are required.Fast Register Bytecode VM Conduit compiles
.cdtprograms to compact register-based bytecode with split scalar and object register banks, copy-on-write (Arc) collections, and fusedRunPipelineexecution for|>/map/filterchains.Explicit Modules & Privacy by Default Every declaration (types, errors, functions) within a module is private by default. Items are only exposed to external consumers when explicitly tagged with the
exportkeyword. Private types cannot accidentally leak through public API signatures, and unreachable functions are eliminated via reachability tree-shaking.Typed Errors as First-Class Values Conduit eliminates hidden exception handling and unchecked runtime failures. Functions declare error types directly in union signatures (
T | Error). The compiler strictly prevents discarding error values, enforces exhaustive pattern matching withswitch, and provides ergonomic propagation with the?operator.First-Class Standard Library (
cdt.*) & Built-In Concurrency Standard modules—cdt.app,cdt.http,cdt.db,cdt.redis,cdt.jwt,cdt.cache,cdt.lock,cdt.chan,cdt.cron,cdt.process,cdt.fs,cdt.crypto,cdt.json,cdt.time,cdt.validation,cdt.env,cdt.cli,cdt.path,cdt.url,cdt.csv,cdt.math, andcdt.log—are implemented natively in pure Rust alongside built-inspawnbackground tasks, typedcdt.chan(Chan<T>) channels, declarativeworkerpools, unifiedappservice lifecycle coordination, and server lifecycle hooks (on start/on stop), integrated directly with the type checker and VM.
How to Navigate This Book
- Getting Started: Walk through installing the binary, writing your first program, and exploring the CLI commands.
- Language Reference: Explore the grammar, type system, functions as first-class values, error handling rules, collection transformations, and module encapsulation.
- Standard Library: Detailed API references for
cdt.app,cdt.http,cdt.db,cdt.chan,cdt.cron,cdt.json,cdt.validation,cdt.env,cdt.cli, and more. - Practical Guides: Real-world patterns for resilient error pipelines and modular application layout.
- Internals: An overview of the compiler pipeline from source text to register bytecode execution.