DEV Community

Cover image for Building a Serverless Photomontage WebApp with Node.js
Jonathan Brizio
Jonathan Brizio

Posted on

Building a Serverless Photomontage WebApp with Node.js

The benefits of the lambda functions are endless. The good thing is that you can create anything in a few clicks. I'm a big fan of the services that offer AWS. You can start with something really simple and apply more complexity adding more services.

On this opportunity, I will show you how was integrate some components that AWS offers to us to make the final product.

Before putting hands to works, was read some docs and view some implementations to understand if the idea can be viable. The focus was always trying to implement that solution using JavaScript because I have more knowledge of that.

Initial idea

In this case, it was an online photomontage that merges our wanted message into a template that I choose:

Template

Getting Started

The next step was to find a module on npm that resolve our requirement to manipulate images easily. Jimp looks good to me because not have third dependencies and your documentation is complete enough.

With the help of Claudia.js, it was really easy to automate deployments of the lambda functions just with a few commands from the console.

Architecture

The user interacts with an interface, this is located in a bucket (Amazon S3). The form located there, dispatch a POST to an API Rest. Here our AWS API Gateway takes the petition and executes a lambda function to generate the wanted photo in a few seconds.

Architecture

Services used

  • Amazon S3
  • Amazon API Gateway
  • Amazon Lambda

Online Demo

If you want to see all the components working, can you visit the online demo clicking here. This same concept could be used for multiple scenarios.

Main feature

The part most important of this development is the lambda function. Here you can see the code used to generate the photomontage.

What other scenario do you imagine using this?.

Discussion (0)