Build your service-server fast, easy (and without hosting!)

Related tags

Utilities service-io
Overview

service-io is a library to build servers that offering services with really little effort.

  1. Choose an input connector.
  2. Choose an output connector.
  3. Choose your services.
  4. Run it!

One of the main use-cases is to offer services without a hosting server.

How it works?

All of them, inputs/outputs and services "speak" the same language: the Message type.

Inputs obtain and transform input data into a Message. Services receive Messages and generate other Messages usually doing some kind of processing. Outputs transform a Message into output data and deliver it.

Check the current built-in input/output connectors and services.

Features

  • Easy to use. Running a server with a bunch of services with (really) few lines of code.
  • Hostingless. Run custom server code without hosting server using the existing email infrastructure using the IMAP/SMTP connectors.
  • Scalable. Create your own inputs/outputs/services implementing a trait with a single method. Check docs
  • Multiplatform. Run your local service-server in any computer you have.

Getting Started

Add the following to your Cargo.toml

service-io = "0.1"

Example

Running this example in any of your home computer, and sending an email (as an example, to [email protected]) with public-ip in the subject, you will obtain a response email with your home public IP!

In a similar way, sending an email with process ls -l in the subject will return an email with the files of the folder used to run the example.

use service_io::engine::Engine;
use service_io::connectors::{ImapClient, SmtpClient};
use service_io::services::{PublicIp, Process};

#[tokio::main]
async fn main() {
    Engine::default()
        .input(
            ImapClient::default()
                .domain("imap.domain.com")
                .email("[email protected]")
                .password("1234")
        )
        .output(
            SmtpClient::default()
                .domain("smtp.domain.com")
                .email("[email protected]")
                .password("1234")
        )
        .add_service("public-ip", PublicIp)
        .add_service("process", Process)
        // Add any other service you want
        .run()
        .await;
}

Any email sent to [email protected] will be interpreted as a request by the ImapClient connector. If the first word of the subject matches public-ip, the request will be processed by the PublicIp service. The service PublicIp will generate a response that SmtpClient will be deliver by email to the remitter of the request email.

Check the Engine type for additional methods as input mapping/filters or adding whitelists to your services.

Test it yourself with examples/email_server.rs. Run the following to see all config options.

cargo run --example email_server -- --help

Configuring a gmail account to use with service-io.

For use service-io with IMAP and SMTP connectors with gmail you need to configure some points of your gmail account:

  • Enable IMAP in account settings: Check this Step 1.
  • Enable unsecure app access to allow login with password from an app. (Pending work to make it available through oauth2 and avoid this point).

No hosting server use-case

If you want to offer some custom service that uses custom server code you are forced to pay and maintain a hosting server, even if the service you are offering is eventual or does not use many resources.

To solve this problem, you can use the already existent email infrastructure using the IMAP and SMTP protocols to handle the emails as requests/responses and link them with your services.

service-io helps in this context. Run locally an instance of service-io with IMAP/SMTP connectors. The IMAP connector will periodically fetch the emails your clients sends, then your services will process those emails and generate a response, and finally the SMTP connector will deliver the response emails back to the user.

Anyone from any device with an email client can interact with your local server deployment. There is no hosting maintenance and no front-end app development.

Contribute

  • Have you implemented a service or connector? If its functionallity is not private, share it with others! Make a Pull Request so everyone can use it :)

  • Do you have any cool idea, found a bug or have any question or doubt? Do not hesitate and open an issue!

You might also like...
Rust client for AWS Infinidash service.
Rust client for AWS Infinidash service.

AWS Infinidash - Fully featured Rust client Fully featured AWS Infinidash client for Rust applications. You can use the AWS Infinidash client to make

Provides utility functions to perform a graceful shutdown on an tokio-rs based service

tokio-graceful-shutdown IMPORTANT: This crate is in an early stage and not ready for production. This crate provides utility functions to perform a gr

Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.
Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.

Linkerd 🎈 Welcome to Linkerd! 👋 Linkerd is an ultralight, security-first service mesh for Kubernetes. Linkerd adds critical security, observability,

The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas
The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas

AIVD kerstpuzzel 2021 18 solver The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas, called the 'AIVD kerstpuzzel'. This re

mutex-as-a-service

MAAS (Mutex-As-A-Service) I honestly don't know why I made this, but here it is. Here are some docs: Api docs Api docs were generated with this: https

hado-rshado — A little macro for writing haskell-like do expressions without too much ceremony

hado Monadic haskell-like expressions brought to rust via the hado! macro What? A little macro for writing haskell-like do expressions without too muc

A framework for iterating over collections of types implementing a trait without virtual dispatch
A framework for iterating over collections of types implementing a trait without virtual dispatch

zero_v Zero_V is an experiment in defining behavior over collections of objects implementing some trait without dynamic polymorphism.

A tool to run web applications on AWS Lambda without changing code.
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

tri-angle trader without trade, just watch pair's price change, print arbtrage chance.

tri-angle trader without trade, just watch pair's price change, print arbtrage chance.

Owner
Luis Enrique Muñoz Martín
Passionate about programming languages. In love with rust.
Luis Enrique Muñoz Martín
A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

Alec Deason 62 Sep 20, 2022
Wait Service is a pure rust program to test and wait on the availability of a service.

Wait Service Wait Service is a pure rust program to test and wait on the availability of a service.

Magic Len (Ron Li) 3 Jan 18, 2022
Czkawka is a simple, fast and easy to use app to remove unnecessary files from your computer.

Multi functional app to find duplicates, empty folders, similar images etc.

Rafał Mikrut 9.2k Jan 4, 2023
A Rust framework to develop and use plugins within your project, without worrying about the low-level details.

VPlugin: A plugin framework for Rust. Website | Issues | Documentation VPlugin is a Rust framework to develop and use plugins on applications and libr

VPlugin 11 Dec 31, 2022
A service for helping your cat find other cats

Check back later! Discord Self-hosting This is an open-source service! Feel free to host you own private instances. All we ask is you credit us and li

ibx34 4 Oct 31, 2021
Dr-dotnet - 🩺 One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service

Dr-dotnet - ?? One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service. Based on the lowest level dotnet profiling APIs and using the rust language ?? for a minimal runtime penalty.

Olivier Giniaux 25 Dec 17, 2022
Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

Fusion is a cross-platform App Dev ToolKit build on Rust . Fusion lets you create Beautiful and Fast apps for mobile and desktop platform.

Fusion 1 Oct 19, 2021
A simple *blazingly fast* Rust library to unzip an S3 archive without downloading.

S3-unzip A simple blazingly fast Rust library to unzip an S3 archive into S3's root directory. Works without downloading the archive or putting it int

Mykhailo Bondarenko 9 Jul 12, 2022
Add nice user-facing diagnostics to your errors without being weird about it.

thisdiagnostic is a Rust library for adding rich diagnostic metadata to errors, for some really fancy and customizable error reporting!

Kat Marchán 14 Feb 2, 2022
A simple, fast, easy README generator

Welcome to Readme Generator A simple, fast, easy README generator. Never worry about READMEs again! What it does: Run the command in your project's di

Dhravya Shah 41 Nov 13, 2022