| Crates.io | reinhardt-apps |
| lib.rs | reinhardt-apps |
| version | 0.1.0-alpha.1 |
| created_at | 2026-01-23 05:42:56.547334+00 |
| updated_at | 2026-01-23 05:42:56.547334+00 |
| description | Application registry and management for Reinhardt framework |
| homepage | |
| repository | https://github.com/kent8192/reinhardt-rs |
| max_upload_size | |
| id | 2063557 |
| size | 230,410 |
Application configuration and registry for Reinhardt framework.
reinhardt-apps provides the application configuration system inspired by Django's INSTALLED_APPS. It enables:
Important Note: Unlike Django, installed_apps! in Reinhardt is for user applications only. Built-in framework features (auth, sessions, admin, etc.) are enabled via Cargo feature flags, not through installed_apps!.
Add reinhardt to your Cargo.toml:
[dependencies]
reinhardt = { version = "0.1.0-alpha.1", package = "reinhardt-web", features = ["apps"] }
# Or use a preset:
# reinhardt = { version = "0.1.0-alpha.1", package = "reinhardt-web", features = ["standard"] } # Recommended
# reinhardt = { version = "0.1.0-alpha.1", package = "reinhardt-web", features = ["full"] } # All features
Then import app features:
use reinhardt::apps::{AppConfig, installed_apps};
Note: App features are included in the standard and full feature presets.
Define installed apps using the installed_apps! macro:
use reinhardt::apps::installed_apps;
installed_apps! {
users: "users",
posts: "posts",
}
For built-in framework features, use Cargo feature flags:
[dependencies]
reinhardt = {
version = "0.1.0-alpha.1",
package = "reinhardt-web",
features = ["auth", "sessions", "admin"]
}
Then import them directly in your code:
use reinhardt::auth::*;
use reinhardt::auth::sessions::*;
use reinhardt::admin::*;
The installed_apps! macro automatically generates:
// Generated enum
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InstalledApp {
Users,
Posts,
}
// Display implementation
impl std::fmt::Display for InstalledApp {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Users => write!(f, "users"),
Self::Posts => write!(f, "posts"),
}
}
}
// Helper methods
impl InstalledApp {
pub fn all_apps() -> Vec<String> {
vec![
"users".to_string(),
"posts".to_string(),
]
}
}
Use the generated enum for type-safe app references:
// Type-safe reference
let app = InstalledApp::Users;
println!("App path: {}", app); // "users"
// List all apps
let all = InstalledApp::all_apps();
The app registry enables automatic discovery for:
The installed_apps! macro integrates with:
// src/config/apps.rs
use reinhardt::apps::installed_apps;
installed_apps! {
users: "users",
posts: "posts",
}
pub fn get_installed_apps() -> Vec<String> {
InstalledApp::all_apps()
}
Framework features are enabled separately via Cargo.toml:
[dependencies]
reinhardt = {
version = "0.1.0-alpha.1",
package = "reinhardt-web",
features = ["auth", "sessions", "admin", "static-files"]
}
User-defined apps use simple names matching their directory:
users: "users",
blog: "blog",
api: "api",
Framework features are enabled via Cargo feature flags:
| Feature | Cargo.toml | Import |
|---|---|---|
| Authentication | features = ["auth"] |
use reinhardt::auth::*; |
| Admin Panel | features = ["admin"] |
use reinhardt::admin::*; |
| Sessions | features = ["sessions"] |
use reinhardt::auth::sessions::*; |
| Static Files | features = ["static-files"] |
use reinhardt::staticfiles::*; |
| Database | features = ["database"] |
use reinhardt::db::*; |
The macro performs compile-time validation:
reinhardt.* modules exist (for framework references)// Valid: User app
installed_apps! {
users: "users", // ✅ OK
}
// Invalid: Non-existent framework module
installed_apps! {
nonexistent: "reinhardt.nonexistent", // ❌ Compile error
}
Note: If you see compile errors about missing reinhardt.contrib.* modules, this is because those modules don't exist. Use Cargo feature flags instead (see above).
my-project/
├── src/
│ ├── config/
│ │ ├── apps.rs # installed_apps! definition
│ │ ├── settings.rs
│ │ └── urls.rs
│ └── apps/
│ ├── users/
│ │ ├── lib.rs
│ │ ├── models.rs
│ │ └── views.rs
│ └── posts/
│ ├── lib.rs
│ ├── models.rs
│ └── views.rs
└── Cargo.toml
// src/config/apps.rs
use reinhardt::apps::installed_apps;
installed_apps! {
users: "users",
posts: "posts",
}
pub fn get_installed_apps() -> Vec<String> {
InstalledApp::all_apps()
}
# Cargo.toml
[dependencies]
reinhardt = {
version = "0.1.0-alpha.1",
package = "reinhardt-web",
features = ["auth", "sessions", "database"]
}
// Migrations automatically discover apps
use reinhardt::db::migrations::MigrationRunner;
let runner = MigrationRunner::new(db);
let installed = InstalledApp::all_apps();
runner.migrate(&installed).await?;
// Admin panel auto-discovers models from apps
use reinhardt::admin::AdminSite;
let admin = AdminSite::new();
admin.autodiscover(&InstalledApp::all_apps()).await?;
// src/config/settings.rs
use reinhardt::conf::Settings;
pub fn get_settings() -> Settings {
Settings::builder()
.installed_apps(crate::config::apps::get_installed_apps())
.build()
}
If you're familiar with Django's INSTALLED_APPS, here are the key differences:
Django (Python):
INSTALLED_APPS = [
'django.contrib.auth', # Framework feature
'django.contrib.admin', # Framework feature
'users', # User app
]
Reinhardt (Rust):
# Cargo.toml
[dependencies]
reinhardt = { version = "0.1.0-alpha.1", package = "reinhardt-web", features = ["auth", "admin"] }
// src/config/apps.rs
installed_apps! {
users: "users", // User apps only
}
Why the difference?
Licensed under either of Apache License, Version 2.0 or MIT license at your option.