# Windjammer Runtime
**Runtime library backing Windjammer's standard library with production-grade Rust implementations.**
## What Is This?
`windjammer-runtime` is the bridge between Windjammer's clean, high-level standard library API and battle-tested Rust crates. When you write:
```windjammer
use std::http
fn main() {
http.serve("0.0.0.0:3000", handler)
}
```
The Windjammer compiler generates Rust code that calls `windjammer_runtime::http`, which provides clean abstractions over `axum` and `reqwest`.
## Why Does This Exist?
**Proper Abstraction:** Windjammer controls the API contract, not external crates. If `axum` breaks compatibility in v0.8, we update `windjammer-runtime` internally—your Windjammer code keeps working.
**No Crate Leakage:** You write `std::http`, not `axum::`. You write `std::json`, not `serde_json::`. Clean, stable APIs.
**Future Flexibility:** We can swap implementations (e.g., `hyper` → `axum` → something better) without breaking user code.
## Modules
### Web Development
- **`http`** - HTTP client (reqwest) + server (axum)
- **`json`** - JSON serialization/deserialization (serde_json)
### File System & I/O
- **`fs`** - File operations (Rust stdlib)
- **`log`** - Production logging (env_logger)
### Data & Patterns
- **`regex_mod`** - Regular expressions (regex crate)
- **`db`** - Database access (sqlx)
- **`time`** - Time/date utilities (chrono)
- **`crypto`** - Cryptography (sha2, bcrypt, base64)
- **`random`** - Random generation (rand)
### System
- **`env`** - Environment variables
- **`process`** - Process execution
- **`collections`** - Data structures
### Developer Tools
- **`cli`** - CLI argument parsing (clap)
- **`testing`** - Test assertions
- **`csv_mod`** - CSV parsing (csv)
- **`strings`** - String utilities
- **`mime`** - MIME type handling (mime_guess)
## Usage
This crate is **not intended for direct use**. It's automatically included when the Windjammer compiler generates Rust code that uses stdlib modules.
### In Generated Code
```rust
// Generated by Windjammer compiler
use windjammer_runtime::http;
use windjammer_runtime::json;
#[tokio::main]
async fn main() {
// Clean API, backed by reqwest/axum
let client = http::Client::new();
let response = client.get("https://api.example.com").await.unwrap();
println!("{}", response.body);
}
```
## Architecture
```
Windjammer User Code (.wj)
↓
Windjammer Compiler
↓
Generated Rust Code (.rs)
↓
windjammer-runtime (this crate)
↓
Underlying Rust Crates (axum, reqwest, serde_json, etc.)
```
## Testing
```bash
# Run all tests
cargo test --all-features
# Run stdlib integration tests
cargo test --test integration_tests
# Run smoke tests
cargo test --test smoke_test
```
## Features
- **`db`** - Database support via sqlx (optional, off by default)
## Version Alignment
`windjammer-runtime` versions are **synchronized with Windjammer**:
- Windjammer v0.38.6 → windjammer-runtime v0.34.0
- Breaking changes increment major version for both
## Contributing
This crate is part of the Windjammer project. See the [main repository](https://github.com/jeffreyfriedman/windjammer) for contribution guidelines.
## License
Dual-licensed under MIT or Apache 2.0, same as Windjammer.