{"id":19979187,"url":"https://github.com/shellfly/haro","last_synced_at":"2025-07-18T22:03:47.958Z","repository":{"id":65500963,"uuid":"485188374","full_name":"shellfly/haro","owner":"shellfly","description":"A simple and synchronous web framework written in and for Rust","archived":false,"fork":false,"pushed_at":"2023-01-31T00:38:30.000Z","size":100,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-03T23:13:16.675Z","etag":null,"topics":["http","rust","web","webframework"],"latest_commit_sha":null,"homepage":"https://docs.rs/haro","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellfly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-25T01:45:27.000Z","updated_at":"2023-07-06T15:20:02.000Z","dependencies_parsed_at":"2023-02-15T20:31:39.535Z","dependency_job_id":null,"html_url":"https://github.com/shellfly/haro","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shellfly/haro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellfly%2Fharo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellfly%2Fharo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellfly%2Fharo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellfly%2Fharo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellfly","download_url":"https://codeload.github.com/shellfly/haro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellfly%2Fharo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264492785,"owners_count":23617051,"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":["http","rust","web","webframework"],"created_at":"2024-11-13T03:37:06.650Z","updated_at":"2025-07-09T16:13:06.293Z","avatar_url":"https://github.com/shellfly.png","language":"Rust","readme":"# Haro\n\n![ci](https://github.com/shellfly/haro/actions/workflows/ci.yml/badge.svg)\n[![crates.io](https://img.shields.io/crates/v/haro.svg)](https://crates.io/crates/haro)\n[![chat](https://img.shields.io/badge/chat-discord-brightgreen)](https://discord.gg/AktRUJKphe)\n\n**Haro** is a **simple** and **synchronous** web framework written in and for Rust.\n\nThe project was named after the [Haro character](https://en.wikipedia.org/wiki/Haro_(character)). The application interface was inspired by the [web.py](https://webpy.org/) project.\n\n## Motivation\n\u003e In short, async Rust is more difficult to use and can result in a higher maintenance burden than synchronous Rust, but gives you best-in-class performance in return. All areas of async Rust are constantly improving, so the impact of these issues will wear off over time\n\u003e\n\u003e https://rust-lang.github.io/async-book/01_getting_started/03_state_of_async_rust.html\n\nAs the async book says, async Rust is not mature yet. While bringing performance, it also results in a higher maintenance burden. The goal of this project is to create a simple and minimum synchronous Web framework for Rust.\n\n## Features\n\n- [x] URL Routing with **function**/**closure**/**trait type**\n- [x] Request \u0026 Response with minimal boilerplate\n  - [x] Query args\n  - [x] Post data\n  - [x] JSON\n  - [x] Cookie\n- [x] Middleware\n- [x] Template (Optional)\n- [x] Database (Optional)\n- [x] Tests\n- [ ] HTTP2\n\n## Quick Start\n\nAdd `haro` as a dependency by cargo\n```bash\ncargo add haro\n```\n\nThen, on your main.rs:\n\n```rust\nuse haro::{Application, Request, Response};\n\nfn main() {\n    let mut app = Application::new(\"0:8080\");\n    app.route(\"/\", hello);\n    app.run();\n}\n\nfn hello(_:Request) -\u003eResponse{\n    Response::str(\"Hello Haro\")\n}\n```\n\n## Route by closure\n\nUse a closure as a handler function to capture environment variables\n\n```rust\nuse haro::{Application, Request, Response};\n\nfn main() {\n    let mut app = Application::new(\"0:8080\");\n    app.route(\"/\", |_| Response::str(\"Haro\"));\n    app.route(\"/hello\", hello(\"Haro\"));\n    app.run();\n}\n\nfn hello(name: \u0026str) -\u003e impl Fn(Request) -\u003e Response {\n    let name = name.to_string();\n    move |_: Request| Response::str(\u0026name)\n}\n```\n\n## `Handler` trait\n\nThe handler cloud be a struct that implements the `Handler` trait to handle a request.\n```rust\nuse haro::{Application, Request, Response, Handler};\n\nfn main() {\n    let mut app = Application::new(\"0:8080\");\n    let hello = HelloHandler {\n        name: \"Haro\".to_string(),\n    };\n    app.route_handler(\"/\", hello);\n    app.run();\n}\n\nstruct HelloHandler {\n    name: String,\n}\n\nimpl Handler for HelloHandler {\n    fn call(\u0026self, _: Request) -\u003e Response {\n        Response::str(format!(\"hello {}\", self.name))\n    }\n}\n```\n\n## JSON response\n\n```rust\nuse haro::{Application, Request, Response};\nuse serde_json::json;\n\n...\n\nfn hello(req: Request) -\u003e Response {\n    let data = json!({\n        \"method\":req.method(),\n        \"args\":req.args,\n        \"params\":req.params,\n        \"data\":req.data,\n    });\n    Response::json(data)\n}\n```\n\n## More examples\n\nThe repo contains [more examples](./examples) that show how to put all the pieces together.\n\n\n\n\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellfly%2Fharo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellfly%2Fharo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellfly%2Fharo/lists"}