5 min read
An Introduction to Serverless through a Simple Automation Project

Introduction

If you’re like me, the biggest problem in your life is sharing text and links between devices. This should be a trivial task but isn’t and for many it’s still unnecessarily complicated. From some user research, common solutions include emailing files to oneself or using messaging platforms like Discord. This doesn’t really feel like a good solution particularly when you want to quickly transfer small pieces of information between devices. I wanted to streamline this process by creating an automation that allows for seamless text and file sharing with a single click. Having a free afternoon, I made a simple automation to solve this problem (sort of). I don’t do too many write ups of my projects so if you guys have feedback on how to make it easier to follow feel free to share.

App Idea

It started out pretty simple, I just wanted to be able to share text between my phone and computer. Often times I get links through iMessages or use the Apple Notes app to jot down ideas and want to send them to my computer for convenience or to build off of, but this got tedious. This applied to other forms of media as well. For example, images and files felt tedious especially since:

  1. Some platforms like Discord have a file size limit (I refuse to buy Nitro)
  2. Even when you can transfer stuff via Discord, it can lose quality
  3. Email just felt even more tedious to send something to yourself

I also did not want to switch to a third party application. For these simple use cases, at least, I’d rather keep using the same tools I’ve been using that come natively with the OS (namely Notes, IPhoto, and Windows Sticky Notes). To address these issues, I decided to build out some features to automate these annoying tasks:

  1. Share text from your clipboard directly to the Windows Sticky Note
  2. Share an Apple Note from the Notes app directly to a Windows Sticky Note
  3. Share an image or file directly from iPhotos or the Apple file system directly to a specified folder on your Windows PC

Design and Reasoning

The application requirements I needed were as follows:

  1. I wanted a solution that was well-integrated with the iPhone’s native functionality and user interface. At this time I didn’t want to invest in a Mac or pay for an app development license. After some research, I found Apple Shortcuts which seemed like a good choice for use cases like this, making it a good starting point for the automation pipeline. Additionally, it could send API requests, which was key for the next requirement.

  2. Communication between IPhone and Desktop. This would require a REST API to handle multipart form data for files + text.

  3. Offline delivery to store data in case Desktop is offline (imagine you’re on the bus and have an idea that you want to send really quickly).

  4. A local process that polls the cloud for events. This would require a program that runs in the background on my machine that has an API of its own with a POST method that the Lambda function can forward the data to.

I thought this would be a good opportunity to explore a serverless architecture and help others who are maybe getting into automations. Given the event driven nature of the application, Lambda, API Gateway, and S3 were good choices.

I drew out a simple design diagram to illustrate the process.

design

Cloud seems a bit unnecessary at first but here are some justifications for the design.

  1. Project scope extension. I think in terms of planned features there’s much more room to reason for cloud. Offline delivery is a big one, and also extending the project to an application users can use as opposed to a personal tool.

  2. Security. It’s easier to abstract away part of the security concerns to API Gateway so that your home network isn’t directly exposed to the public internet and API Gateway acts as a public facing layer. Because this allows sharing of arbitrary files and text, adding security layers via cloud to handle authentication, scan files, and act as a barrier to the public internet is useful.

  3. On a personal level, this project gave me a chance to explore AWS Lambda and serverless technologies.

App Demo

Here’s a quick demo of the basic features of the application.

Future Notes

  • Currently this application is not production ready security wise as encryption in transit from device to cloud via public internet needs to be addressed.
  • It honestly is looking like I might need to get a Mac and pay for XCode to build something that is better integrated instead of using Shortcuts. Also to implement two way transfer this might be necessary anyways.
  • Want to add support for Linux as well (I have been thinking of switching to a dual boot for a while now…).
  • Trying to gather some more features and maybe use this as an opportunity to conduct some user research. A few of my friends and random people I asked seemed to like the idea a lot.
  • The Windows API is kind of ass.