{"id":13671809,"url":"https://github.com/lemunozm/service-io","last_synced_at":"2025-04-27T18:31:47.876Z","repository":{"id":57664077,"uuid":"475428044","full_name":"lemunozm/service-io","owner":"lemunozm","description":"Build your own hostingless server.","archived":true,"fork":false,"pushed_at":"2023-07-10T18:02:04.000Z","size":273,"stargazers_count":34,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-25T06:51:57.408Z","etag":null,"topics":["email","imap","server","smtp"],"latest_commit_sha":null,"homepage":"","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/lemunozm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-29T12:16:05.000Z","updated_at":"2024-12-29T09:11:09.000Z","dependencies_parsed_at":"2022-08-28T00:12:17.569Z","dependency_job_id":null,"html_url":"https://github.com/lemunozm/service-io","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fservice-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fservice-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fservice-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fservice-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemunozm","download_url":"https://codeload.github.com/lemunozm/service-io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187303,"owners_count":21549617,"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":["email","imap","server","smtp"],"created_at":"2024-08-02T09:01:19.313Z","updated_at":"2025-04-27T18:31:45.589Z","avatar_url":"https://github.com/lemunozm.png","language":"Rust","funding_links":["https://www.buymeacoffee.com/lemunozm"],"categories":["Rust"],"sub_categories":[],"readme":"[![](https://img.shields.io/crates/v/service-io)](https://crates.io/crates/service-io)\n[![](https://img.shields.io/docsrs/service-io)](https://docs.rs/service-io)\n[![](https://img.shields.io/crates/l/service-io)](https://www.apache.org/licenses/LICENSE-2.0.txt)\n[![](https://img.shields.io/badge/bymeacoffee-donate-yellow)](https://www.buymeacoffee.com/lemunozm)\n\n**NOTE: This crate is archived, use [`mailfred`](https://github.com/lemunozm/mailfred) instead.**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/title.png\" title=\"service-io\"\u003e\n\u003c/p\u003e\n\n`service-io` is a library to build servers that offering services with really little effort.\n\n1. Choose an input connector.\n2. Choose an output connector.\n3. Choose your services.\n4. Run it!\n\nOne of the main use-cases is to offer services [without a hosting server](#no-hosting-server).\n\n## How it works?\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/library-schema.png\" title=\"schema\"\u003e\n\u003c/p\u003e\n\nAll of them, **inputs**/**outputs** and **services** \"speak\" the same language:\nthe [`Message`](https://docs.rs/service-io/latest/service_io/message/struct.Message.html) type.\n\nInputs obtain and transform input data into a `Message`.\nServices receive `Message`s and generate other `Message`s usually doing some kind of processing.\nOutputs transform a `Message` into output data and deliver it.\n\nCheck the current built-in input/output\n[connectors](https://docs.rs/service-io/latest/service_io/connectors/index.html)\nand\n[services](https://docs.rs/service-io/latest/service_io/services/index.html).\n\n## Features\n- **Easy to use**. Running a server with a bunch of services with (really) few lines of code.\n- **Hostingless**. Run custom server code without hosting server using the existing email infrastructure\n  using the IMAP/SMTP connectors.\n- **Scalable**. Create your own inputs/outputs/services implementing a trait with a single method.\n  [Check docs](https://docs.rs/service-io/latest/service_io/interface/index.html)\n- **Multiplatform**. Run your local service-server in any computer you have.\n\n## Getting Started\n- [API Docs](https://docs.rs/service-io/latest/service_io/)\n- [Examples](examples)\n\nAdd the following to your `Cargo.toml`\n```toml\nservice-io = \"0.1\"\n```\n\n## Example\nRunning this example in any of your home computer,\nand sending an email (as an example, to `services@domain.com`)\nwith `public-ip` in the subject, you will obtain a response email with your home public IP!\n\nIn a similar way, sending an email with `process ls -l` in the subject will return\nan email with the files of the folder used to run the example.\n\n```rust,no_run\nuse service_io::engine::Engine;\nuse service_io::connectors::{ImapClient, SmtpClient};\nuse service_io::services::{PublicIp, Process, Echo, Alarm};\n\n#[tokio::main]\nasync fn main() {\n    Engine::default()\n        .input(\n            ImapClient::default()\n                .domain(\"imap.domain.com\")\n                .email(\"services@domain.com\")\n                .password(\"1234\")\n        )\n        .output(\n            SmtpClient::default()\n                .domain(\"smtp.domain.com\")\n                .email(\"services@domain.com\")\n                .password(\"1234\")\n        )\n        .add_service(\"echo\", Echo)\n        .add_service(\"alarm\", Alarm)\n        .add_service(\"public-ip\", PublicIp)\n        .add_service(\"process\", Process)\n        // Add any other service you want\n        .run()\n        .await;\n}\n```\n\nAny email sent to `services@domain.com` will be interpreted as a request by the `ImapClient` connector.\nIf the first word of the subject matches `public-ip`, the request will be processed by the `PublicIp` service.\nThe service `PublicIp` will generate a response that `SmtpClient` will be deliver by email\nto the remitter of the request email.\n\nCheck the [Engine](https://docs.rs/service-io/latest/service_io/engine/struct.Engine.html) type\nfor additional methods as input mapping/filters or adding whitelists to your services.\n\nTest it yourself with [examples/email_server.rs](examples/email_server.rs).\nRun the following to see all config options.\n```sh\ncargo run --example email_server -- --help\n```\n\n## Configuring a gmail account to use with `service-io`.\nFor use `service-io` with IMAP and SMTP connectors with gmail you need to configure some points\nof your gmail account:\n- Enable IMAP in account settings: Check this [Step 1](https://support.google.com/mail/answer/7126229?hl=en#zippy=%2Cpaso-comprueba-que-imap-est%C3%A9-activado%2Cstep-check-that-imap-is-turned-on).\n- Enable [unsecure app access](https://support.google.com/accounts/answer/6010255?hl=en)\n  to allow login with password from an app.\n  (Pending work to make it available through *oauth2* and avoid this point).\n\n## No hosting server use-case \u003cspan id=\"no-hosting-server\"/\u003e\nIf you want to offer some custom service that uses *custom server code*\nyou are forced to pay and maintain a hosting server,\neven if the service you are offering is eventual or does not use many resources.\n\nTo solve this problem, you can use the already existent email infrastructure\nusing the IMAP and SMTP protocols to handle the emails as requests/responses and link them with your services.\n\n`service-io` helps in this context.\nRun locally an instance of `service-io` with IMAP/SMTP connectors.\nThe IMAP connector will periodically fetch the emails your clients sends,\nthen your services will process those emails and generate a response,\nand finally the SMTP connector will deliver the response emails back to the user.\n\nAnyone from any device with an email client can interact with your local server deployment.\nThere is **no hosting maintenance** and **no front-end app development**.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/no-hosting-server.png\" title=\"schema\"\u003e\n\u003c/p\u003e\n\n## Contribute\n- *Have you implemented a **service** or **connector**?*\n  If its functionallity is not private, share it with others!\n  Make a *Pull Request* so everyone can use it :)\n\n- *Do you have any cool **idea**, found a **bug** or have any **question** or **doubt**?*\n  Do not hesitate and open an issue!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemunozm%2Fservice-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemunozm%2Fservice-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemunozm%2Fservice-io/lists"}