Crates.io | fluxor |
lib.rs | fluxor |
version | 0.7.1 |
created_at | 2025-01-14 22:18:33.253106+00 |
updated_at | 2025-07-09 22:38:17.077026+00 |
description | Fluxor is a versatile Rust web framework designed for data science and computing science applications. |
homepage | https://github.com/dr-montasir/fluxor |
repository | https://github.com/dr-montasir/fluxor |
max_upload_size | |
id | 1516793 |
size | 115,235 |
Fluxor is a versatile Rust web framework designed for data science and computing science applications. Inspired by frameworks like Express.js, Flask, and Shiny, Fluxor provides a robust environment for developing applications that require efficient data handling and server management.
fluxor_cli
) for project scaffolding to expedite the development process.To begin using Fluxor, ensure that you have Rust installed on your system. You can either create a new Fluxor project or add Fluxor to an existing project.
If you're starting from scratch, you can add Fluxor directly to a new or existing Rust project using Cargo:
cargo new <project_name>
cd <project_name>
cargo add fluxor
If you prefer to use the Fluxor CLI to create a new project, you can do so with the following commands:
cargo install fluxor_cli
fluxor new <project_name> --version latest --example helloworld
Replace <project_name>
with your desired project name.
Once the project scaffolding is complete, navigate into your project directory:
cd <project_name>
Now, you can build and run your Fluxor application:
cargo run
Your application should now be running on http://127.0.0.1:8080
.
Comprehensive documentation is available in the docs directory for further guidance on using Fluxor, modules, configuration, and deployment.
Fluxor is organized into several key modules:
fluxor_cli
to help developers understand how to utilize the framework effectively.req.params.extra
), similar to database integration. Future releases will aim to add more middleware functions to enhance Fluxorโs capabilities.A basic Fluxor application that responds with "Hello, World!" when accessed via a web browser.
use fluxor::prelude::*;
fn hello(_req: Req, _params: Params) -> Reply {
boxed(async {
Ok(Response::builder()
.header("Content-Type", "text/html; charset=UTF-8")
.body(Body::from("<h1>๐ Hello, World!</h1>"))
.unwrap())
})
}
#[tokio::main]
async fn main() {
let mut app = Fluxor::new(); // Initialize the application.
app.route("/", GET, hello); // Set the route (path, method, handler).
app.run("127.0.0.1", "8080").await; // Start the HTTP server (host, port).
}
A simple Fluxor API endpoint that returns a JSON response (method: GET).
use fluxor::prelude::*;
fn hello(_req: Req, _params: Params) -> Reply {
boxed(async move {
let json_response = format!(r#"{{"message": "๐ Hello, World!"}}"#);
Ok(Response::builder()
.header("Content-Type", "application/json")
.body(Body::from(json_response))
.unwrap())
})
}
#[tokio::main]
async fn main() {
let mut app = Fluxor::new(); // Initialize the application.
app.route("/", GET, hello); // Set the route (path, method, handler).
app.route("/http-client", GET, serve_http_client); // A simple http client to test your application.
app.run("127.0.0.1", "8080").await; // Start the HTTP server (host, port).
}
A simple Fluxor API endpoint that returns a JSON response (method: POST).
use fluxor::prelude::*;
fn hello(_req: Req, _params: Params) -> Reply {
boxed(async move {
let json_response = format!(r#"{{"message": "๐ Hello, World!"}}"#);
Ok(Response::builder()
.header("Content-Type", "application/json")
.body(Body::from(json_response))
.unwrap())
})
}
#[tokio::main]
async fn main() {
let mut server = Fluxor::new(); // Initialize the application.
server.route("/", POST, hello); // Set the route (path, method, handler).
server.route("/http-client", GET, serve_http_client); // A simple HTTP client to test your application.
server.run("127.0.0.1", "8080").await; // Start the HTTP server (host, port).
}
The fluxor_cli
allows users to quickly scaffold new Fluxor projects. Here's how to utilize it:
fluxor new <project_name> --version <version> --example <example-name>
helloworld
or helloworld-api
.Use the example name after the flag --example (e.g., helloworld
):
fluxor new my_project --version latest --example helloworld
fluxor new my_app --version latest --example routes
fluxor new routes_app --version latest --example routes-project
fluxor new assets_example --version latest --example assets
fluxor new dotenv_example --version latest --example dotenv
fluxor new template_app --version latest --example cans-template-engine
The logo consists of a stylized letter "S" and an inverted letter "F." The letter "S" represents "server," while the letter "F" symbolizes the name of the framework "Fluxor." The logo features two colors: orange, representing the Rust programming language, and cyan, symbolizing "Fluxio," a Rust programming library for HTTP. Together, the logo conveys the image of a flame, indicating that the server is running.
Contributions are welcome! If you'd like to contribute to Fluxor, please fork the repository, create a new branch, and submit a pull request. For larger changes, please discuss your ideas via an issue before implementing them.
Fluxor is licensed under either of the following licenses:
See the LICENSE file for more details.