Crate corteq

Crate corteq 

Source
Expand description

§Corteq - Enterprise Multi-Tenant SaaS Framework

Corteq is a security-first, multi-tenant SaaS framework for Rust that provides:

  • Tenant Data Isolation: Row-level security (RLS) with compile-time safety
  • JWT Authentication: Tenant context embedded in authentication tokens
  • RBAC Authorization: Tenant-scoped role-based access control
  • Audit Logging: Comprehensive, immutable audit trails
  • Encryption: AES-256-GCM at rest, TLS 1.3 in transit
  • Compliance Ready: GDPR, HIPAA, SOC 2 patterns built-in

§Quick Start

use corteq::CorteqApp;
use actix_web::{web, App, HttpServer};

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let app_config = CorteqApp::builder()
        .with_database("postgres://localhost/mydb")
        .with_jwt_secret("your-secret-key")
        .build()
        .await
        .expect("Failed to build app");

    HttpServer::new(move || {
        App::new()
            .app_data(web::Data::new(app_config.clone()))
    })
    .bind("0.0.0.0:3000")?
    .run()
    .await
}

Re-exports§

pub use auth::Claims;
pub use auth::JwtService;
pub use cache::MemoryTenantCache;
pub use cache::TenantCache;
pub use database::TenantDatabase;
pub use domain::Tenant;
pub use domain::TenantContext;
pub use encryption::EncryptedData;
pub use encryption::EncryptionService;
pub use error::CorteqError;
pub use error::Result;
pub use middleware::TenantContextMiddleware;
pub use middleware::TenantExtractor;
pub use repository::TenantRepository;

Modules§

auth
Authentication module with JWT support
cache
Tenant caching layer for performance optimization
database
Database layer with Row-Level Security (RLS) enforcement
domain
Domain models for Corteq framework
encryption
Encryption module for data at rest using AES-256-GCM
error
Error types for Corteq framework
middleware
Middleware for tenant context extraction and validation
repository
Repository patterns for tenant-scoped data access

Structs§

CorteqApp
Corteq application configuration
CorteqAppBuilder
Builder for Corteq applications