Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦀 Rusters Core Runtime

crates.io GitHub License Untrustnova

The official framework core library for Rusters projects.

Provides the underlying runtime infrastructure for full-stack apps generated with cargo ignite. Built on top of Axum, Tokio, and SQLx.


📦 Features

1. Section-based .env Parser (config)

Rusters uses a section-based configuration format for structured grouping rather than standard flat property structures:

[RUSTERS_CORE]
PROJECT_ID="rusters_app"
BACKEND_PORT=4200
FRONTEND_PORT=3000
ENVIRONMENT="development"
HTTP_SERVER="apache"

[RUSTERS_DATABASE]
CONNECTION_TYPE="sqlite"
SOURCE_PATH="database/project.sqlite"

Exposes typed RustersConfig, CoreConfig, and DatabaseConfig structs parsed securely using std::env::current_dir().

2. Agnostic Database Pool (db)

Unified connection pool wrapper over sqlx::AnyPool. Automatically initializes the appropriate driver connection, configures thread pools, and drives migrations at runtime:

  • Supported engines: SQLite (local files), MySQL, PostgreSQL.

3. Ergonomic Routing Registry (router)

A wrapper around axum::Router which automatically handles base setups and pre-registers standard framework routing check points:

  • GET /_rusters/health: System uptime checking.
  • GET /_rusters/info: Returns current JSON project configuration, HTTP server configurations, and system versions.

4. Middleware Stack (middleware)

Includes pre-baked Tower service layers for backend request interception:

  • Bearer Token Authentication: Simple request validation layer returning 401 Unauthorized for missing/wrong headers.
  • Trace Logging: Trace handler wrapping tower-http for request logging.

5. String-Substitution Template Engine (template)

Evaluates native values and inserts them inside .html or .js file layouts using the {{ key }} syntax during compile-time or run-time asset assembly.


🛠 Usage

Add rusters-core as a Git dependency (until published on crates.io):

[dependencies]
rusters-core = { git = "https://github.com/untrustnova/rusters-core", tag = "v0.1.0" }

In your main.rs:

use std::sync::Arc;
use rusters_core::{config::RustersConfig, router::RustersRouter};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let config = Arc::new(RustersConfig::load()?);
    let router = RustersRouter::new();
    router.serve(config).await?;
    Ok(())
}

📄 License

Licensed under the Apache License 2.0. Built by the Untrustnova community.

About

🤖 ¦ The Core for Rusters, you should check out rusters-cli also!

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages