#product-os #content-security-policy #web-server

no-std product-os-server

Product OS : Server provides a full functioning advanced server capable of acting as a web server, command and control distributed network, authentication server, crawling server and more. Fully featured with high level of flexibility.

47 releases

0.0.53 Feb 17, 2026
0.0.49 Jun 30, 2025
0.0.42 Feb 2, 2025
0.0.39 Oct 27, 2024
0.0.13 Nov 13, 2023

#751 in Network programming


Used in 3 crates

GPL-3.0-only and AGPL-3.0-only

1.5MB
21K SLoC

Product OS : Server

Crates.io Documentation License: GPL-3.0

Product OS : Server provides a full functioning advanced server capable of acting as a web server, command and control distributed network, authentication server, crawling server, and more. Fully featured with a high level of flexibility.

What is Product OS?

Product OS is a collection of packages that provide different tools and features that can work together to build products more easily for the Rust ecosystem.

Features

  • Web Server: High-performance HTTP/HTTPS server built on Axum and Hyper
  • TLS Support: Secure connections with Rustls
  • Dual Protocol: Simultaneous HTTP and HTTPS on different ports
  • WebSocket Support: Real-time bidirectional communication
  • Server-Sent Events: Streaming updates to clients
  • Compression: Gzip, Deflate, and Brotli response compression
  • CORS: Cross-Origin Resource Sharing support
  • CSRF Protection: Cross-Site Request Forgery protection
  • CSP: Content Security Policy support
  • Middleware: Extensible middleware system
  • Command & Control: Distributed system coordination
  • Multiple Executors: Tokio async runtime support

Installation

Add Product OS : Server to your Cargo.toml:

[dependencies]
product-os-server = { version = "0.0.53", features = ["core", "executor_tokio", "tls"] }
tokio = { version = "1", features = ["full"] }

Quick Start

use product_os_server::{ProductOSServer, ServerConfig};
use product_os_async_executor::TokioExecutor;

#[tokio::main]
async fn main() {
    // Create server with default configuration
    let config = ServerConfig::new();
    let mut server: ProductOSServer<(), TokioExecutor, _> =
        ProductOSServer::new_with_config(config);

    // Add routes and start the server
    // server.start(true).await;
}

Feature Flags

Core Features

  • core: Basic server functionality with Hyper, Axum, and logging
  • std: Standard library support

Executors

  • executor_tokio: Tokio async runtime support

TLS

  • tls: TLS/HTTPS support with Rustls
  • dual_server: Simultaneous HTTP/HTTPS server

Communication

  • ws: WebSocket support
  • sse: Server-Sent Events support

Security

  • cors: CORS support
  • cspolicy: Content Security Policy
  • csrf: CSRF protection

Middleware & Features

  • middleware: Extensible middleware support
  • compression: Response compression (gzip, deflate, brotli)
  • extract_headers: Header extraction utilities

Data Stores

  • controller: Command and Control with store support
  • postgres_store: PostgreSQL database support
  • sqlite_store: SQLite database support
  • redis_key_value_store: Redis key-value store
  • memory_key_value_store: In-memory key-value store
  • file_key_value_store: File-based key-value store
  • redis_queue_store: Redis queue store
  • memory_queue_store: In-memory queue store

Configuration

{
  "environment": "production",
  "rootPath": "/api",
  "network": {
    "protocol": "https",
    "secure": true,
    "host": "0.0.0.0",
    "port": 8443,
    "listenAllInterfaces": true,
    "allowInsecure": true,
    "insecurePort": 8080,
    "insecureUseDifferentPort": true,
    "insecureForceSecure": true
  },
  "certificate": {
    "certFile": "/path/to/cert.pem",
    "keyFile": "/path/to/key.pem"
  },
  "compression": {
    "enable": true,
    "gzip": true,
    "brotli": true
  },
  "security": {
    "enable": true,
    "csrf": true,
    "csp": {
      "defaultSrc": ["'self'"],
      "scriptSrc": ["'self'", "'unsafe-inline'"]
    }
  }
}

Architecture

The server is built on:

  • Hyper: Low-level HTTP implementation
  • Axum: Web framework with routing and middleware
  • Rustls: Modern TLS implementation
  • Tower: Service abstraction for middleware

Integration

Product OS Server integrates with:

  • Product OS Router: Request routing and handlers
  • Product OS Configuration: Configuration management
  • Product OS Security: Certificates and authentication
  • Product OS Command Control: Distributed coordination
  • Product OS Store: Data persistence
  • Product OS Capabilities: Service/feature registration

Testing

# Run all tests
cargo test --all-features

# Run with specific features
cargo test --features "core,executor_tokio,tls"

# Generate documentation
cargo doc --all-features --open

License

GNU GPLv3

Contributing

Contributions are welcome! Please ensure:

  • All tests pass: cargo test --all-features
  • Code is formatted: cargo fmt
  • No clippy warnings: cargo clippy --all-features
  • Documentation is updated for public APIs

Minimum Supported Rust Version (MSRV)

Rust 1.69 or later.

Dependencies

~22–47MB
~735K SLoC