{"id":14240600,"url":"https://github.com/spring-rs/spring-rs","last_synced_at":"2025-05-14T10:04:36.917Z","repository":{"id":248381587,"uuid":"806015479","full_name":"spring-rs/spring-rs","owner":"spring-rs","description":"🍃spring-rs is a application framework written in rust inspired by java's spring-boot","archived":false,"fork":false,"pushed_at":"2025-05-07T10:35:04.000Z","size":2922,"stargazers_count":670,"open_issues_count":14,"forks_count":35,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-07T10:50:31.273Z","etag":null,"topics":["axum","cron-job","kafka","macros","microservice","opentelemetry","procedural-macro","redis","rust","sea-orm","spring-boot","spring-rs","sqlx","stream","web"],"latest_commit_sha":null,"homepage":"https://spring-rs.github.io/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spring-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-26T06:02:17.000Z","updated_at":"2025-05-07T04:40:28.000Z","dependencies_parsed_at":"2024-07-14T14:54:58.146Z","dependency_job_id":"7d9f1ca2-48d9-41e7-be60-9c061014fc9b","html_url":"https://github.com/spring-rs/spring-rs","commit_stats":{"total_commits":327,"total_committers":3,"mean_commits":109.0,"dds":"0.033639143730886834","last_synced_commit":"947b3fd632ebb6ef8c8e65c13f4252fdfbfe2074"},"previous_names":["holmofy/autumn-boot","autumn-rs/autumn-rs","spring-rs/autumn-rs"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-rs%2Fspring-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-rs%2Fspring-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-rs%2Fspring-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-rs%2Fspring-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spring-rs","download_url":"https://codeload.github.com/spring-rs/spring-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254119460,"owners_count":22017949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axum","cron-job","kafka","macros","microservice","opentelemetry","procedural-macro","redis","rust","sea-orm","spring-boot","spring-rs","sqlx","stream","web"],"created_at":"2024-08-21T10:01:23.448Z","updated_at":"2025-05-14T10:04:36.899Z","avatar_url":"https://github.com/spring-rs.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/spring-rs/spring-rs/refs/heads/master/docs/static/logo-rust.svg\" alt=\"Logo\" width=\"200\"/\u003e\n    \u003ch3\u003espring-rs is application framework written in Rust, inspired by Java's SpringBoot\u003c/h3\u003e\n    \u003cp\u003eEnglish ｜ \u003ca href=\"https://spring-rs.github.io/zh/docs/getting-started/introduction/\"\u003e中文\u003c/a\u003e\u003c/p\u003e\n    \u003cp\u003e\n        \u003ca href=\"https://crates.io/crates/spring\"\u003e\n            \u003cimg src=\"https://img.shields.io/crates/v/spring.svg\" alt=\"crates.io\"/\u003e\n        \u003c/a\u003e\n        \u003ca href=\"https://docs.rs/spring\"\u003e\n            \u003cimg src=\"https://docs.rs/spring/badge.svg\" alt=\"Documentation\"/\u003e\n        \u003c/a\u003e\n        \u003cimg src=\"https://img.shields.io/crates/l/spring\" alt=\"Documentation\"/\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cb\u003espring-rs\u003c/b\u003e is an application framework that emphasizes convention over configuration, inspired by Java's SpringBoot. \u003cb\u003espring-rs\u003c/b\u003e provides an easily extensible plug-in system for integrating excellent projects in the Rust community, such as axum, sqlx, sea-orm, etc.\n\nCompared with SpringBoot in java, spring-rs has higher performance and lower memory usage, allowing you to completely get rid of the bloated JVM and travel light.\n\n## Features\n\n* ⚡️ High performance: Benefiting from the awesome rust language, \u003cb\u003espring-rs\u003c/b\u003e has the ultimate performance comparable to C/C++\n* 🛡️ High security: Compared to C/C++, the Rust language used by \u003cb\u003espring-rs\u003c/b\u003e provides memory safety and thread safety.\n* 🔨 Lightweight: The core code of spring-rs does not exceed 5,000 lines, and the binary size of the release version packaged in rust is also small.\n* 🔧 Easy to use: \u003cb\u003espring-rs\u003c/b\u003e provides a clear and concise API and optional Procedural Macros to simplify development.\n* 🔌 Highly extensible: \u003cb\u003espring-rs\u003c/b\u003e uses a highly extensible plug-in model, and users can customize plug-ins to extend program capabilities.\n* ⚙️ Highly configurable: \u003cb\u003espring-rs\u003c/b\u003e uses toml to configure applications and plug-ins to improve application flexibility.\n\n## Example\n\n**web**\n\n```rust,no_run\nuse spring::{auto_config, App};\nuse spring_sqlx::{\n    sqlx::{self, Row},\n    ConnectPool, SqlxPlugin\n};\nuse spring_web::{get, route};\nuse spring_web::{\n    error::Result, extractor::{Path, Component}, handler::TypeRouter, axum::response::IntoResponse, Router,\n    WebConfigurator, WebPlugin,\n};\nuse anyhow::Context;\n\n#[auto_config(WebConfigurator)]\n#[tokio::main]\nasync fn main() {\n    App::new()\n        .add_plugin(SqlxPlugin)\n        .add_plugin(WebPlugin)\n        .run()\n        .await\n}\n\n#[get(\"/\")]\nasync fn hello_world() -\u003e impl IntoResponse {\n    \"hello world\"\n}\n\n#[route(\"/hello/{name}\", method = \"GET\", method = \"POST\")]\nasync fn hello(Path(name): Path\u003cString\u003e) -\u003e impl IntoResponse {\n    format!(\"hello {name}\")\n}\n\n#[get(\"/version\")]\nasync fn sqlx_request_handler(Component(pool): Component\u003cConnectPool\u003e) -\u003e Result\u003cString\u003e {\n    let version = sqlx::query(\"select version() as version\")\n        .fetch_one(\u0026pool)\n        .await\n        .context(\"sqlx query failed\")?\n        .get(\"version\");\n    Ok(version)\n}\n```\n\n**job**\n\n```rust,no_run\nuse anyhow::Context;\nuse spring::{auto_config, App};\nuse spring_job::{cron, fix_delay, fix_rate};\nuse spring_job::{extractor::Component, JobConfigurator, JobPlugin};\nuse spring_sqlx::{\n    sqlx::{self, Row},\n    ConnectPool, SqlxPlugin,\n};\nuse std::time::{Duration, SystemTime};\n\n#[auto_config(JobConfigurator)]\n#[tokio::main]\nasync fn main() {\n    App::new()\n        .add_plugin(JobPlugin)\n        .add_plugin(SqlxPlugin)\n        .run()\n        .await;\n\n    tokio::time::sleep(Duration::from_secs(100)).await;\n}\n\n#[cron(\"1/10 * * * * *\")]\nasync fn cron_job(Component(db): Component\u003cConnectPool\u003e) {\n    let time: String = sqlx::query(\"select TO_CHAR(now(),'YYYY-MM-DD HH24:MI:SS') as time\")\n        .fetch_one(\u0026db)\n        .await\n        .context(\"query failed\")\n        .unwrap()\n        .get(\"time\");\n    println!(\"cron scheduled: {:?}\", time)\n}\n\n#[fix_delay(5)]\nasync fn fix_delay_job() {\n    let now = SystemTime::now();\n    let datetime: sqlx::types::chrono::DateTime\u003csqlx::types::chrono::Local\u003e = now.into();\n    let formatted_time = datetime.format(\"%Y-%m-%d %H:%M:%S\");\n    println!(\"fix delay scheduled: {}\", formatted_time)\n}\n\n#[fix_rate(5)]\nasync fn fix_rate_job() {\n    tokio::time::sleep(Duration::from_secs(10)).await;\n    let now = SystemTime::now();\n    let datetime: sqlx::types::chrono::DateTime\u003csqlx::types::chrono::Local\u003e = now.into();\n    let formatted_time = datetime.format(\"%Y-%m-%d %H:%M:%S\");\n    println!(\"fix rate scheduled: {}\", formatted_time)\n}\n```\n\n## Supported plugins\n\n* [x] ![spring-web](https://img.shields.io/crates/v/spring-web.svg)[`spring-web`](https://spring-rs.github.io/docs/plugins/spring-web/): Based on [`axum`](https://github.com/tokio-rs/axum)\n* [x] ![spring-sqlx](https://img.shields.io/crates/v/spring-sqlx.svg)[`spring-sqlx`](https://spring-rs.github.io/docs/plugins/spring-sqlx/): Integrated with [`sqlx`](https://github.com/launchbadge/sqlx)\n* [x] ![spring-postgres](https://img.shields.io/crates/v/spring-postgres.svg)[`spring-postgres`](https://spring-rs.github.io/docs/plugins/spring-postgres/): Integrated with [`rust-postgres`](https://github.com/sfackler/rust-postgres)\n* [x] ![spring-sea-orm](https://img.shields.io/crates/v/spring-sea-orm.svg)[`spring-sea-orm`](https://spring-rs.github.io/docs/plugins/spring-sea-orm/): Integrated with [`sea-orm`](https://www.sea-ql.org/SeaORM/)\n* [x] ![spring-redis](https://img.shields.io/crates/v/spring-redis.svg)[`spring-redis`](https://spring-rs.github.io/docs/plugins/spring-redis/): Integrated with [`redis`](https://github.com/redis-rs/redis-rs)\n* [x] ![spring-mail](https://img.shields.io/crates/v/spring-mail.svg)[`spring-mail`](https://spring-rs.github.io/docs/plugins/spring-mail/): Integrated with [`lettre`](https://github.com/lettre/lettre)\n* [x] ![spring-job](https://img.shields.io/crates/v/spring-job.svg)[`spring-job`](https://spring-rs.github.io/docs/plugins/spring-job/): Integrated with [`tokio-cron-scheduler`](https://github.com/mvniekerk/tokio-cron-scheduler)\n* [x] ![spring-stream](https://img.shields.io/crates/v/spring-stream.svg)[`spring-stream`](https://spring-rs.github.io/docs/plugins/spring-stream/): Integrate [`sea-streamer`](https://github.com/SeaQL/sea-streamer) to implement message processing such as redis-stream and kafka\n* [x] ![spring-opentelemetry](https://img.shields.io/crates/v/spring-opentelemetry.svg)[`spring-opentelemetry`](https://spring-rs.github.io/docs/plugins/spring-opentelemetry/): Integrate with [`opentelemetry`](https://github.com/open-telemetry/opentelemetry-rust) to implement full observability of logging, metrics, tracing\n* [x] ![spring-grpc](https://img.shields.io/crates/v/spring-grpc.svg)[`spring-grpc`](https://spring-rs.github.io/docs/plugins/spring-grpc/): Integrate[`tonic`](https://github.com/hyperium/tonic) to implement gRPC calls\n\n## Ecosystem\n\n* ![spring-sqlx-migration-plugin](https://img.shields.io/crates/v/spring-sqlx-migration-plugin.svg) [`spring-sqlx-migration-plugin`](https://github.com/Phosphorus-M/spring-sqlx-migration-plugin)\n* ![spring-opendal](https://img.shields.io/crates/v/spring-opendal.svg) [`spring-opendal`](https://github.com/spring-rs/contrib-plugins/tree/master/spring-opendal)\n\n[more\u003e\u003e](https://crates.io/crates/spring/reverse_dependencies)\n\n## Project showcase\n\n* [Raline](https://github.com/ralinejs/raline)\n* [AutoWDS](https://github.com/AutoWDS/autowds-backend)\n\n## Contribution\n\nWe also welcome community experts to contribute their own plugins. [Contributing →](https://github.com/spring-rs/spring-rs)\n\n## Help\n\nClick here to view common problems encountered when using `spring-rs` [Help →](https://spring-rs.github.io/docs/help/faq/)","funding_links":[],"categories":["Rust","Libraries","\u003ca name=\"Rust\"\u003e\u003c/a\u003eRust"],"sub_categories":["Web programming"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-rs%2Fspring-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspring-rs%2Fspring-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-rs%2Fspring-rs/lists"}