From 56e1750e5e1f1fdac787305063cc319754f20a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Ara=C3=BAjo?= Date: Mon, 9 Feb 2026 22:36:26 -0300 Subject: [PATCH 1/3] docs: added badges to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 6defa07..69358f2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Sofie +[![crates.io](https://img.shields.io/crates/v/sofie?style=flat-square)](https://crates.io/crates/sofie) +[![Build Status](https://github.com/ararog/sofie/actions/workflows/rust.yml/badge.svg?event=push)](https://github.com/ararog/sofie/actions/workflows/rust.yml) +[![Documentation](https://docs.rs/deboa/badge.svg)](https://docs.rs/deboa/latest/deboa) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + **The elegant full-stack web framework that makes Rust web development effortless** **Sofie** is a comprehensive, production-ready web framework for Rust that combines simplicity with power. Built on top of VeTiS, it provides everything you need to build modern web applications - from REST APIs to full-featured web services - with a clean, intuitive API that makes development a joy. From e3d25efb916593e9ecd5d3b18cc5568eb95b54b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Ara=C3=BAjo?= Date: Tue, 10 Feb 2026 09:07:21 -0300 Subject: [PATCH 2/3] docs: updated badges --- README.md | 6 ++---- docs/index.md | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 69358f2..cec027a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # Sofie -[![crates.io](https://img.shields.io/crates/v/sofie?style=flat-square)](https://crates.io/crates/sofie) -[![Build Status](https://github.com/ararog/sofie/actions/workflows/rust.yml/badge.svg?event=push)](https://github.com/ararog/sofie/actions/workflows/rust.yml) -[![Documentation](https://docs.rs/deboa/badge.svg)](https://docs.rs/deboa/latest/deboa) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Crates.io downloads](https://img.shields.io/crates/d/sofie)](https://crates.io/crates/sofie) [![crates.io](https://img.shields.io/crates/v/sofie?style=flat-square)](https://crates.io/crates/sofie) [![Build Status](https://github.com/ararog/sofie/actions/workflows/rust.yml/badge.svg?event=push)](https://github.com/ararog/sofie/actions/workflows/rust.yml) ![Crates.io MSRV](https://img.shields.io/crates/msrv/sofie) [![Documentation](https://docs.rs/sofie/badge.svg)](https://docs.rs/sofie/latest/sofie) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ararog/sofie/blob/main/LICENSE.md) [![codecov](https://codecov.io/gh/ararog/sofie/graph/badge.svg?token=T0HSBAPVSI)](https://codecov.io/gh/ararog/sofie) + **The elegant full-stack web framework that makes Rust web development effortless** diff --git a/docs/index.md b/docs/index.md index 31aac36..7b7a28f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,10 +9,7 @@ permalink: /

Sofie

-[![crates.io](https://img.shields.io/crates/v/sofie?style=flat-square)](https://crates.io/crates/sofie) -[![Build Status](https://github.com/ararog/sofie/actions/workflows/rust.yml/badge.svg?event=push)](https://github.com/ararog/sofie/actions/workflows/rust.yml) -[![Documentation](https://docs.rs/deboa/badge.svg)](https://docs.rs/deboa/latest/deboa) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Crates.io downloads](https://img.shields.io/crates/d/sofie)](https://crates.io/crates/sofie) [![crates.io](https://img.shields.io/crates/v/sofie?style=flat-square)](https://crates.io/crates/sofie) [![Build Status](https://github.com/ararog/sofie/actions/workflows/rust.yml/badge.svg?event=push)](https://github.com/ararog/sofie/actions/workflows/rust.yml) ![Crates.io MSRV](https://img.shields.io/crates/msrv/sofie) [![Documentation](https://docs.rs/sofie/badge.svg)](https://docs.rs/sofie/latest/sofie) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ararog/sofie/blob/main/LICENSE.md) [![codecov](https://codecov.io/gh/ararog/sofie/graph/badge.svg?token=T0HSBAPVSI)](https://codecov.io/gh/ararog/sofie) **Sofie** is a comprehensive, production-ready web framework for Rust that combines simplicity with power. Built on top of VeTiS, it provides everything you need to build modern web applications - from REST APIs to full-featured web services - with a clean, intuitive API that makes development a joy. From 9a9be7e08344ed8503c92ec1f6ecc2632cb62065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Ara=C3=BAjo?= Date: Tue, 24 Feb 2026 19:28:25 -0300 Subject: [PATCH 3/3] refactor: updating sofie code based on latest vetis changes --- Cargo.lock | 126 +++++++++++++++++++++++++++++-------------- Cargo.toml | 2 +- src/lib.rs | 17 +++--- src/tests/app.rs | 21 +++++--- src/tests/handler.rs | 12 +++-- 5 files changed, 117 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1d015c..dc856d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,7 +47,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -58,7 +58,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -368,9 +368,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.58" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" dependencies = [ "clap_builder", "clap_derive", @@ -378,9 +378,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.58" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" dependencies = [ "anstream", "anstyle", @@ -478,6 +478,18 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crossfire" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4150133c3f558d3190b52a4d36b571e29c18a24e98d24d12201bed0c038986f8" +dependencies = [ + "crossbeam-utils", + "futures-core", + "parking_lot", + "smallvec", +] + [[package]] name = "data-encoding" version = "2.10.0" @@ -591,9 +603,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" dependencies = [ "log", "regex", @@ -601,9 +613,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" dependencies = [ "anstream", "anstyle", @@ -625,7 +637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -723,9 +735,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -733,9 +745,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" @@ -750,9 +762,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-lite" @@ -769,9 +781,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", @@ -791,21 +803,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -815,7 +827,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -1250,6 +1261,16 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +[[package]] +name = "libmimalloc-sys" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -1330,10 +1351,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] -name = "mime" -version = "0.3.17" +name = "mimalloc" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8" +dependencies = [ + "libmimalloc-sys", +] [[package]] name = "minimime" @@ -1819,7 +1843,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1878,7 +1902,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1905,6 +1929,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + [[package]] name = "same-file" version = "1.0.6" @@ -2019,6 +2049,19 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_yaml_ng" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha1" version = "0.6.1" @@ -2610,6 +2653,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -2660,14 +2709,14 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vetis" -version = "0.1.4-beta.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a971f0f85cdcbc3f5398720a65ffd69e45676392cf119c22648393df7d25cd6b" +version = "0.1.4-beta.4" dependencies = [ "async-signal", + "blocking", "bytes", "cfg-if", "clap", + "crossfire", "deboa", "env_logger", "futures-lite", @@ -2681,17 +2730,15 @@ dependencies = [ "hyper-util", "log", "macro_rules_attribute", - "mime", - "minimime", + "mimalloc", "peekable", "quinn", "radix_trie", "rand 0.9.2", - "regex", "rt-gate", "rustls", "serde", - "serde_json", + "serde_yaml_ng", "signal-hook", "smol", "smol-hyper", @@ -2701,7 +2748,6 @@ dependencies = [ "tokio", "tokio-rustls", "tokio-util", - "toml", "url", ] @@ -2864,7 +2910,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 1105732..7adde70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ hyper = { version = "1.8.1", features = ["server"] } hyper-util = "0.1.19" log = "0.4.29" thiserror = "2.0.18" -vetis = { version = "0.1.4-beta.3" } +vetis = { version = "0.1.4-beta.4", path = "../vetis/vetis", default-features = false} tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } toml = "0.9.11" serde = "1.0.228" diff --git a/src/lib.rs b/src/lib.rs index 2d21c03..e90d840 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,12 +2,9 @@ use std::{fs::read_to_string, future::Future, path::Path}; use log::error; use vetis::{ - config::{ListenerConfig, ServerConfig, VirtualHostConfig}, + config::server::{virtual_host::VirtualHostConfig, ListenerConfig, ServerConfig}, errors::VetisError, - server::{ - path::HandlerPath, - virtual_host::{handler_fn, VirtualHost}, - }, + server::virtual_host::{handler_fn, path::HandlerPath, VirtualHost}, Vetis, }; @@ -19,8 +16,8 @@ pub mod config; pub mod errors; mod tests; -pub type Request = vetis::Request; -pub type Response = vetis::Response; +pub type Request = vetis::server::http::Request; +pub type Response = vetis::server::http::Response; pub struct App { config: Config, @@ -52,11 +49,13 @@ impl Default for App { let listener_config = ListenerConfig::builder() .port(port) .interface(interface) - .build(); + .build() + .expect("Failed to build listener config"); let server_config = ServerConfig::builder() .add_listener(listener_config) - .build(); + .build() + .expect("Failed to build server config"); App { config, server: Vetis::new(server_config) } } diff --git a/src/tests/app.rs b/src/tests/app.rs index ef8703d..d5f1cbd 100644 --- a/src/tests/app.rs +++ b/src/tests/app.rs @@ -18,15 +18,18 @@ mod sofie_tests { #[cfg(test)] mod sophia_integration_tests { - use vetis::config::{ListenerConfig, ServerConfig}; + use vetis::{ + config::server::{ListenerConfig, ServerConfig}, + server::http::{Request, Response}, + }; use crate::App; #[tokio::test] async fn test_sophia_handler_signature() { async fn test_handler( - _req: vetis::Request, - ) -> Result> { + _req: Request, + ) -> Result> { // Return a simple error since we can't create ResponseType easily Err("Test error".into()) } @@ -37,17 +40,17 @@ mod sophia_integration_tests { } #[tokio::test] - async fn test_sophia_configuration() { + async fn test_sophia_configuration() -> Result<(), Box> { let mut sophia = App::default(); let listener_config = ListenerConfig::builder() .port(8080) .interface("127.0.0.1") - .build(); + .build()?; let config = ServerConfig::builder() .add_listener(listener_config) - .build(); + .build()?; assert_eq!( config @@ -60,10 +63,12 @@ mod sophia_integration_tests { let _ = &mut sophia; assert!(true); + + Ok(()) } #[tokio::test] - async fn test_sophia_error_handling() { + async fn test_sophia_error_handling() -> Result<(), Box> { use crate::errors::SofieError; let error = SofieError::ServerStart("Test error".to_string()); @@ -80,5 +85,7 @@ mod sophia_integration_tests { let error3 = SofieError::ServerStart("Different error".to_string()); assert_ne!(error, error3); + + Ok(()) } } diff --git a/src/tests/handler.rs b/src/tests/handler.rs index fac9752..c8c3b69 100644 --- a/src/tests/handler.rs +++ b/src/tests/handler.rs @@ -2,10 +2,10 @@ mod handler_tests { use http::HeaderValue; use hyper::StatusCode; - use vetis::Response; + use vetis::server::http::Response; #[tokio::test] - async fn test_response_creation() { + async fn test_response_creation() -> Result<(), Box> { let response: Response = Response::builder() .status(StatusCode::OK) .text("Hello, World!"); @@ -16,6 +16,8 @@ mod handler_tests { .status(), StatusCode::OK ); + + Ok(()) } #[tokio::test] @@ -174,10 +176,10 @@ mod handler_tests { mod handler_integration_tests { use http::HeaderValue; use hyper::StatusCode; - use vetis::Response; + use vetis::server::http::Response; #[tokio::test] - async fn test_rest_api_patterns() { + async fn test_rest_api_patterns() -> Result<(), Box> { let success_response: Response = Response::builder() .status(StatusCode::OK) .header("Content-Type", HeaderValue::from_static("application/json")) @@ -222,6 +224,8 @@ mod handler_integration_tests { .status(), StatusCode::NOT_FOUND ); + + Ok(()) } #[tokio::test]