| Crates.io | stec_tenet |
| lib.rs | stec_tenet |
| version | 0.3.0 |
| created_at | 2025-06-06 04:36:18.166262+00 |
| updated_at | 2025-06-06 04:36:18.166262+00 |
| description | User and Tenant management for Saas applications |
| homepage | https://stecug.de |
| repository | |
| max_upload_size | |
| id | 1702595 |
| size | 142,161 |
Tenet is a library for managing tenants, applications, and users in SaaS environments, written in Rust. The library provides a robust foundation for developing multi-tenant applications.
Applications are accessed using the following URL schema:
https://apps.stecug.de/<tenant-id>/<application-id>
Tenet supports various storage methods for application configurations:
Users can have the following roles:
Currently, the following application type is supported:
The following encryption method is used for passwords:
use tenet::{Tenet, User, encryption_modes::EncryptionModes};
// Initialize Tenet with a database connection
let tenet = Tenet::new("postgres://user:password@localhost/mydb".to_string());
// Create a new tenant
let tenant = tenet.create_tenant("My Company".to_string()).unwrap();
// Create a user and add it to the tenant
let user = User::new(
"admin@example.com".to_string(),
"Admin User".to_string(),
"secure_password".to_string(),
EncryptionModes::Argon2,
"admin@example.com".to_string(),
true,
tenant.id
);
let created_user = tenant.add_user(&user).unwrap();
We use unit/integration tests. In order to run them you need docker running and have cargo-nextest installed. You can do this with:
> cargo install cargo-nextest --locked
To run the tests, use the following command:
> cargo nextest run
GPL-3.0-or-later